Esempio n. 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
        }
Esempio n. 2
0
        /// <summary>
        /// This reads and sets its state or attributes stored in a <c>XML</c> format
        /// with the given reader.
        /// </summary>
        /// <param name="reader">
        /// The reader with which the <c>XML</c> attributes of this object are accessed.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If the <paramref name="reader"/> is <see langword="null"/>.
        /// </exception>
        public override void ReadXml(XmlReader reader)
        {
            BuildExceptions.NotNull(reader, "reader");

            Debug.Assert(reader.NodeType == XmlNodeType.Element);
            if (reader.NodeType != XmlNodeType.Element)
            {
                return;
            }

            if (!String.Equals(reader.Name, TagName,
                               StringComparison.OrdinalIgnoreCase))
            {
                Debug.Assert(false, String.Format(
                                 "The element name '{0}' does not match the expected '{1}'.",
                                 reader.Name, TagName));
                return;
            }

            if (reader.IsEmptyElement)
            {
                return;
            }

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (String.Equals(reader.Name, "propertyGroup",
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        this.ReadXmlGeneral(reader);
                    }
                    else if (String.Equals(reader.Name, "logger",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        string nodeText = reader.GetAttribute("name");

                        if (!String.IsNullOrEmpty(nodeText))
                        {
                            _loggers.Add(nodeText);
                        }
                    }
                    else if (String.Equals(reader.Name, "location",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        _outputPath = BuildDirectoryPath.ReadLocation(reader);
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, TagName,
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }
Esempio n. 3
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 - styleOptions
            writer.WriteAttributeString("type", "Style");
            writer.WriteAttributeString("name", this.GetType().ToString());

            writer.WriteStartElement("propertyGroup");  // start - propertyGroup
            writer.WriteAttributeString("name", "General");
            writer.WritePropertyElement("StyleName", _styleName);
            writer.WritePropertyElement("StyleType", _styleType.ToString());
            writer.WriteEndElement();                   // end - propertyGroup

            BuildDirectoryPath.WriteLocation(_styleDir, "location", writer);
            BuildFilePath.WriteLocation(_stylePresentation, "presentation", writer);

            writer.WriteStartElement("contents");  // start - contents
            if (_scripts != null)
            {
                writer.WriteStartElement("content");
                writer.WriteAttributeString("type", "Scripts");
                _scripts.WriteXml(writer);
                writer.WriteEndElement();
            }
            if (_snippets != null)
            {
                writer.WriteStartElement("content");
                writer.WriteAttributeString("type", "Snippets");
                _snippets.WriteXml(writer);
                writer.WriteEndElement();
            }
            if (_styleSheets != null)
            {
                writer.WriteStartElement("content");
                writer.WriteAttributeString("type", "StyleSheets");
                _styleSheets.WriteXml(writer);
                writer.WriteEndElement();
            }
            if (_mathPackages != null)
            {
                writer.WriteStartElement("content");
                writer.WriteAttributeString("type", "Packages");
                _mathPackages.WriteXml(writer);
                writer.WriteEndElement();
            }
            if (_mathCommands != null)
            {
                writer.WriteStartElement("content");
                writer.WriteAttributeString("type", "Commands");
                _mathCommands.WriteXml(writer);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();           // end - contents

            writer.WriteEndElement();           // end - styleOptions
        }
Esempio n. 4
0
        /// <summary>
        /// This reads and sets its state or attributes stored in a <c>XML</c> format
        /// with the given reader.
        /// </summary>
        /// <param name="reader">
        /// The reader with which the <c>XML</c> attributes of this object are accessed.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If the <paramref name="reader"/> is <see langword="null"/>.
        /// </exception>
        public override void ReadXml(XmlReader reader)
        {
            BuildExceptions.NotNull(reader, "reader");

            Debug.Assert(reader.NodeType == XmlNodeType.Element);
            if (reader.NodeType != XmlNodeType.Element)
            {
                return;
            }

            if (!String.Equals(reader.Name, TagName,
                               StringComparison.OrdinalIgnoreCase))
            {
                Debug.Assert(false, String.Format(
                                 "The element name '{0}' does not match the expected '{1}'.",
                                 reader.Name, TagName));
                return;
            }

            if (reader.IsEmptyElement)
            {
                return;
            }

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name.ToLower())
                    {
                    case "propertygroup":
                        this.ReadXmlGeneral(reader);
                        break;

                    case "location":
                        _styleDir = BuildDirectoryPath.ReadLocation(reader);
                        break;

                    case "presentation":
                        _stylePresentation = BuildFilePath.ReadLocation(reader);
                        break;

                    case "contents":
                        this.ReadXmlContents(reader);
                        break;
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, TagName,
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BuildStyle"/> class with the
 /// specified style name, style type and style directory.
 /// </summary>
 /// <param name="name">
 /// A <see cref="System.String"/> containing the name of this style.
 /// </param>
 /// <param name="directory">
 /// A <see cref="System.String"/> containing the directory of the style.
 /// <para>
 /// This is only used for specifying the directory of custom or user-defined
 /// style. If not specified or the specified directory is invalid, the
 /// default Sandcastle style directory is used.
 /// </para>
 /// </param>
 /// <param name="type">
 /// An enumeration of the type <see cref="BuildStyleType"/> specifying the type
 /// of the presentation style.
 /// </param>
 public BuildStyle(string name, string directory,
                   BuildStyleType type) : this(type)
 {
     _styleName = name;
     if (!String.IsNullOrEmpty(directory))
     {
         _styleDir = new BuildDirectoryPath(directory);
     }
 }
Esempio n. 6
0
 public BuildLogging(BuildLogging source)
     : base(source)
 {
     _useFile    = source._useFile;
     _keepFile   = source._keepFile;
     _fileName   = source._fileName;
     _verbosity  = source._verbosity;
     _loggers    = source._loggers;
     _outputPath = source._outputPath;
 }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BuildStyle"/> class
 /// with parameters copied from the specified instance of the
 /// <see cref="BuildStyle"/> class, a copy constructor.
 /// </summary>
 /// <param name="source">
 /// An instance of the <see cref="BuildStyle"/> class from which the
 /// initialization parameters or values will be copied.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// If the parameter <paramref name="source"/> is <see langword="null"/>.
 /// </exception>
 public BuildStyle(BuildStyle source)
     : base(source)
 {
     _styleDir          = source._styleDir;
     _styleName         = source._styleName;
     _stylePresentation = source._stylePresentation;
     _styleType         = source._styleType;
     _scripts           = source._scripts;
     _snippets          = source._snippets;
     _styleSheets       = source._styleSheets;
     _mathPackages      = source._mathPackages;
     _mathCommands      = source._mathCommands;
 }
Esempio n. 8
0
 public abstract void Deployment(BuildLogger logger,
                                 BuildDirectoryPath sourcePath);