use of com.biglybt.core.Core in project BiglyBT by BiglySoftware.
the class AENameServiceJava9 method checkI2PInstall.
private static void checkI2PInstall(final String host_name) {
synchronized (AENameServiceJava9.class) {
if (i2p_checked) {
return;
}
try {
Core core = CoreFactory.getSingleton();
if (core != null) {
i2p_checked = true;
PluginInterface pi = core.getPluginManager().getDefaultPluginInterface();
pi.addListener(new PluginAdapter() {
@Override
public void initializationComplete() {
if (I2PHelpers.isI2PInstalled()) {
return;
}
final boolean[] install_outcome = { false };
String enable_i2p_reason = MessageText.getString("azneti2phelper.install.reason.dns", new String[] { host_name });
I2PHelpers.installI2PHelper(enable_i2p_reason, "azneti2phelper.install.dns.resolve", install_outcome, new Runnable() {
@Override
public void run() {
if (!install_outcome[0]) {
}
}
});
}
});
}
} catch (Throwable e) {
}
}
}
use of com.biglybt.core.Core in project BiglyBT by BiglySoftware.
the class PlatformManagerImpl method startup.
@Override
public void startup(Core _core) throws PlatformManagerException {
synchronized (this) {
core = _core;
if (prevent_computer_sleep_pending) {
prevent_computer_sleep_pending = false;
setPreventComputerSleep(true);
}
}
core.addLifecycleListener(new CoreLifecycleAdapter() {
@Override
public void stopping(Core core) {
synchronized (PlatformManagerImpl.this) {
try {
setPreventComputerSleep(false);
} catch (Throwable e) {
}
core = null;
}
}
});
}
use of com.biglybt.core.Core in project BiglyBT by BiglySoftware.
the class Main method main.
public static void main(String[] args) {
System.setProperty("az.factory.internat.bundle", "com.biglybt.ui.none.internat.MessagesBundle");
COConfigurationManager.initialise();
if (System.getProperty(SystemProperties.SYSPROP_LOW_RESOURCE_MODE, "false").equals("true")) {
System.out.println("Low resource mode enabled");
COConfigurationManager.setParameter("Start In Low Resource Mode", true);
COConfigurationManager.setParameter("DHT.protocol.version.min", 51);
COConfigurationManager.setParameter(TransferSpeedValidator.AUTO_UPLOAD_ENABLED_CONFIGKEY, false);
COConfigurationManager.setParameter(TransferSpeedValidator.AUTO_UPLOAD_SEEDING_ENABLED_CONFIGKEY, false);
COConfigurationManager.setParameter("dht.net.cvs_v4.enable", false);
COConfigurationManager.setParameter("dht.net.main_v6.enable", false);
COConfigurationManager.setParameter("network.tcp.read.select.time", 500);
COConfigurationManager.setParameter("network.tcp.read.select.min.time", 500);
COConfigurationManager.setParameter("network.tcp.write.select.time", 500);
COConfigurationManager.setParameter("network.tcp.write.select.min.time", 500);
COConfigurationManager.setParameter("network.tcp.connect.select.time", 500);
COConfigurationManager.setParameter("network.tcp.connect.select.min.time", 500);
COConfigurationManager.setParameter("network.udp.poll.time", 100);
COConfigurationManager.setParameter("network.utp.poll.time", 100);
COConfigurationManager.setParameter("network.control.read.idle.time", 100);
COConfigurationManager.setParameter("network.control.write.idle.time", 100);
COConfigurationManager.setParameter("diskmanager.perf.cache.enable", true);
COConfigurationManager.setParameter("diskmanager.perf.cache.size", 4);
COConfigurationManager.setParameter("diskmanager.perf.cache.enable.read", false);
COConfigurationManager.setParameter("peermanager.schedule.time", 500);
PluginManagerDefaults defaults = PluginManager.getDefaults();
defaults.setDefaultPluginEnabled(PluginManagerDefaults.PID_BUDDY, false);
defaults.setDefaultPluginEnabled(PluginManagerDefaults.PID_SHARE_HOSTER, false);
defaults.setDefaultPluginEnabled(PluginManagerDefaults.PID_RSS, false);
defaults.setDefaultPluginEnabled(PluginManagerDefaults.PID_NET_STATUS, false);
}
String download_dir = System.getProperty(SystemProperties.SYSPROP_FOLDER_DOWNLOAD, "");
if (download_dir.length() > 0) {
File dir = new File(download_dir);
dir.mkdirs();
System.out.println("Download directory set to '" + dir + "'");
COConfigurationManager.setParameter("Default save path", dir.getAbsolutePath());
}
String torrent_dir = System.getProperty(SystemProperties.SYSPROP_FOLDER_TORRENT, "");
if (torrent_dir.length() > 0) {
File dir = new File(torrent_dir);
dir.mkdirs();
System.out.println("Torrent directory set to '" + dir + "'");
COConfigurationManager.setParameter("Save Torrent Files", true);
COConfigurationManager.setParameter("General_sDefaultTorrent_Directory", dir.getAbsolutePath());
}
Core core = CoreFactory.create();
core.start();
}
use of com.biglybt.core.Core in project BiglyBT by BiglySoftware.
the class NatPanel method show.
@Override
public void show() {
wizard.setTitle(MessageText.getString("configureWizard.nat.title"));
// wizard.setCurrentInfo(MessageText.getString("configureWizard.nat.hint"));
Composite rootPanel = wizard.getPanel();
GridLayout layout = new GridLayout();
layout.numColumns = 1;
rootPanel.setLayout(layout);
Composite panel = new Composite(rootPanel, SWT.NULL);
GridData gridData = new GridData(GridData.FILL_BOTH);
Utils.setLayoutData(panel, gridData);
layout = new GridLayout();
layout.numColumns = 4;
panel.setLayout(layout);
Label label = new Label(panel, SWT.WRAP);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 4;
Utils.setLayoutData(label, gridData);
Messages.setLanguageText(label, "configureWizard.nat.message");
label = new Label(panel, SWT.NULL);
gridData = new GridData();
gridData.horizontalSpan = 4;
Utils.setLayoutData(label, gridData);
// TCP
label = new Label(panel, SWT.NULL);
gridData = new GridData();
Utils.setLayoutData(label, gridData);
Messages.setLanguageText(label, "configureWizard.nat.server.tcp_listen_port");
final Text textServerTCPListen = new Text(panel, SWT.BORDER);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.widthHint = 80;
Utils.setLayoutData(textServerTCPListen, gridData);
textServerTCPListen.setText("" + ((ConfigureWizard) wizard).serverTCPListenPort);
textServerTCPListen.addListener(SWT.Verify, new Listener() {
@Override
public void handleEvent(Event e) {
String text = e.text;
char[] chars = new char[text.length()];
text.getChars(0, chars.length, chars, 0);
for (int i = 0; i < chars.length; i++) {
if (!('0' <= chars[i] && chars[i] <= '9')) {
e.doit = false;
return;
}
}
}
});
textServerTCPListen.addListener(SWT.Modify, new Listener() {
@Override
public void handleEvent(Event e) {
try {
final int TCPListenPort = Integer.parseInt(textServerTCPListen.getText());
((ConfigureWizard) wizard).serverTCPListenPort = TCPListenPort;
} catch (NumberFormatException ex) {
// ignore
}
}
});
bTestTCP = new Button(panel, SWT.PUSH);
Messages.setLanguageText(bTestTCP, "configureWizard.nat.test");
gridData = new GridData();
gridData.widthHint = 70;
Utils.setLayoutData(bTestTCP, gridData);
label = new Label(panel, SWT.NULL);
// UDP
label = new Label(panel, SWT.NULL);
gridData = new GridData();
Utils.setLayoutData(label, gridData);
Messages.setLanguageText(label, "configureWizard.nat.server.udp_listen_port");
final Text textServerUDPListen = new Text(panel, SWT.BORDER);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.widthHint = 80;
Utils.setLayoutData(textServerUDPListen, gridData);
textServerUDPListen.setText("" + ((ConfigureWizard) wizard).serverUDPListenPort);
textServerUDPListen.addListener(SWT.Verify, new Listener() {
@Override
public void handleEvent(Event e) {
String text = e.text;
char[] chars = new char[text.length()];
text.getChars(0, chars.length, chars, 0);
for (int i = 0; i < chars.length; i++) {
if (!('0' <= chars[i] && chars[i] <= '9')) {
e.doit = false;
return;
}
}
}
});
textServerUDPListen.addListener(SWT.Modify, new Listener() {
@Override
public void handleEvent(Event e) {
try {
final int UDPListenPort = Integer.parseInt(textServerUDPListen.getText());
((ConfigureWizard) wizard).serverUDPListenPort = UDPListenPort;
} catch (NumberFormatException ex) {
// ignore
}
}
});
bTestUDP = new Button(panel, SWT.PUSH);
Messages.setLanguageText(bTestUDP, "configureWizard.nat.test");
gridData = new GridData();
gridData.widthHint = 70;
Utils.setLayoutData(bTestUDP, gridData);
label = new Label(panel, SWT.NULL);
// blah
textResults = new StyledText(panel, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
gridData = new GridData(GridData.FILL_BOTH);
gridData.heightHint = 70;
gridData.horizontalSpan = 4;
Utils.setLayoutData(textResults, gridData);
textResults.setBackground(Colors.getSystemColor(panel.getDisplay(), SWT.COLOR_WHITE));
bTestTCP.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
wizard.setNextEnabled(false);
bTestTCP.setEnabled(false);
bTestUDP.setEnabled(false);
textResults.setText("");
CoreWaiterSWT.waitForCoreRunning(new CoreRunningListener() {
@Override
public void coreRunning(Core core) {
ConfigureWizard cw = (ConfigureWizard) wizard;
int TCPListenPort = cw.serverTCPListenPort;
CheckerTCP checker = new CheckerTCP(core, TCPListenPort);
checker.start();
}
});
}
});
bTestUDP.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
wizard.setNextEnabled(false);
bTestTCP.setEnabled(false);
bTestUDP.setEnabled(false);
textResults.setText("");
CoreWaiterSWT.waitForCoreRunning(new CoreRunningListener() {
@Override
public void coreRunning(Core core) {
ConfigureWizard cw = (ConfigureWizard) wizard;
int UDPListenPort = cw.serverUDPListenPort;
CheckerUDP checker = new CheckerUDP(core, UDPListenPort);
checker.start();
}
});
}
});
}
use of com.biglybt.core.Core in project BiglyBT by BiglySoftware.
the class MainStatusBar method updateIPBlocked.
/**
* @since 3.1.1.1
*/
private void updateIPBlocked() {
if (!CoreFactory.isCoreRunning()) {
return;
}
Core core = CoreFactory.getSingleton();
// IP Filter Status Section
IpFilter ip_filter = core.getIpFilterManager().getIPFilter();
ipBlocked.setForeground(display.getSystemColor(ip_filter.isEnabled() ? SWT.COLOR_WIDGET_FOREGROUND : SWT.COLOR_WIDGET_NORMAL_SHADOW));
ipBlocked.setText("IPs: " + numberFormat.format(ip_filter.getNbRanges()) + " - " + numberFormat.format(ip_filter.getNbIpsBlockedAndLoggable()) + "/" + numberFormat.format(ip_filter.getNbBannedIps()) + "/" + numberFormat.format(core.getIpFilterManager().getBadIps().getNbBadIps()));
ipBlocked.setToolTipText(MessageText.getString("MainWindow.IPs.tooltip", new String[] { ip_filter.isEnabled() ? DisplayFormatters.formatDateShort(ip_filter.getLastUpdateTime()) : MessageText.getString("ipfilter.disabled") }));
}
Aggregations