📄 downloadmanagermovehandler.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: DownloadManagerMoveHandler.java
package org.gudy.azureus2.core3.download.impl;
import java.io.File;
import java.util.ArrayList;
import org.gudy.azureus2.core3.config.COConfigurationManager;
import org.gudy.azureus2.core3.download.DownloadManager;
import org.gudy.azureus2.core3.download.DownloadManagerState;
import org.gudy.azureus2.plugins.download.savelocation.*;
import org.gudy.azureus2.pluginsimpl.local.PluginCoreUtils;
// Referenced classes of package org.gudy.azureus2.core3.download.impl:
// DownloadManagerMoveHandlerUtils, DownloadManagerDefaultPaths
public class DownloadManagerMoveHandler extends DownloadManagerMoveHandlerUtils
{
public static SaveLocationManager CURRENT_HANDLER;
public DownloadManagerMoveHandler()
{
}
private static boolean isApplicableDownload(DownloadManager dm)
{
if (!dm.isPersistent())
{
logInfo((new StringBuilder()).append(describe(dm)).append(" is not persistent.").toString(), dm);
return false;
}
if (dm.getDownloadState().getFlag(4L))
{
logInfo((new StringBuilder()).append(describe(dm)).append(" has exclusion flag set.").toString(), dm);
return false;
} else
{
return true;
}
}
public static SaveLocationChange onInitialisation(DownloadManager dm)
{
if (!isApplicableDownload(dm))
return null;
return CURRENT_HANDLER.onInitialization(PluginCoreUtils.wrap(dm), true, true);
Exception e;
e;
logError("Error trying to determine initial download location.", dm, e);
return null;
}
public static SaveLocationChange onRemoval(DownloadManager dm)
{
if (!isApplicableDownload(dm))
return null;
return CURRENT_HANDLER.onRemoval(PluginCoreUtils.wrap(dm), true, true);
Exception e;
e;
logError("Error trying to determine on-removal location.", dm, e);
return null;
}
public static SaveLocationChange onCompletion(DownloadManager dm)
{
if (!isApplicableDownload(dm))
return null;
if (dm.getDownloadState().getFlag(8L))
{
logInfo((new StringBuilder()).append("Completion flag already set on ").append(describe(dm)).append(", skip move-on-completion behaviour.").toString(), dm);
return null;
}
SaveLocationChange sc;
try
{
sc = CURRENT_HANDLER.onCompletion(PluginCoreUtils.wrap(dm), true, true);
}
catch (Exception e)
{
logError("Error trying to determine on-completion location.", dm, e);
return null;
}
logInfo((new StringBuilder()).append("Setting completion flag on ").append(describe(dm)).append(", may have been set before.").toString(), dm);
dm.getDownloadState().setFlag(8L, true);
return sc;
}
public static boolean canGoToCompleteDir(DownloadManager dm)
{
return dm.isDownloadComplete(false) && isOnCompleteEnabled();
}
public static boolean isOnCompleteEnabled()
{
return COConfigurationManager.getBooleanParameter("Move Completed When Done");
}
public static boolean isOnRemovalEnabled()
{
return COConfigurationManager.getBooleanParameter("File.move.download.removed.enabled");
}
public static SaveLocationChange recalculatePath(DownloadManager dm)
{
org.gudy.azureus2.plugins.download.Download download = PluginCoreUtils.wrap(dm);
SaveLocationChange result = null;
if (canGoToCompleteDir(dm))
result = CURRENT_HANDLER.onCompletion(download, true, false);
if (result == null)
result = CURRENT_HANDLER.onInitialization(download, true, false);
return result;
}
public static File[] getRelatedDirs(DownloadManager dm)
{
ArrayList result = new ArrayList();
org.gudy.azureus2.plugins.download.Download d = PluginCoreUtils.wrap(dm);
if (isOnCompleteEnabled())
{
addFile(result, COConfigurationManager.getStringParameter("Completed Files Directory"));
addFile(result, CURRENT_HANDLER.onCompletion(d, false, false));
addFile(result, DownloadManagerDefaultPaths.DEFAULT_HANDLER.onCompletion(d, false, false));
}
if (isOnRemovalEnabled())
{
addFile(result, COConfigurationManager.getStringParameter("File.move.download.removed.path"));
addFile(result, CURRENT_HANDLER.onRemoval(d, false, false));
addFile(result, DownloadManagerDefaultPaths.DEFAULT_HANDLER.onRemoval(d, false, false));
}
return (File[])(File[])result.toArray(new File[result.size()]);
}
private static void addFile(ArrayList l, SaveLocationChange slc)
{
if (slc != null)
addFile(l, slc.download_location);
}
private static void addFile(ArrayList l, File f)
{
if (f != null && !l.contains(f))
l.add(f);
}
private static void addFile(ArrayList l, String s)
{
if (s != null && s.trim().length() != 0)
addFile(l, new File(s));
}
static
{
CURRENT_HANDLER = DownloadManagerDefaultPaths.DEFAULT_HANDLER;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -