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; } }
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); } } }
public void Store() { GconfSettingsStorage gconf = new GconfSettingsStorage(); gconf.Store(SETTINGS_PATH + "showDetails", showDetails); gconf.Store(SETTINGS_PATH + "showLabels", showLabels); gconf.Store(SETTINGS_PATH + "windowHeight", windowHeight); gconf.Store(SETTINGS_PATH + "windowWidth", windowWidth); gconf.Store(SETTINGS_PATH + "vPaned", vPaned); gconf.Store(SETTINGS_PATH + "hPaned", hPaned); gconf.Store(SETTINGS_PATH + "windowXPos", windowXPos); gconf.Store(SETTINGS_PATH + "windowYPos", windowYPos); // Columns gconf.Store(SETTINGS_PATH + "Columns/Name/Width", nameColumnWidth); gconf.Store(SETTINGS_PATH + "Columns/Name/Visible", nameColumnVisible); gconf.Store(SETTINGS_PATH + "Columns/Status/Width", statusColumnWidth); gconf.Store(SETTINGS_PATH + "Columns/Status/Visible", statusColumnVisible); gconf.Store(SETTINGS_PATH + "Columns/Done/Width", doneColumnWidth); gconf.Store(SETTINGS_PATH + "Columns/Done/Visible", doneColumnVisible); gconf.Store(SETTINGS_PATH + "Columns/Seeds/Width", seedsColumnWidth); gconf.Store(SETTINGS_PATH + "Columns/Seeds/Visible", seedsColumnVisible); gconf.Store(SETTINGS_PATH + "Columns/Peers/Width", seedsColumnWidth); gconf.Store(SETTINGS_PATH + "Columns/Peers/Visible", peersColumnVisible); gconf.Store(SETTINGS_PATH + "Columns/DLSpeed/Width", dlSpeedColumnWidth); gconf.Store(SETTINGS_PATH + "Columns/DLSpeed/Visible", dlSpeedColumnVisible); gconf.Store(SETTINGS_PATH + "Columns/UPSpeed/Width", upSpeedColumnWidth); gconf.Store(SETTINGS_PATH + "Columns/UPSpeed/Visible", upSpeedColumnVisible); gconf.Store(SETTINGS_PATH + "Columns/Ratio/Width", ratioColumnWidth); gconf.Store(SETTINGS_PATH + "Columns/Ratio/Visible", ratioColumnVisible); gconf.Store(SETTINGS_PATH + "Columns/Size/Width", sizeColumnWidth); gconf.Store(SETTINGS_PATH + "Columns/Size/Visible", sizeColumnVisible); }
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 Store() { GconfSettingsStorage gconf = new GconfSettingsStorage(); gconf.Store(SETTINGS_PATH + "UploadSlots", uploadSlots); gconf.Store(SETTINGS_PATH + "MaxConnections", maxConnections); gconf.Store(SETTINGS_PATH + "MaxDownloadSpeed", maxDownloadSpeed); gconf.Store(SETTINGS_PATH + "MaxUploadSpeed", maxUploadSpeed); gconf.Store(SETTINGS_PATH + "FastResumeEnabled", fastResumeEnabled); }
public void Store() { GconfSettingsStorage gconf = new GconfSettingsStorage(); gconf.Store(SETTINGS_PATH + "AllowLegacyConnections", allowLegacyConnections); gconf.Store(SETTINGS_PATH + "GlobalMaxConnections", globalMaxConnections); gconf.Store(SETTINGS_PATH + "GlobalMaxDownloadSpeed", globalMaxDownloadSpeed); gconf.Store(SETTINGS_PATH + "GlobalMaxHalfOpenConnections", globalMaxHalfOpenConnections); gconf.Store(SETTINGS_PATH + "GlobalMaxUploadSpeed", globalMaxUploadSpeed); gconf.Store(SETTINGS_PATH + "ListenPort", listenPort); //gconf.Store(SETTINGS_PATH + "MinEncryptionLevel", minEncryptionLevel); gconf.Store(SETTINGS_PATH + "SavePath", savePath); }
public void Store() { GconfSettingsStorage gconf = new GconfSettingsStorage(); gconf.Store(SETTINGS_PATH + "enableNotifications", enableNotifications); gconf.Store(SETTINGS_PATH + "quitOnClose", quitOnClose); gconf.Store(SETTINGS_PATH + "enableTray", enableTray); gconf.Store(SETTINGS_PATH + "torrentStorageLocation", torrentStorageLocation); gconf.Store(SETTINGS_PATH + "startNewTorrents", startNewTorrents); gconf.Store(SETTINGS_PATH + "importLocation", importLocation); gconf.Store(SETTINGS_PATH + "upnpEnabled", upnpEnabled); gconf.Store(SETTINGS_PATH + "importEnabled", importEnabled); gconf.Store(SETTINGS_PATH + "removeOnImport", removeOnImport); }
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; } }
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; } }