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(); }
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 ListenPortController(UserEngineSettings engineSettings) { device = null; this.engineSettings = engineSettings; map = new Mapping(engineSettings.ListenPort, Protocol.Tcp); controller = new NatController(); controller.DeviceFound += OnDeviceFound; }
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; }
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(); }