Search in sources :

Example 11 with Core

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) {
        }
    }
}
Also used : PluginAdapter(com.biglybt.pif.PluginAdapter) PluginInterface(com.biglybt.pif.PluginInterface) Core(com.biglybt.core.Core)

Example 12 with Core

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;
            }
        }
    });
}
Also used : CoreLifecycleAdapter(com.biglybt.core.CoreLifecycleAdapter) Core(com.biglybt.core.Core)

Example 13 with Core

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();
}
Also used : PluginManagerDefaults(com.biglybt.pif.PluginManagerDefaults) File(java.io.File) Core(com.biglybt.core.Core)

Example 14 with Core

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();
                }
            });
        }
    });
}
Also used : NetworkAdminProgressListener(com.biglybt.core.networkmanager.admin.NetworkAdminProgressListener) CoreRunningListener(com.biglybt.core.CoreRunningListener) StyledText(org.eclipse.swt.custom.StyledText) StyledText(org.eclipse.swt.custom.StyledText) MessageText(com.biglybt.core.internat.MessageText) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) CoreRunningListener(com.biglybt.core.CoreRunningListener) Core(com.biglybt.core.Core)

Example 15 with Core

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") }));
}
Also used : IpFilter(com.biglybt.core.ipfilter.IpFilter) Core(com.biglybt.core.Core)

Aggregations

Core (com.biglybt.core.Core)71 CoreRunningListener (com.biglybt.core.CoreRunningListener)37 DownloadManager (com.biglybt.core.download.DownloadManager)17 CoreLifecycleAdapter (com.biglybt.core.CoreLifecycleAdapter)12 GlobalManager (com.biglybt.core.global.GlobalManager)10 File (java.io.File)9 GridLayout (org.eclipse.swt.layout.GridLayout)8 UIFunctions (com.biglybt.ui.UIFunctions)6 Composite (org.eclipse.swt.widgets.Composite)6 ParameterListener (com.biglybt.core.config.ParameterListener)5 LogAlert (com.biglybt.core.logging.LogAlert)5 TOTorrent (com.biglybt.core.torrent.TOTorrent)5 AERunnable (com.biglybt.core.util.AERunnable)5 GridData (org.eclipse.swt.layout.GridData)5 DownloadManagerInitialisationAdapter (com.biglybt.core.download.DownloadManagerInitialisationAdapter)4 PluginInterface (com.biglybt.pif.PluginInterface)4 TableColumnCore (com.biglybt.ui.common.table.TableColumnCore)4 ArrayList (java.util.ArrayList)4 SelectionEvent (org.eclipse.swt.events.SelectionEvent)4 MessageText (com.biglybt.core.internat.MessageText)3