📄 ui.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: UI.java
package org.gudy.azureus2.ui.telnet;
import com.aelitis.azureus.core.AzureusCore;
import java.io.*;
import java.util.*;
import org.apache.log4j.Logger;
import org.gudy.azureus2.core3.config.COConfigurationManager;
import org.gudy.azureus2.core3.global.GlobalManager;
import org.gudy.azureus2.core3.torrentdownloader.TorrentDownloaderFactory;
import org.gudy.azureus2.core3.util.TorrentUtils;
import org.gudy.azureus2.plugins.PluginManager;
import org.gudy.azureus2.ui.common.*;
import org.gudy.azureus2.ui.console.ConsoleInput;
import org.gudy.azureus2.ui.console.UserProfile;
import org.gudy.azureus2.ui.console.multiuser.MultiUserConsoleInput;
import org.gudy.azureus2.ui.console.multiuser.UserManager;
import org.gudy.azureus2.ui.console.multiuser.commands.UserCommand;
// Referenced classes of package org.gudy.azureus2.ui.telnet:
// SocketServer
public class UI extends UITemplateHeadless
implements IUserInterface
{
private UserManager userManager;
public UI()
{
}
public String[] processArgs(String args[])
{
return args;
}
public void startUI()
{
if (!isStarted())
try
{
int telnetPort = COConfigurationManager.getIntParameter("Telnet_iPort", 57006);
String allowedHostsStr = COConfigurationManager.getStringParameter("Telnet_sAllowedHosts", "127.0.0.1,titan");
StringTokenizer st = new StringTokenizer(allowedHostsStr, ",");
Set allowedHosts = new HashSet();
for (; st.hasMoreTokens(); allowedHosts.add(st.nextToken().toLowerCase()));
int maxLoginAttempts = COConfigurationManager.getIntParameter("Telnet_iMaxLoginAttempts", 3);
userManager = initUserManager();
Thread thread = new Thread(new SocketServer(this, telnetPort, allowedHosts, userManager, maxLoginAttempts), "Telnet Socket Server Thread");
thread.setDaemon(true);
thread.start();
}
catch (IOException e)
{
e.printStackTrace();
}
super.startUI();
}
private UserManager initUserManager()
{
if (System.getProperty("azureus.console.multiuser") != null)
return UserManager.getInstance(UIConst.getAzureusCore().getPluginManager().getDefaultPluginInterface());
else
return null;
}
public void openTorrent(String fileName)
{
if (fileName.toUpperCase().startsWith("HTTP://"))
{
System.out.println((new StringBuilder()).append("Downloading torrent from url: ").append(fileName).toString());
TorrentDownloaderFactory.downloadManaged(fileName);
return;
}
try
{
if (!TorrentUtils.isTorrentFile(fileName))
{
Logger.getLogger("azureus2.ui.telnet").error((new StringBuilder()).append(fileName).append(" doesn't seem to be a torrent file. Not added.").toString());
return;
}
}
catch (Exception e)
{
Logger.getLogger("azureus2.ui.telnet").error((new StringBuilder()).append("Something is wrong with ").append(fileName).append(". Not added. (Reason: ").append(e.getMessage()).append(")").toString());
return;
}
if (UIConst.getGlobalManager() != null)
try
{
UIConst.getGlobalManager().addDownloadManager(fileName, COConfigurationManager.getDirectoryParameter("Default save path"));
}
catch (Exception e)
{
Logger.getLogger("azureus2.ui.telnet").error((new StringBuilder()).append("The torrent ").append(fileName).append(" could not be added.").toString(), e);
}
}
public void createNewConsoleInput(String consoleName, InputStream inputStream, PrintStream outputStream, UserProfile profile)
{
ConsoleInput console;
if (userManager != null)
{
MultiUserConsoleInput muc = new MultiUserConsoleInput(consoleName, UIConst.getAzureusCore(), new InputStreamReader(inputStream), outputStream, Boolean.FALSE, profile);
muc.registerCommand(new UserCommand(userManager));
console = muc;
} else
{
console = new ConsoleInput(consoleName, UIConst.getAzureusCore(), new InputStreamReader(inputStream), outputStream, Boolean.FALSE, profile);
System.out.println("TelnetUI: console input instantiated");
}
console.printwelcome();
console.printconsolehelp();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -