Ejemplo n.º 1
0
        private void DeserializeSection(ApplicationConfigurationSettings source)
        {
            using (MemoryStream memoryBuffer = new MemoryStream())
            {
                XmlWriterSettings writerRettings = new XmlWriterSettings();

                writerRettings.CloseOutput       = false;
                writerRettings.CheckCharacters   = false;
                writerRettings.ConformanceLevel  = ConformanceLevel.Fragment;
                writerRettings.NamespaceHandling = NamespaceHandling.OmitDuplicates;

                using (XmlWriter writer = XmlWriter.Create(memoryBuffer, writerRettings))
                {
                    source.WriteXml(writer);
                    writer.Flush();
                }

                memoryBuffer.Seek(0, SeekOrigin.Begin);

                XmlDocument       configXml      = FrameworkUtility.CreateXmlDocument(memoryBuffer);
                XmlReaderSettings readerSettings = new XmlReaderSettings();

                readerSettings.CloseInput                   = false;
                readerSettings.IgnoreWhitespace             = true;
                readerSettings.IgnoreComments               = true;
                readerSettings.ValidationType               = ValidationType.None;
                readerSettings.IgnoreProcessingInstructions = true;

                using (XmlReader reader = XmlReader.Create(new StringReader(configXml.OuterXml), readerSettings))
                {
                    this.ReadXml(reader);
                }
                this.PostDeserialize();
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ApplicationConfigurationSettings"/> object using the specified default settings.
 /// </summary>
 /// <param name="baseSettings">The custom default settings.</param>
 public ApplicationConfigurationSettings(ApplicationConfigurationSettings baseSettings) : base()
 {
     DeserializeSection(baseSettings);
 }