public void Restore()
		{
			GconfSettingsStorage gconf = new GconfSettingsStorage();
			
			try {
				enableNotifications = (bool) gconf.Retrieve(SETTINGS_PATH + "enableNotifications");
			} catch (SettingNotFoundException) {
				enableNotifications = true;
			}
			
			try {
				quitOnClose = (bool) gconf.Retrieve(SETTINGS_PATH + "quitOnClose");
			} catch (SettingNotFoundException) {
				quitOnClose = false;
			}
			
			try {
				enableTray = (bool) gconf.Retrieve(SETTINGS_PATH + "enableTray");
			} catch (SettingNotFoundException) {
				enableTray = true;
			}
			
			try {
				torrentStorageLocation = (string) gconf.Retrieve(SETTINGS_PATH + "torrentStorageLocation");
			} catch(SettingNotFoundException) {
				torrentStorageLocation = Path.Combine(Path.Combine(Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData),"monotorrent"), "torrents");
			}
			
			try {
				importLocation = (string) gconf.Retrieve(SETTINGS_PATH + "importLocation");
			} catch (SettingNotFoundException) {
			
				importLocation = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
			}
			
			try {	
				upnpEnabled = (bool) gconf.Retrieve(SETTINGS_PATH + "upnpEnabled");
			} catch (SettingNotFoundException) {
				upnpEnabled = false;
			}
			
			try {
				startNewTorrents = (bool) gconf.Retrieve(SETTINGS_PATH + "startNewTorrents");
			} catch (SettingNotFoundException) {
				startNewTorrents = true;
			}
			
			try {
				importEnabled = (bool) gconf.Retrieve(SETTINGS_PATH + "importEnabled");
			} catch (SettingNotFoundException) {
				importEnabled = false;
			}
			
			try {
				removeOnImport = (bool) gconf.Retrieve(SETTINGS_PATH + "removeOnImport");
			} catch (SettingNotFoundException) {
				removeOnImport = false;
			}
				
		}
		public void Restore()
		{
			GconfSettingsStorage gconf = new GconfSettingsStorage();
			
			try {
				uploadSlots = (int) gconf.Retrieve(SETTINGS_PATH + "UploadSlots");
			} catch(SettingNotFoundException) {
				uploadSlots = TorrentSettings.DefaultSettings().UploadSlots;
			}
			
			try {
				maxConnections = (int) gconf.Retrieve(SETTINGS_PATH + "MaxConnections");
			} catch(SettingNotFoundException) {
				maxConnections = TorrentSettings.DefaultSettings().MaxConnections;
			}
			
			try{
				maxDownloadSpeed = (int) gconf.Retrieve(SETTINGS_PATH + "MaxDownloadSpeed");
			} catch(SettingNotFoundException){
				maxDownloadSpeed = TorrentSettings.DefaultSettings().MaxDownloadSpeed;
			}
			
			try {
				maxUploadSpeed = (int) gconf.Retrieve(SETTINGS_PATH + "MaxUploadSpeed");
			} catch(SettingNotFoundException){
				maxUploadSpeed = TorrentSettings.DefaultSettings().MaxUploadSpeed;
			}
			
			try{
				fastResumeEnabled = (bool) gconf.Retrieve(SETTINGS_PATH + "FastResumeEnabled");
			} catch(SettingNotFoundException){
				fastResumeEnabled = TorrentSettings.DefaultSettings().FastResumeEnabled;
			}
			
		}
