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 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 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; }