コード例 #1
0
        public TorrentController(MainWindow mainWindow)
        {
            this.userTorrentSettings = mainWindow.userTorrentSettings;
            this.userEngineSettings  = mainWindow.userEngineSettings;
            this.prefSettings        = mainWindow.prefSettings;
            this.labels                  = mainWindow.labels;
            this.torrentListStore        = mainWindow.torrentListStore;
            this.torrents                = mainWindow.torrents;
            this.mainWindow              = mainWindow;
            this.pieces                  = mainWindow.pieces;
            this.torrentPreviousUpload   = new Dictionary <MonoTorrent.Client.TorrentManager, long>();
            this.torrentPreviousDownload = new Dictionary <MonoTorrent.Client.TorrentManager, long>();

            engineSettings  = new EngineSettings(userEngineSettings.SavePath, userEngineSettings.ListenPort, userEngineSettings.GlobalMaxConnections, userEngineSettings.GlobalMaxHalfOpenConnections, userEngineSettings.GlobalMaxDownloadSpeed, userEngineSettings.GlobalMaxUploadSpeed, EngineSettings.DefaultSettings().MinEncryptionLevel, userEngineSettings.AllowLegacyConnections);
            torrentSettings = new TorrentSettings(userTorrentSettings.UploadSlots, userTorrentSettings.MaxConnections, userTorrentSettings.MaxDownloadSpeed, userTorrentSettings.MaxUploadSpeed, userTorrentSettings.FastResumeEnabled);

            engine = new ClientEngine(engineSettings);

            engine.ConnectionManager.PeerMessageTransferred += OnPeerMessageTransferred;

            hashProgress        = new Dictionary <MonoTorrent.Client.TorrentManager, int>();
            torrentSwarm        = new Dictionary <MonoTorrent.Client.TorrentManager, int>();
            torrentsDownloading = new ArrayList();
            torrentsSeeding     = new ArrayList();
            allTorrents         = new ArrayList();
        }
コード例 #2
0
ファイル: Main.cs プロジェクト: samiudheen/mono-soc-2007
        public MainClass(string [] args)
        {
            isFirstRun = false;
            CheckDataFolders();
            BuildNlogConfig();
            logger.Info("Starting MonoTorrent");

            SetProcessName("monotorrent");

            userEngineSettings = new UserEngineSettings();
            portController     = new ListenPortController(userEngineSettings);

            Application.Init();
            Console.Out.WriteLine("IS FIRST RUN?!?! " + isFirstRun);
            mainWindow = new MainWindow(userEngineSettings, portController, isFirstRun);

            // This is so we can use IconEntry button
            // Use Gnome.Program instead of Gtk.Application?
            //Gnome.Program program =
            new Gnome.Program("monotorrent", "0.1", Gnome.Modules.UI, args);

            try{
                Application.Run();
            } catch (Exception e) {
                Console.Out.WriteLine(e.ToString());
                Application.Init();
                UnhandledExceptionDialog exDialog = new UnhandledExceptionDialog(e);
                exDialog.Run();
                mainWindow.Stop();
                exDialog.Destroy();
            }
            portController.Stop();
        }
コード例 #3
0
        public ListenPortController(UserEngineSettings engineSettings)
        {
            device = null;
            this.engineSettings = engineSettings;
            map        = new Mapping(engineSettings.ListenPort, Protocol.Tcp);
            controller = new NatController();

            controller.DeviceFound += OnDeviceFound;
        }
コード例 #4
0
        public PreferencesDialog(MainWindow mainWindow)
        {
            //	this.userTorrentSettings = mainWindow.userTorrentSettings;
            this.userEngineSettings = mainWindow.userEngineSettings;
            this.prefSettings       = mainWindow.prefSettings;
            this.labels             = mainWindow.labels;
            this.filterListStore    = mainWindow.labelListStore;
            this.trayIcon           = mainWindow.TrayIcon;
            this.mainWindow         = mainWindow;

            Build();
            buildFoldersPanel();
            buildImportPanel();
            buildLabelPage();
            buildConnectionPage();
            restorePreferences();
            BuildGeneralPage();

            upnpCheckBox.Toggled += OnUpnpCheckBoxToggled;
        }