Пример #3
0
        public void Restore()
        {
            GconfSettingsStorage gconf = new GconfSettingsStorage();

            try {
                enableNotifications = (bool)gconf.Retrieve(SETTINGS_PATH + "enableNotifications");
            } catch (SettingNotFoundException) {
                enableNotifications = true;
            }

            try {
                quitOnClose = (bool)gconf.Retrieve(SETTINGS_PATH + "quitOnClose");
            } catch (SettingNotFoundException) {
                quitOnClose = false;
            }

            try {
                enableTray = (bool)gconf.Retrieve(SETTINGS_PATH + "enableTray");
            } catch (SettingNotFoundException) {
                enableTray = true;
            }

            try {
                torrentStorageLocation = (string)gconf.Retrieve(SETTINGS_PATH + "torrentStorageLocation");
            } catch (SettingNotFoundException) {
                torrentStorageLocation = Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "monotorrent"), "torrents");
            }

            try {
                importLocation = (string)gconf.Retrieve(SETTINGS_PATH + "importLocation");
            } catch (SettingNotFoundException) {
                importLocation = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            }

            try {
                upnpEnabled = (bool)gconf.Retrieve(SETTINGS_PATH + "upnpEnabled");
            } catch (SettingNotFoundException) {
                upnpEnabled = false;
            }

            try {
                startNewTorrents = (bool)gconf.Retrieve(SETTINGS_PATH + "startNewTorrents");
            } catch (SettingNotFoundException) {
                startNewTorrents = true;
            }

            try {
                importEnabled = (bool)gconf.Retrieve(SETTINGS_PATH + "importEnabled");
            } catch (SettingNotFoundException) {
                importEnabled = false;
            }

            try {
                removeOnImport = (bool)gconf.Retrieve(SETTINGS_PATH + "removeOnImport");
            } catch (SettingNotFoundException) {
                removeOnImport = false;
            }
        }
        public void Restore()
        {
            GconfSettingsStorage gconf = new GconfSettingsStorage();

            try{
                allowLegacyConnections = (bool)gconf.Retrieve(SETTINGS_PATH + "AllowLegacyConnections");
            } catch (SettingNotFoundException) {
                allowLegacyConnections = EngineSettings.DefaultSettings().AllowLegacyConnections;
            }

            try{
                globalMaxConnections = (int)gconf.Retrieve(SETTINGS_PATH + "GlobalMaxConnections");
            } catch (SettingNotFoundException) {
                globalMaxConnections = EngineSettings.DefaultSettings().GlobalMaxConnections;
            }

            try{
                globalMaxDownloadSpeed = (int)gconf.Retrieve(SETTINGS_PATH + "GlobalMaxDownloadSpeed");
            } catch (SettingNotFoundException) {
                globalMaxDownloadSpeed = EngineSettings.DefaultSettings().GlobalMaxDownloadSpeed;
            }

            try{
                globalMaxHalfOpenConnections = (int)gconf.Retrieve(SETTINGS_PATH + "GlobalMaxHalfOpenConnections");
            } catch (SettingNotFoundException) {
                globalMaxHalfOpenConnections = EngineSettings.DefaultSettings().GlobalMaxHalfOpenConnections;
            }

            try{
                globalMaxUploadSpeed = (int)gconf.Retrieve(SETTINGS_PATH + "GlobalMaxUploadSpeed");
            } catch (SettingNotFoundException) {
                globalMaxUploadSpeed = EngineSettings.DefaultSettings().GlobalMaxUploadSpeed;
            }

            try{
                listenPort = (int)gconf.Retrieve(SETTINGS_PATH + "ListenPort");
            } catch (SettingNotFoundException) {
                listenPort = EngineSettings.DefaultSettings().ListenPort;
            }

            /*
             * try{
             *      minEncryptionLevel = (EncryptionType)gconf.Retrieve(SETTINGS_PATH + "MinEncryptionLevel");
             * } catch(SettingNotFoundException){
             *      minEncryptionLevel = EngineSettings.DefaultSettings().MinEncryptionLevel;
             * }
             */

            try{
                savePath = (string)gconf.Retrieve(SETTINGS_PATH + "SavePath");
            } catch (SettingNotFoundException) {
                savePath = EngineSettings.DefaultSettings().SavePath;
            }finally{
                // If savePath has not been set, fallback to user's home directory
                if (savePath.Length == 0)
                {
                    savePath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                }
            }
        }
