Пример #1
0
        /// <summary>
        /// This writes the current state or attributes of this object,
        /// in the <c>XML</c> format, to the media or storage accessible by the given writer.
        /// </summary>
        /// <param name="writer">
        /// The <c>XML</c> writer with which the <c>XML</c> format of this object's state
        /// is written.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If the <paramref name="reader"/> is <see langword="null"/>.
        /// </exception>
        public override void WriteXml(XmlWriter writer)
        {
            BuildExceptions.NotNull(writer, "writer");

            writer.WriteStartElement(TagName);  // start - loggingOptions
            writer.WriteAttributeString("type", "Logging");
            writer.WriteAttributeString("name", this.GetType().ToString());

            writer.WriteStartElement("propertyGroup");  // start - propertyGroup
            writer.WriteAttributeString("name", "General");
            writer.WritePropertyElement("Verbosity", _verbosity.ToString());
            writer.WritePropertyElement("UseFile", _useFile);
            writer.WritePropertyElement("KeepFile", _keepFile);
            writer.WritePropertyElement("FileName", _fileName);
            writer.WriteEndElement();                   // end - propertyGroup

            BuildDirectoryPath.WriteLocation(_outputPath, "location", writer);

            writer.WriteStartElement("loggers");  // start - loggers
            if (_loggers != null && _loggers.Count != 0)
            {
                for (int i = 0; i < _loggers.Count; i++)
                {
                    writer.WriteStartElement("logger"); // start - logger
                    writer.WriteAttributeString("name", _loggers[i]);
                    writer.WriteEndElement();           // end - logger
                }
            }
            writer.WriteEndElement();           // end - loggers

            writer.WriteEndElement();           // end - loggingOptions
        }