public void ClearOrder() { foreach (string name in _settings.GetNames()) { _settings.Unset(name); } }
private static ArrayList LoadAccountWizardsFromXml() { ArrayList accountWizardsFromXml = new ArrayList(); try { using (SettingsPersisterHelper settingsKey = ApplicationEnvironment.UserSettingsRoot.GetSubSettings("AccountWizard\\Custom")) { foreach (string customizationName in settingsKey.GetNames()) { IBlogProviderAccountWizardDescription wizardDescription = LoadAccountWizardFromXml(settingsKey.GetString(customizationName, String.Empty)); if (wizardDescription != null) { accountWizardsFromXml.Add(wizardDescription); } } } } catch (Exception ex) { Trace.Fail("Unexpected exception in LoadAccountWizardsFromXml: " + ex.ToString()); } return(accountWizardsFromXml); }
/// <summary> /// Returns the profile associated with the key, or null if no such profile exists. /// </summary> /// <param name="key">The name of the registry key to define the profile under.</param> /// <returns></returns> public DestinationProfile loadProfile(String key) { SettingsPersisterHelper settings = getProfileSettings(key); if (settings.GetNames().Length == 0) { return(null); } DestinationProfile profile = new DestinationProfile(); profile.Id = key; profile.Name = settings.GetString(PROFILE_NAME_KEY, ""); profile.WebsiteURL = settings.GetString(PROFILE_WEBSITE_URL_KEY, ""); profile.FtpServer = settings.GetString(PROFILE_FTP_SERVER_KEY, ""); profile.UserName = settings.GetString(PROFILE_FTP_USER_KEY, ""); profile.FtpPublishPath = settings.GetString(PROFILE_FTP_PUBLISH_DIR_KEY, ""); profile.LocalPublishPath = settings.GetString(PROFILE_PUBLISH_DIR_KEY, ""); profile.Type = (DestinationProfile.DestType)settings.GetInt32(PROFILE_DESTINATION_TYPE_KEY, 0); //load the decrypted password try { profile.Password = settings.GetEncryptedString(PROFILE_FTP_PASSWORD_KEY); } catch (Exception e) { Trace.Fail("Failed to decrypt password: " + e); } return(profile); }
private void AddPluginsFromKey(ArrayList pluginPaths, SettingsPersisterHelper settingsKey) { foreach (string name in settingsKey.GetNames()) { string assemblyPath = settingsKey.GetString(name, String.Empty); if (!pluginPaths.Contains(assemblyPath)) { pluginPaths.Add(assemblyPath); } } }
internal void CleanupUnusedTemplates() { try { using (SettingsPersisterHelper templates = _editorTemplateSettings.GetSubSettings(EDITOR_TEMPLATES_KEY)) { // get the list of templates which are legit ArrayList templatesInUse = new ArrayList(); foreach (string key in templates.GetNames()) { templatesInUse.Add(MakeAbsolute(templates.GetString(key, String.Empty)).Trim().ToLower(CultureInfo.CurrentCulture)); } // delete each of the template files in the directory which // are not contained in our list of valid templates if (templatesInUse.Count > 0) { string templateDirectory = Path.GetDirectoryName((string)templatesInUse[0]); if (Directory.Exists(templateDirectory)) { string[] templateFiles = Directory.GetFiles(templateDirectory, "*.htm"); foreach (string templateFile in templateFiles) { string templateFileNormalized = templateFile.Trim().ToLower(CultureInfo.CurrentCulture); if (!templatesInUse.Contains(templateFileNormalized)) { CleanupTemplateAndSupportingFiles(templateFile); } } } } } } catch (Exception ex) { Trace.Fail("Error occurred cleaning up unused templates: " + ex.ToString()); } }