Beispiel #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();
        }
		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();
		}
Beispiel #3
0
		public MainWindow (UserEngineSettings userEngineSettings, ListenPortController portController, bool isFirstRun): base (Gtk.WindowType.Toplevel)
		{
			prefSettings = new PreferencesSettings ();
			this.userEngineSettings = userEngineSettings;
			this.portController = portController;
			userTorrentSettings = new UserTorrentSettings ();
			interfaceSettings = new InterfaceSettings ();
			
			labels = new ArrayList ();
			torrents = new Dictionary<MonoTorrent.Client.TorrentManager,Gtk.TreeIter> ();
			
			selectLabelTreeView = new TreeView();
			
			Build ();
			BuildTray();
			BuildPiecesTreeView();
			BuildTorrentTreeView();
			BuildPeerTreeView();
			BuildFileTreeView();
			BuildLabelTreeView();
			BuildOptionsPage();
			
			
			torrentController.engine.StatsUpdate += OnUpdateStats;
			torrentController.engine.ConnectionManager.PeerConnected += OnPeerConnected;
			torrentController.engine.ConnectionManager.PeerDisconnected += OnPeerDisconnected;
			
			GLib.Timeout.Add (1000, new GLib.TimeoutHandler (updateView));
			
			RestoreInterface ();
			
			//portController = new ListenPortController(userEngineSettings);
			if (prefSettings.UpnpEnabled)
				portController.Start();
			
			torrentController.LoadStoredTorrents ();

			RestoreLabels ();
			
			folderWatcher = new TorrentFolderWatcher (new DirectoryInfo (prefSettings.ImportLocation));
			folderWatcher.TorrentFound += torrentController.OnTorrentFound;
			
			if (prefSettings.ImportEnabled) {
				logger.Info ("Starting import folder watcher");
				folderWatcher.StartWatching ();
			}
			
			rssManagerController = new RssManagerController(torrentController);
			rssManagerController.StartWatchers();
			
			if(isFirstRun)
				OpenDruid();
		}