use of com.biglybt.ui.console.multiuser.commands.UserCommand in project BiglyBT by BiglySoftware.
the class UI method startUI.
private void startUI() {
boolean created_console = false;
if (console == null || !console.isAlive()) {
// ConsoleInput.printconsolehelp(System.out);
System.out.println();
PrintStream this_out = System.out;
// Unless a system property tells us not to, we'll take stdout and stderr offline.
if (!"on".equals(System.getProperty(SystemProperties.SYSPROP_CONSOLE_NOISY)) && isFirst()) {
// We'll hide any output to stdout or stderr - we don't want to litter our
// view.
PrintStream ps = new PrintStream(new java.io.OutputStream() {
@Override
public void write(int c) {
}
@Override
public void write(byte[] b, int i1, int i2) {
}
});
System.setOut(ps);
System.setErr(ps);
com.biglybt.core.logging.Logger.allowLoggingToStdErr(false);
}
console = new ConsoleInput("Main", core, System.in, this_out, Boolean.TRUE);
console.printwelcome();
console.printconsolehelp();
created_console = true;
}
PluginInterface pi = core.getPluginManager().getDefaultPluginInterface();
UIManager ui_manager = pi.getUIManager();
ui_manager.addUIEventListener(this);
try {
ui_manager.attachUI(this);
} catch (UIException e) {
e.printStackTrace();
}
TorrentDownloaderFactory.initManager(core.getGlobalManager(), true, true, COConfigurationManager.getStringParameter("Default save path"));
if (created_console && System.getProperty(SystemProperties.SYSPROP_CONSOLE_MULTIUSER) != null) {
UserManager manager = UserManager.getInstance(pi);
console.registerCommand(new UserCommand(manager));
}
}
use of com.biglybt.ui.console.multiuser.commands.UserCommand in project BiglyBT by BiglySoftware.
the class UI method createNewConsoleInput.
/**
* creates a new console input using the specified input/output streams.
* we create the new input in non-controlling mode because we don't want the 'quit'
* command to shut down the whole interface - simply this clients connection.
* @param consoleName
* @param inputStream
* @param outputStream
* @param profile
*/
public void createNewConsoleInput(String consoleName, InputStream inputStream, PrintStream outputStream, UserProfile profile) {
ConsoleInput console;
if (userManager != null) {
MultiUserConsoleInput muc = new MultiUserConsoleInput(consoleName, core, new InputStreamReader(inputStream), outputStream, Boolean.FALSE, profile);
muc.registerCommand(new UserCommand(userManager));
console = muc;
} else {
console = new ConsoleInput(consoleName, core, new InputStreamReader(inputStream), outputStream, Boolean.FALSE, profile);
System.out.println("TelnetUI: console input instantiated");
}
console.printwelcome();
console.printconsolehelp();
}
Aggregations