Search in sources :

Example 71 with LogAlert

use of com.biglybt.core.logging.LogAlert in project BiglyBT by BiglySoftware.

the class TorrentUtil method moveTorrentFile.

protected static void moveTorrentFile(Shell shell, DownloadManager[] dms) {
    if (dms != null && dms.length > 0) {
        DirectoryDialog dd = new DirectoryDialog(shell);
        String filter_path = TorrentOpener.getFilterPathTorrent();
        // torrent.
        if (filter_path == null || filter_path.trim().length() == 0) {
            filter_path = new File(dms[0].getTorrentFileName()).getParent();
        }
        dd.setFilterPath(filter_path);
        dd.setText(MessageText.getString("MyTorrentsView.menu.movedata.dialog"));
        String path = dd.open();
        if (path != null) {
            File target = new File(path);
            TorrentOpener.setFilterPathTorrent(target.toString());
            for (int i = 0; i < dms.length; i++) {
                try {
                    dms[i].moveTorrentFile(target);
                } catch (Throwable e) {
                    Logger.log(new LogAlert(dms[i], LogAlert.REPEATABLE, "Download torrent move operation failed", e));
                }
            }
        }
    }
}
Also used : File(java.io.File) LogAlert(com.biglybt.core.logging.LogAlert)

Example 72 with LogAlert

use of com.biglybt.core.logging.LogAlert in project BiglyBT by BiglySoftware.

the class TorrentUtil method moveDataFiles.

protected static void moveDataFiles(Shell shell, DownloadManager[] dms) {
    if (dms != null && dms.length > 0) {
        DirectoryDialog dd = new DirectoryDialog(shell);
        String filter_path = TorrentOpener.getFilterPathData();
        // torrent.
        if (filter_path == null || filter_path.trim().length() == 0) {
            filter_path = new File(dms[0].getTorrentFileName()).getParent();
        }
        dd.setFilterPath(filter_path);
        dd.setText(MessageText.getString("MyTorrentsView.menu.movedata.dialog"));
        String path = dd.open();
        if (path != null) {
            TorrentOpener.setFilterPathData(path);
            File target = new File(path);
            for (int i = 0; i < dms.length; i++) {
                try {
                    dms[i].moveDataFilesLive(target);
                } catch (Throwable e) {
                    Logger.log(new LogAlert(dms[i], LogAlert.REPEATABLE, "Download data move operation failed", e));
                }
            }
        }
    }
}
Also used : File(java.io.File) LogAlert(com.biglybt.core.logging.LogAlert)

Aggregations

LogAlert (com.biglybt.core.logging.LogAlert)72 File (java.io.File)21 LogEvent (com.biglybt.core.logging.LogEvent)20 URL (java.net.URL)7 Core (com.biglybt.core.Core)5 ParameterListener (com.biglybt.core.config.ParameterListener)5 DownloadManager (com.biglybt.core.download.DownloadManager)5 TOTorrent (com.biglybt.core.torrent.TOTorrent)5 UIFunctions (com.biglybt.ui.UIFunctions)5 IOException (java.io.IOException)5 ArrayList (java.util.ArrayList)5 VuzeFile (com.biglybt.core.vuzefile.VuzeFile)4 PlatformManagerException (com.biglybt.pif.platform.PlatformManagerException)4 Method (java.lang.reflect.Method)4 CoreRunningListener (com.biglybt.core.CoreRunningListener)3 TOTorrentException (com.biglybt.core.torrent.TOTorrentException)3 URLClassLoader (java.net.URLClassLoader)3 CoreException (com.biglybt.core.CoreException)2 CacheFile (com.biglybt.core.diskmanager.cache.CacheFile)2 DownloadManagerInitialisationAdapter (com.biglybt.core.download.DownloadManagerInitialisationAdapter)2