public static void SaveFrameButtonDescriptionToSettings(IBlogProviderButtonDescription button, SettingsPersisterHelper settingsKey) { settingsKey.SetString(ID, button.Id); settingsKey.SetString(IMAGE_URL, button.ImageUrl); settingsKey.SetByteArray(IMAGE, ImageHelper.GetBitmapBytes(button.Image, new Size(24, 24))); settingsKey.SetString(DESCRIPTION, button.Description); settingsKey.SetString(CLICK_URL, button.ClickUrl); settingsKey.SetString(CONTENT_URL, button.ContentUrl); settingsKey.SetSize(CONTENT_DISPLAY_SIZE, button.ContentDisplaySize); settingsKey.SetString(NOTIFICATION_URL, button.NotificationUrl); }
static WebProxySettings() { _settingsKey = ApplicationEnvironment.PreferencesSettingsRoot.GetSubSettings("WebProxy"); if (ApplicationDiagnostics.ProxySettingsOverride != null) { Match m = Regex.Match(ApplicationDiagnostics.ProxySettingsOverride, @"^ ( (?<username>[^@:]+) : (?<password>[^@:]+) @)? (?<host>[^@:]+) (:(?<port>\d*))? $", RegexOptions.IgnorePatternWhitespace | RegexOptions.ExplicitCapture); if (m.Success) { string username = m.Groups["username"].Value; string password = m.Groups["password"].Value; string host = m.Groups["host"].Value; string port = m.Groups["port"].Value; _readSettingsKey = new SettingsPersisterHelper(new MemorySettingsPersister()); _readSettingsKey.SetBoolean("Enabled", true); if (!string.IsNullOrEmpty(username)) _readSettingsKey.SetString("Username", username); if (!string.IsNullOrEmpty(password)) _readSettingsKey.SetEncryptedString("Password", password); _readSettingsKey.SetString("Hostname", host); if (!string.IsNullOrEmpty(port)) _readSettingsKey.SetInt32("Port", int.Parse(port, CultureInfo.InvariantCulture)); } } if (_readSettingsKey == null) _readSettingsKey = _settingsKey; }