|
|
|
|
@ -46,6 +46,11 @@ public class XLTaskHelper { |
|
|
|
|
return taskId; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void deleteFile(File file) { |
|
|
|
|
if (file.isDirectory()) for (File f : Path.list(file)) deleteFile(f); |
|
|
|
|
if (file.isFile() && !file.getAbsolutePath().endsWith(".torrent")) Path.clear(file); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public synchronized GetTaskId parse(String url, File savePath) { |
|
|
|
|
if (url.startsWith("file://")) return new GetTaskId(url, savePath); |
|
|
|
|
if (url.startsWith("thunder://")) url = getManager().parserThunderUrl(url); |
|
|
|
|
@ -131,13 +136,8 @@ public class XLTaskHelper { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public synchronized void deleteTask(GetTaskId taskId) { |
|
|
|
|
new Thread(() -> deleteFile(taskId.getSavePath())).start(); |
|
|
|
|
stopTask(taskId); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private synchronized void deleteFile(File file) { |
|
|
|
|
if (file.isDirectory()) for (File f : Path.list(file)) deleteFile(f); |
|
|
|
|
if (file.isFile() && !file.getAbsolutePath().endsWith(".torrent")) Path.clear(file); |
|
|
|
|
deleteFile(taskId.getSavePath()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public synchronized void stopTask(GetTaskId taskId) { |
|
|
|
|
|