コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BuildDocumenter"/> class
 /// with properties from the specified source, a copy constructor.
 /// </summary>
 /// <param name="source">
 /// An instance of the <see cref="BuildDocumenter"/> 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 BuildDocumenter(BuildDocumenter source)
     : base(source)
 {
     _isLoaded     = source._isLoaded;
     _version      = source._version;
     _documentFile = source._documentFile;
 }
コード例 #2
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 - TagName
            writer.WriteAttributeString("version", _version.ToString(2));

            //  1. Documentation: Settings of the documentation
            writer.WriteComment(" 1. Documentation: Settings of the documentation ");
            if (_settings != null)
            {
                _settings.WriteXml(writer);
            }

            // 2. Documentation: Group sources of the documentation
            writer.WriteComment(" 2. Documentation: Group sources of the documentation ");
            writer.WriteStartElement("documentSources"); // start - documentSources
            if (_listSources != null && _listSources.Count != 0)
            {
                for (int i = 0; i < _listSources.Count; i++)
                {
                    _listSources[i].WriteXml(writer);
                }
            }
            writer.WriteEndElement();                    // end - documentSources

            // 3. Documentation: Groups of the documentation
            writer.WriteComment(" 3. Documentation: Groups of the documentation ");
            writer.WriteStartElement("documentGroups"); // start - documentGroups
            if (_listGroups != null && _listGroups.Count != 0)
            {
                BuildPathResolver resolver = BuildPathResolver.Resolver;
                Debug.Assert(resolver != null && resolver.Id == _documentId);

                for (int i = 0; i < _listGroups.Count; i++)
                {
                    BuildGroup group = _listGroups[i];

                    BuildFilePath filePath = group.ContentFile;
                    if (filePath != null && filePath.IsValid)
                    {
                        writer.WriteStartElement(BuildGroup.TagName);
                        writer.WriteAttributeString("type", group.GroupType.ToString());
                        writer.WriteAttributeString("source", resolver.ResolveRelative(filePath));
                        writer.WriteEndElement();

                        group.Save();
                    }
                    else
                    {
                        group.WriteXml(writer);
                    }
                }
            }
            writer.WriteEndElement();           // end - documentGroups

            writer.WriteEndElement();           // end - TagName
        }
コード例 #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
        }
コード例 #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;
                    }
                }
            }
        }
コード例 #5
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;
 }
コード例 #6
0
        public bool IsDirectoryOf(BuildFilePath filePath)
        {
            BuildExceptions.NotNull(filePath, "filePath");
            if (filePath.IsValid && this.IsValid)
            {
                string fileDir = IoPath.GetDirectoryName(filePath);
                fileDir = StripEndBackSlash(fileDir);

                string currentDir = StripEndBackSlash(_path);

                return(String.Equals(fileDir, currentDir,
                                     StringComparison.OrdinalIgnoreCase));
            }

            return(false);
        }
コード例 #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BuildFeedback"/> class
        /// with the default parameters.
        /// </summary>
        public BuildFeedback()
        {
            _logoImage     = null;
            _logoLink      = String.Empty;
            _logoText      = String.Empty;
            _logoAlignment = BuildLogoAlignment.Center;
            _logoPlacement = BuildLogoPlacement.Right;

            _copyrightLink = String.Empty;
            _copyrightText = String.Empty; //"Copyright (C) " + DateTime.Now.Year;
            _productName   = "Product";
            _companyName   = "Company";
            _emailAddress  = "*****@*****.**";
            _postalAddress = String.Empty;
            _feedbackType  = BuildFeedbackType.Simple;
        }
コード例 #8
0
        public BuildFeedback(BuildFeedback source)
            : base(source)
        {
            _logoImage     = source._logoImage;
            _logoLink      = source._logoLink;
            _logoText      = source._logoText;
            _logoAlignment = source._logoAlignment;
            _logoPlacement = source._logoPlacement;

            _copyrightLink = source._copyrightLink;
            _copyrightText = source._copyrightText;
            _productName   = source._productName;
            _companyName   = source._companyName;
            _emailAddress  = source._emailAddress;
            _postalAddress = source._postalAddress;
            _feedbackType  = source._feedbackType;
        }