Пример #5
0
		public void Restore()
		{
			GconfSettingsStorage gconf = new GconfSettingsStorage();
			
			try {
				showDetails = (bool) gconf.Retrieve(SETTINGS_PATH + "showDetails");
			} catch(SettingNotFoundException) {
				showDetails = true;
			}
			
			try {
				showLabels = (bool) gconf.Retrieve(SETTINGS_PATH + "showLabels");
			} catch(SettingNotFoundException) {
				showLabels = true;
			}
			
			try {
				windowHeight = (int) gconf.Retrieve(SETTINGS_PATH + "windowHeight");
			} catch(SettingNotFoundException) {
				windowHeight = 480;
			}
			
			try {
				windowWidth = (int) gconf.Retrieve(SETTINGS_PATH + "windowWidth");
			} catch(SettingNotFoundException) {
				windowWidth = 640;
			}
			
			try { 
				vPaned = (int) gconf.Retrieve(SETTINGS_PATH + "vPaned");
			} catch(SettingNotFoundException) {
				vPaned = 145; 
			}
			
			try {
				hPaned = (int) gconf.Retrieve(SETTINGS_PATH + "hPaned");
			} catch(SettingNotFoundException) {
				hPaned = 160;
			}
			
			try {
				windowYPos = (int) gconf.Retrieve(SETTINGS_PATH + "windowYPos");
			} catch(SettingNotFoundException) {
				windowYPos = 0;
			}
			
			try{
				windowXPos = (int) gconf.Retrieve(SETTINGS_PATH + "windowXPos");
			} catch(SettingNotFoundException) {
				windowXPos = 0;
			}
			
			// Restore column order/width/visibility
			try{
				nameColumnWidth = (int) gconf.Retrieve(SETTINGS_PATH + "Columns/Name/Width");
			} catch(SettingNotFoundException){
				nameColumnWidth = 75;
			}
			
			try{
				nameColumnVisible = (bool) gconf.Retrieve(SETTINGS_PATH + "Columns/Name/Visible");
			} catch(SettingNotFoundException){
				nameColumnVisible = true;
			}
			
			try{
				statusColumnWidth = (int) gconf.Retrieve(SETTINGS_PATH + "Columns/Status/Width");
			} catch(SettingNotFoundException){
				statusColumnWidth = 75;
			}
			
			try{
				statusColumnVisible = (bool) gconf.Retrieve(SETTINGS_PATH + "Columns/Status/Visible");
			} catch(SettingNotFoundException){
				statusColumnVisible = true;
			}
			
			try{
				doneColumnWidth = (int) gconf.Retrieve(SETTINGS_PATH + "Columns/Done/Width");
			} catch(SettingNotFoundException){
				doneColumnWidth = 75;
			}
			
			try{
				doneColumnVisible = (bool) gconf.Retrieve(SETTINGS_PATH + "Columns/Done/Visible");
			} catch(SettingNotFoundException){
				doneColumnVisible = true;
			}
			
			try{
				seedsColumnWidth = (int) gconf.Retrieve(SETTINGS_PATH + "Columns/Seeds/Width");
			} catch(SettingNotFoundException){
				seedsColumnWidth = 75;
			}
			
			try{
				seedsColumnVisible = (bool) gconf.Retrieve(SETTINGS_PATH + "Columns/Seeds/Visible");
			} catch(SettingNotFoundException){
				seedsColumnVisible = true;
			}
			
			try{
				peersColumnWidth = (int) gconf.Retrieve(SETTINGS_PATH + "Columns/Peers/Width");
			} catch(SettingNotFoundException){
				peersColumnWidth = 75;
			}
			
			try{
				peersColumnVisible = (bool) gconf.Retrieve(SETTINGS_PATH + "Columns/Peers/Visible");
			} catch(SettingNotFoundException){
				peersColumnVisible = true;
			}
			
			try{
				dlSpeedColumnWidth = (int) gconf.Retrieve(SETTINGS_PATH + "Columns/DLSpeed/Width");
			} catch(SettingNotFoundException){
				dlSpeedColumnWidth = 75;
			}
			
			try{
				dlSpeedColumnVisible = (bool) gconf.Retrieve(SETTINGS_PATH + "Columns/DLSpeed/Visible");
			} catch(SettingNotFoundException){
				dlSpeedColumnVisible = true;
			}
			
			try{
				upSpeedColumnWidth = (int) gconf.Retrieve(SETTINGS_PATH + "Columns/UPSpeed/Width");
			} catch(SettingNotFoundException){
				upSpeedColumnWidth = 75;
			}
			
			try{
				upSpeedColumnVisible = (bool) gconf.Retrieve(SETTINGS_PATH + "Columns/UPSpeed/Visible");
			} catch(SettingNotFoundException){
				upSpeedColumnVisible = true;
			}
			
			try{
				ratioColumnWidth = (int) gconf.Retrieve(SETTINGS_PATH + "Columns/Ratio/Width");
			} catch(SettingNotFoundException){
				ratioColumnWidth = 75;
			}
			
			try{
				ratioColumnVisible = (bool) gconf.Retrieve(SETTINGS_PATH + "Columns/Ratio/Visible");
			} catch(SettingNotFoundException){
				ratioColumnVisible = true;
			}
			
			try{
				sizeColumnWidth = (int) gconf.Retrieve(SETTINGS_PATH + "Columns/Size/Width");
			} catch(SettingNotFoundException){
				sizeColumnWidth = 75;
			}
			
			try{
				sizeColumnVisible = (bool) gconf.Retrieve(SETTINGS_PATH + "Columns/Size/Visible");
			} catch(SettingNotFoundException){
				sizeColumnVisible = true;
			}
		}
