Exemple #1
0
        /// <summary>
        /// Deserializes an individual configuration setting.
        /// </summary>
        /// <param name="reader">The XmlReader containing the setting to deserialize.</param>
        /// <returns>A <see cref="T:Microsoft.Exchange.Data.Internal.CtsConfigurationSetting" /> instance containing the configuration setting.</returns>
        private static CtsConfigurationSetting DeserializeSetting(XmlReader reader)
        {
            string name = reader.Name;
            CtsConfigurationSetting ctsConfigurationSetting = new CtsConfigurationSetting(name);

            if (reader.AttributeCount > 0)
            {
                while (reader.MoveToNextAttribute())
                {
                    string name2 = reader.Name;
                    string value = reader.Value;
                    ctsConfigurationSetting.AddArgument(name2, value);
                }
            }
            return(ctsConfigurationSetting);
        }
Exemple #2
0
        /// <summary>
        /// Gets the configuration subsection specified.
        /// </summary>
        /// <param name="subSectionName">Name of the subsection.</param>
        /// <returns>
        /// A list of <see cref="T:Microsoft.Exchange.Data.Internal.CtsConfigurationSetting" />s for the specified section.
        /// </returns>
        public IList <CtsConfigurationSetting> GetConfiguration(string subSectionName)
        {
            IList <CtsConfigurationSetting> list;

            if (this.configurationSubSections == null)
            {
                lock (this.lockObject)
                {
                    if (this.configurationSubSections == null)
                    {
                        try
                        {
                            CtsConfigurationSection ctsConfigurationSection = ConfigurationManager.GetSection("CTS") as CtsConfigurationSection;
                            if (ctsConfigurationSection != null)
                            {
                                this.configurationSubSections = ctsConfigurationSection.SubSectionsDictionary;
                            }
                            else
                            {
                                this.configurationSubSections = new Dictionary <string, IList <CtsConfigurationSetting> >
                                {
                                    {
                                        string.Empty,
                                        new List <CtsConfigurationSetting>()
                                    }
                                };
                            }
                            string value = ConfigurationManager.AppSettings["TemporaryStoragePath"];
                            if (!string.IsNullOrEmpty(value))
                            {
                                CtsConfigurationSetting ctsConfigurationSetting = new CtsConfigurationSetting("TemporaryStorage");
                                ctsConfigurationSetting.AddArgument("Path", value);
                                list = this.configurationSubSections[string.Empty];
                                list.Add(ctsConfigurationSetting);
                            }
                            ConfigurationManager.RefreshSection("CTS");
                        }
                        catch (ConfigurationErrorsException)
                        {
                            ApplicationServices.Provider.LogConfigurationErrorEvent();
                            this.configurationSubSections = new Dictionary <string, IList <CtsConfigurationSetting> >
                            {
                                {
                                    string.Empty,
                                    new List <CtsConfigurationSetting>()
                                }
                            };
                        }
                    }
                }
            }
            if (subSectionName == null)
            {
                subSectionName = string.Empty;
            }
            if (!this.configurationSubSections.TryGetValue(subSectionName, out list))
            {
                list = DefaultApplicationServices.EmptySubSection;
            }
            return(list);
        }