示例#1
0
        public void WriteXml(XmlWriter writer)
        {
            writer.WriteStartElement("Checksum");
            writer.WriteValue(Checksum);
            writer.WriteEndElement();

            writer.WriteStartElement("LastConfigurationReload");
            writer.WriteValue(LastConfigurationReload);
            writer.WriteEndElement();

            var xmlSerializer = new XmlSerializer(typeof(DynamicModuleInstanceConfiguration));

            foreach (var configuration in Configuration)
            {
                xmlSerializer.Serialize(writer, configuration, XmlNamespaceFactory.CreateEmptyNamespace());
            }
        }
        public void WriteXml(XmlWriter writer)
        {
            writer.WriteAttributeString(
                "Name",
                Name.ToString()
                );

            writer.WriteStartElement("AssemblyName");
            writer.WriteValue(AssemblyName);
            writer.WriteEndElement();

            if (Configuration != null)
            {
                var xmlSerializer = new XmlSerializer(Configuration.GetType());

                xmlSerializer.Serialize(writer, Configuration, XmlNamespaceFactory.CreateEmptyNamespace());
            }
        }
        private void DumpConfigurationToXml(ConfigurationRoot configuration)
        {
            var xmlSerializer = new XmlSerializer(typeof(ConfigurationRoot));

            var xmlWriterSettings = new XmlWriterSettings
            {
                Indent             = true,
                OmitXmlDeclaration = true
            };

            using (var file = File.Open(
                       Path.Join(
                           m_contentRootPath,
                           ModuleConfigurationFile
                           ),
                       FileMode.Create,
                       FileAccess.Write,
                       FileShare.Write
                       ))
                using (var textWriter = XmlWriter.Create(file, xmlWriterSettings))
                {
                    xmlSerializer.Serialize(textWriter, configuration, XmlNamespaceFactory.CreateEmptyNamespace());
                }
        }