コード例 #9
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 - feedbackOptions
            writer.WriteAttributeString("type", "Feedback");
            writer.WriteAttributeString("name", this.GetType().ToString());

            // Write the general properties
            writer.WriteStartElement("propertyGroup"); // start - propertyGroup;
            writer.WriteAttributeString("name", "General");
            writer.WritePropertyElement("FeedbackType", _feedbackType.ToString());
            writer.WritePropertyElement("CopyrightText", _copyrightText);
            writer.WritePropertyElement("CopyrightLink", _copyrightLink);
            writer.WritePropertyElement("ProductName", _productName);
            writer.WritePropertyElement("CompanyName", _companyName);
            writer.WritePropertyElement("EmailAddress", _emailAddress);
            writer.WritePropertyElement("PostalAddress", _postalAddress);
            writer.WriteEndElement();            // end - propertyGroup

            // Write the logo element
            writer.WriteStartElement("logo"); // start - logo
            writer.WriteAttributeString("enabled", _logoEnabled.ToString());
            writer.WriteAttributeString("alignment", _logoAlignment.ToString());
            writer.WriteAttributeString("placement", _logoPlacement.ToString());
            writer.WriteAttributeString("width", _logoWidth.ToString());
            writer.WriteAttributeString("height", _logoHeight.ToString());
            writer.WriteAttributeString("padding", _logoPadding.ToString());

            writer.WriteTextElement("text", _logoText);
            writer.WriteTextElement("link", _logoLink);

            BuildFilePath.WriteLocation(_logoImage, "image", writer);

            writer.WriteEndElement();         // end - logo

            writer.WriteEndElement();         // end - feedbackOptions
        }
コード例 #10
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;
            }

            string nodeText = null;

            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, "logo",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        nodeText = reader.GetAttribute("enabled");
                        if (!String.IsNullOrEmpty(nodeText))
                        {
                            _logoEnabled = Convert.ToBoolean(nodeText);
                        }
                        nodeText = reader.GetAttribute("alignment");
                        if (!String.IsNullOrEmpty(nodeText))
                        {
                            _logoAlignment = (BuildLogoAlignment)Enum.Parse(
                                typeof(BuildLogoAlignment), nodeText, true);
                        }
                        nodeText = reader.GetAttribute("placement");
                        if (!String.IsNullOrEmpty(nodeText))
                        {
                            _logoPlacement = (BuildLogoPlacement)Enum.Parse(
                                typeof(BuildLogoPlacement), nodeText, true);
                        }
                        nodeText = reader.GetAttribute("width");
                        if (!String.IsNullOrEmpty(nodeText))
                        {
                            _logoWidth = Convert.ToInt32(nodeText);
                        }
                        nodeText = reader.GetAttribute("height");
                        if (!String.IsNullOrEmpty(nodeText))
                        {
                            _logoHeight = Convert.ToInt32(nodeText);
                        }
                        nodeText = reader.GetAttribute("padding");
                        if (!String.IsNullOrEmpty(nodeText))
                        {
                            _logoPadding = Convert.ToInt32(nodeText);
                        }

                        if (!reader.IsEmptyElement)
                        {
                            while (reader.Read())
                            {
                                if (reader.NodeType == XmlNodeType.Element)
                                {
                                    switch (reader.Name)
                                    {
                                    case "text":
                                        _logoText = reader.ReadString();
                                        break;

                                    case "link":
                                        _logoLink = reader.ReadString();
                                        break;

                                    case "image":
                                        _logoImage = BuildFilePath.ReadLocation(reader);
                                        break;
                                    }
                                }
                                else if (reader.NodeType == XmlNodeType.EndElement)
                                {
                                    if (String.Equals(reader.Name, "logo",
                                                      StringComparison.OrdinalIgnoreCase))
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, TagName,
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }