📄 updaterutils.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: UpdaterUtils.java
package org.gudy.azureus2.update;
import com.aelitis.azureus.core.AzureusCore;
import com.aelitis.azureus.core.AzureusCoreFactory;
import java.io.*;
import org.gudy.azureus2.core3.logging.LogAlert;
import org.gudy.azureus2.core3.logging.Logger;
import org.gudy.azureus2.core3.util.Debug;
import org.gudy.azureus2.core3.util.FileUtil;
import org.gudy.azureus2.plugins.PluginInterface;
import org.gudy.azureus2.plugins.PluginManager;
public class UpdaterUtils
{
public static String AZUPDATER_PLUGIN_ID = "azupdater";
public static String AZUPDATERPATCHER_PLUGIN_ID = "azupdaterpatcher";
protected static String AZUPNPAV_PLUGIN_ID = "azupnpav";
public UpdaterUtils()
{
}
public static boolean disableNativeCode(String version)
{
File plugin_dir;
plugin_dir = null;
File shared_plugin_dir = FileUtil.getApplicationFile("plugins");
File shared_updater_plugin = new File(shared_plugin_dir, AZUPDATER_PLUGIN_ID);
if (shared_updater_plugin.exists())
plugin_dir = shared_updater_plugin;
if (plugin_dir == null)
return false;
return (new File(plugin_dir, (new StringBuilder()).append("disnat").append(version).toString())).exists();
Throwable e;
e;
e.printStackTrace();
return false;
}
public static void checkBootstrapPlugins()
{
try
{
File target_props = getPropsIfNotPresent(AZUPDATER_PLUGIN_ID, true);
if (target_props != null)
writePluginProperties(target_props, new String[] {
"plugin.class=org.gudy.azureus2.update.UpdaterUpdateChecker;org.gudy.azureus2.update.UpdaterPatcher", "plugin.name=Azureus Update Support;Azureus Updater Support Patcher"
});
target_props = getPropsIfNotPresent(AZUPNPAV_PLUGIN_ID, false);
if (target_props != null)
writePluginProperties(target_props, new String[] {
"plugin.class=com.aelitis.azureus.plugins.upnpmediaserver.UPnPMediaServer", "plugin.name=UPnP Media Server", "plugin.id=azupnpav"
});
}
catch (Throwable e)
{
Debug.printStackTrace(e);
}
}
public static boolean ensurePluginPresent(String id, String cla, String name)
{
File target_props = getPropsIfNotPresent(id, false);
if (target_props != null)
{
writePluginProperties(target_props, new String[] {
(new StringBuilder()).append("plugin.class=").append(cla).toString(), (new StringBuilder()).append("plugin.name=").append(name).toString(), (new StringBuilder()).append("plugin.id=").append(id).toString()
});
return true;
} else
{
return false;
}
}
protected static void writePluginProperties(File target, String lines[])
{
PrintWriter pw = null;
pw = new PrintWriter(new FileWriter(target));
for (int i = 0; i < lines.length; i++)
pw.println(lines[i]);
pw.println("plugin.install_if_missing=yes");
if (pw != null)
pw.close();
break MISSING_BLOCK_LABEL_69;
Exception exception;
exception;
if (pw != null)
pw.close();
throw exception;
if (!target.exists())
throw new Exception((new StringBuilder()).append("Failed to write '").append(target.toString()).append("'").toString());
break MISSING_BLOCK_LABEL_146;
Throwable e;
e;
Logger.log(new LogAlert(false, (new StringBuilder()).append("Plugin bootstrap: initialisation error for ").append(target).toString(), e));
}
protected static File getPropsIfNotPresent(String id, boolean use_shared)
{
File user_plugin_dir = FileUtil.getUserFile("plugins");
File user_plugin = new File(user_plugin_dir, id);
File user_props = new File(user_plugin, "plugin.properties");
if (user_props.exists())
return null;
File shared_plugin_dir = FileUtil.getApplicationFile("plugins");
File shared_plugin = new File(shared_plugin_dir, id);
File shared_props = new File(shared_plugin, "plugin.properties");
if (shared_props.exists())
return null;
if (use_shared)
{
FileUtil.mkdirs(shared_plugin);
return shared_props;
} else
{
FileUtil.mkdirs(user_plugin);
return user_props;
}
}
public static String getUpdaterPluginVersion()
{
String version;
PluginInterface pi = AzureusCoreFactory.getSingleton().getPluginManager().getPluginInterfaceByID(AZUPDATER_PLUGIN_ID, false);
if (pi == null)
break MISSING_BLOCK_LABEL_37;
version = pi.getPluginVersion();
if (version != null)
return version;
break MISSING_BLOCK_LABEL_37;
Throwable t;
t;
return "0";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -