public override XElement GetDiagnosticInfo(string argument) { XElement diagnosticInfo = base.GetDiagnosticInfo(argument); diagnosticInfo.Add(new XElement("description", "App config contains DEFAULTS. They may be overrided by updating app.config directly but it's not recommended")); ConfigurationSection configurationSection = this.Section; if (configurationSection != null) { XElement xelement = new XElement(base.Schema.SectionName); ExchangeConfigurationSection exchangeConfigurationSection = configurationSection as ExchangeConfigurationSection; if (exchangeConfigurationSection != null) { using (IEnumerator <string> enumerator = exchangeConfigurationSection.Settings.GetEnumerator()) { while (enumerator.MoveNext()) { string text = enumerator.Current; xelement.Add(new XElement(text, exchangeConfigurationSection.GetPropertyValue(text))); } goto IL_FC; } } AppSettingsSection appSettingsSection = configurationSection as AppSettingsSection; foreach (object obj in appSettingsSection.Settings) { KeyValueConfigurationElement keyValueConfigurationElement = (KeyValueConfigurationElement)obj; xelement.Add(new XElement(keyValueConfigurationElement.Key, keyValueConfigurationElement.Value)); } IL_FC: diagnosticInfo.Add(xelement); } return(diagnosticInfo); }
public override bool TryGetBoxedSetting(ISettingsContext context, string settingName, Type settingType, out object settingValue) { ConfigurationSection configurationSection = this.Section; if (configurationSection != null) { ExchangeConfigurationSection exchangeConfigurationSection = configurationSection as ExchangeConfigurationSection; if (exchangeConfigurationSection != null) { object propertyValue = exchangeConfigurationSection.GetPropertyValue(settingName); if (propertyValue != exchangeConfigurationSection.GetConfigurationProperty(settingName, null).DefaultValue) { settingValue = propertyValue; return(true); } } else { AppSettingsSection appSettingsSection = configurationSection as AppSettingsSection; KeyValueConfigurationElement keyValueConfigurationElement = appSettingsSection.Settings[settingName]; if (keyValueConfigurationElement != null) { settingValue = base.ParseAndValidateConfigValue(settingName, keyValueConfigurationElement.Value, settingType); return(true); } } } settingValue = null; return(false); }