Пример #6
0
        public void Restore()
        {
            GconfSettingsStorage gconf = new GconfSettingsStorage();

            try {
                showDetails = (bool)gconf.Retrieve(SETTINGS_PATH + "showDetails");
            } catch (SettingNotFoundException) {
                showDetails = true;
            }

            try {
                showLabels = (bool)gconf.Retrieve(SETTINGS_PATH + "showLabels");
            } catch (SettingNotFoundException) {
                showLabels = true;
            }

            try {
                windowHeight = (int)gconf.Retrieve(SETTINGS_PATH + "windowHeight");
            } catch (SettingNotFoundException) {
                windowHeight = 480;
            }

            try {
                windowWidth = (int)gconf.Retrieve(SETTINGS_PATH + "windowWidth");
            } catch (SettingNotFoundException) {
                windowWidth = 640;
            }

            try {
                vPaned = (int)gconf.Retrieve(SETTINGS_PATH + "vPaned");
            } catch (SettingNotFoundException) {
                vPaned = 145;
            }

            try {
                hPaned = (int)gconf.Retrieve(SETTINGS_PATH + "hPaned");
            } catch (SettingNotFoundException) {
                hPaned = 160;
            }

            try {
                windowYPos = (int)gconf.Retrieve(SETTINGS_PATH + "windowYPos");
            } catch (SettingNotFoundException) {
                windowYPos = 0;
            }

            try{
                windowXPos = (int)gconf.Retrieve(SETTINGS_PATH + "windowXPos");
            } catch (SettingNotFoundException) {
                windowXPos = 0;
            }

            // Restore column order/width/visibility
            try{
                nameColumnWidth = (int)gconf.Retrieve(SETTINGS_PATH + "Columns/Name/Width");
            } catch (SettingNotFoundException) {
                nameColumnWidth = 75;
            }

            try{
                nameColumnVisible = (bool)gconf.Retrieve(SETTINGS_PATH + "Columns/Name/Visible");
            } catch (SettingNotFoundException) {
                nameColumnVisible = true;
            }

            try{
                statusColumnWidth = (int)gconf.Retrieve(SETTINGS_PATH + "Columns/Status/Width");
            } catch (SettingNotFoundException) {
                statusColumnWidth = 75;
            }

            try{
                statusColumnVisible = (bool)gconf.Retrieve(SETTINGS_PATH + "Columns/Status/Visible");
            } catch (SettingNotFoundException) {
                statusColumnVisible = true;
            }

            try{
                doneColumnWidth = (int)gconf.Retrieve(SETTINGS_PATH + "Columns/Done/Width");
            } catch (SettingNotFoundException) {
                doneColumnWidth = 75;
            }

            try{
                doneColumnVisible = (bool)gconf.Retrieve(SETTINGS_PATH + "Columns/Done/Visible");
            } catch (SettingNotFoundException) {
                doneColumnVisible = true;
            }

            try{
                seedsColumnWidth = (int)gconf.Retrieve(SETTINGS_PATH + "Columns/Seeds/Width");
            } catch (SettingNotFoundException) {
                seedsColumnWidth = 75;
            }

            try{
                seedsColumnVisible = (bool)gconf.Retrieve(SETTINGS_PATH + "Columns/Seeds/Visible");
            } catch (SettingNotFoundException) {
                seedsColumnVisible = true;
            }

            try{
                peersColumnWidth = (int)gconf.Retrieve(SETTINGS_PATH + "Columns/Peers/Width");
            } catch (SettingNotFoundException) {
                peersColumnWidth = 75;
            }

            try{
                peersColumnVisible = (bool)gconf.Retrieve(SETTINGS_PATH + "Columns/Peers/Visible");
            } catch (SettingNotFoundException) {
                peersColumnVisible = true;
            }

            try{
                dlSpeedColumnWidth = (int)gconf.Retrieve(SETTINGS_PATH + "Columns/DLSpeed/Width");
            } catch (SettingNotFoundException) {
                dlSpeedColumnWidth = 75;
            }

            try{
                dlSpeedColumnVisible = (bool)gconf.Retrieve(SETTINGS_PATH + "Columns/DLSpeed/Visible");
            } catch (SettingNotFoundException) {
                dlSpeedColumnVisible = true;
            }

            try{
                upSpeedColumnWidth = (int)gconf.Retrieve(SETTINGS_PATH + "Columns/UPSpeed/Width");
            } catch (SettingNotFoundException) {
                upSpeedColumnWidth = 75;
            }

            try{
                upSpeedColumnVisible = (bool)gconf.Retrieve(SETTINGS_PATH + "Columns/UPSpeed/Visible");
            } catch (SettingNotFoundException) {
                upSpeedColumnVisible = true;
            }

            try{
                ratioColumnWidth = (int)gconf.Retrieve(SETTINGS_PATH + "Columns/Ratio/Width");
            } catch (SettingNotFoundException) {
                ratioColumnWidth = 75;
            }

            try{
                ratioColumnVisible = (bool)gconf.Retrieve(SETTINGS_PATH + "Columns/Ratio/Visible");
            } catch (SettingNotFoundException) {
                ratioColumnVisible = true;
            }

            try{
                sizeColumnWidth = (int)gconf.Retrieve(SETTINGS_PATH + "Columns/Size/Width");
            } catch (SettingNotFoundException) {
                sizeColumnWidth = 75;
            }

            try{
                sizeColumnVisible = (bool)gconf.Retrieve(SETTINGS_PATH + "Columns/Size/Visible");
            } catch (SettingNotFoundException) {
                sizeColumnVisible = true;
            }
        }