private void ReadContents(XmlReader reader)
        {
            // Read the version information of the file format...
            string nodeText = reader.GetAttribute("version");

            if (!String.IsNullOrEmpty(nodeText))
            {
                _contentVersion = new Version(nodeText);
            }

            XmlNodeType nodeType = XmlNodeType.None;
            string      nodeName = null;

            while (reader.Read())
            {
                nodeType = reader.NodeType;
                if (nodeType == XmlNodeType.Element)
                {
                    nodeName = reader.Name;
                    if (String.Equals(nodeName, "location",
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        if (!reader.IsEmptyElement)
                        {
                            _contentDir = BuildDirectoryPath.ReadLocation(reader);
                        }
                    }
                    else if (String.Equals(nodeName, "propertyGroup",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        this.ReadPropertyGroup(reader);
                    }
                    else if (String.Equals(nodeName, "categories",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        this.ReadCategories(reader);
                    }
                    else if (String.Equals(nodeName, "topics",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        this.ReadTopics(reader);
                    }
                    else if (String.Equals(nodeName, "relatedTopics",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        this.ReadRelatedTopics(reader);
                    }
                }
                else if (nodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, TagName))
                    {
                        break;
                    }
                }
            }
        }
Beispiel #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)
                {
                    switch (reader.Name.ToLower())
                    {
                    case "source":
                        _source = BuildDirectoryPath.ReadLocation(reader);
                        break;

                    case "destination":
                        _destination = BuildDirectoryPath.ReadLocation(reader);
                        break;
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, TagName,
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }
        /// <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.ReadPropertyGroup(reader);
                    }
                    else if (String.Equals(reader.Name, "location",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        _sourcePath = BuildDirectoryPath.ReadLocation(reader);
                    }
                    else if (String.Equals(reader.Name, "excludes",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        this.ReadExcludes(reader);
                    }
                    else if (String.Equals(reader.Name, "contents",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        this.ReadContents(reader);
                    }
                    else if (String.Equals(reader.Name, "filters",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        this.ReadFilters(reader);
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, TagName,
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }
Beispiel #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;
            }

            string tempText = reader.GetAttribute("name");

            if (String.IsNullOrEmpty(tempText) || !String.Equals(tempText,
                                                                 ConfigurationName, StringComparison.OrdinalIgnoreCase))
            {
                throw new BuildException(String.Format(
                                             "ReadXml: The current name '{0}' does not match the expected name '{1}'.",
                                             tempText, ConfigurationName));
            }

            if (reader.IsEmptyElement)
            {
                return;
            }

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (String.Equals(reader.Name, "property",
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        switch (reader.GetAttribute("name").ToLower())
                        {
                        case "enabled":
                            tempText = reader.ReadString();
                            if (!String.IsNullOrEmpty(tempText))
                            {
                                this.Enabled = Convert.ToBoolean(tempText);
                            }
                            break;

                        default:
                            // Should normally not reach here...
                            throw new NotImplementedException(reader.GetAttribute("name"));
                        }
                    }
                    else if (String.Equals(reader.Name, "expression",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        switch (reader.GetAttribute("name").ToLower())
                        {
                        case "root":
                            _rootExpression = reader.ReadString();
                            break;

                        case "assembly":
                            _assemblyExpression = reader.ReadString();
                            break;

                        case "summary":
                            _summaryExpression = reader.ReadString();
                            break;

                        case "parameters":
                            _parametersExpression = reader.ReadString();
                            break;

                        case "parametercontent":
                            _parameterContentExpression = reader.ReadString();
                            break;

                        case "templates":
                            _templatesExpression = reader.ReadString();
                            break;

                        case "templatecontent":
                            _templateContentExpression = reader.ReadString();
                            break;

                        case "returns":
                            _returnsExpression = reader.ReadString();
                            break;

                        case "exception":
                            _exceptionExpression = reader.ReadString();
                            break;

                        case "exceptioncref":
                            _exceptionCrefExpression = reader.ReadString();
                            break;

                        case "enumeration":
                            _enumerationExpression = reader.ReadString();
                            break;

                        case "enumerationapi":
                            _enumerationApiExpression = reader.ReadString();
                            break;

                        case "membersummary":
                            _memberSummaryExpression = reader.ReadString();
                            break;

                        default:
                            // Should normally not reach here...
                            throw new NotImplementedException(reader.GetAttribute("name"));
                        }
                    }
                    else if (String.Equals(reader.Name, "workingDirectory",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        _workingDir = BuildDirectoryPath.ReadLocation(reader);
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, TagName,
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }
Beispiel #5
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;
            }

            string tempText = reader.GetAttribute("name");

            if (String.IsNullOrEmpty(tempText) || !String.Equals(tempText,
                                                                 ConfigurationName, StringComparison.OrdinalIgnoreCase))
            {
                throw new BuildException(String.Format(
                                             "ReadXml: The current name '{0}' does not match the expected name '{1}'.",
                                             tempText, ConfigurationName));
            }

            if (reader.IsEmptyElement)
            {
                return;
            }

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (String.Equals(reader.Name, "property",
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        switch (reader.GetAttribute("name").ToLower())
                        {
                        case "enabled":
                            tempText = reader.ReadString();
                            if (!String.IsNullOrEmpty(tempText))
                            {
                                this.Enabled = Convert.ToBoolean(tempText);
                            }
                            break;

                        default:
                            // Should normally not reach here...
                            throw new NotImplementedException(reader.GetAttribute("name"));
                        }
                    }
                    else if (String.Equals(reader.Name, "workingDirectory",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        _workingDir = BuildDirectoryPath.ReadLocation(reader);
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, TagName,
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }
Beispiel #6
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;
            }

            this.Clear();

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (String.Equals(reader.Name, MediaItem.TagName,
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        MediaItem item = new MediaItem();
                        item.Content = this;
                        item.ReadXml(reader);

                        this.Add(item);
                    }
                    else if (String.Equals(reader.Name, "mediaContent",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        string nodeText = reader.GetAttribute("id");
                        if (!String.IsNullOrEmpty(nodeText))
                        {
                            _contentId = nodeText;
                        }
                        nodeText = reader.GetAttribute("version");
                        if (!String.IsNullOrEmpty(nodeText))
                        {
                            _contentVersion = new Version(nodeText);
                        }
                    }
                    else if (String.Equals(reader.Name, "location",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        if (!reader.IsEmptyElement)
                        {
                            _contentDir = BuildDirectoryPath.ReadLocation(reader);
                        }
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, TagName,
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }
Beispiel #7
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;
            }

            // Read the version information of the file format...
            string nodeText = reader.GetAttribute("version");

            if (!String.IsNullOrEmpty(nodeText))
            {
                _contentVersion = new Version(nodeText);
            }

            if (reader.IsEmptyElement)
            {
                return;
            }

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name.ToLower())
                    {
                    case "location":
                        if (!reader.IsEmptyElement)
                        {
                            _contentDir = BuildDirectoryPath.ReadLocation(reader);
                        }
                        break;

                    case "propertygroup":
                        this.ReadPropertyGroup(reader);
                        break;

                    case "referenceitems":
                        this.ReadItems(reader);
                        break;

                    case "contents":
                        this.ReadContents(reader);
                        break;

                    case "filters":
                        this.ReadFilters(reader);
                        break;
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, TagName,
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }
Beispiel #8
0
        protected override void OnReadXml(XmlReader reader)
        {
            if (reader.IsEmptyElement)
            {
                return;
            }

            if (String.Equals(reader.Name, "compilerFile",
                              StringComparison.OrdinalIgnoreCase))
            {
                _compilerFile = BuildFilePath.ReadLocation(reader);
            }
            else if (String.Equals(reader.Name, "compilerDirectory",
                                   StringComparison.OrdinalIgnoreCase))
            {
                _compilerDir = BuildDirectoryPath.ReadLocation(reader);
            }
            else if (String.Equals(reader.Name, "plugin",
                                   StringComparison.OrdinalIgnoreCase))
            {
                //<plugin flatToc="False">
                //    <title></title>
                //    <parents>
                //      <parent>ParentName</parent>
                //    </parents>
                //    <children>
                //      <child>ChildName</child>
                //    </children>
                //</plugin>

                if (_pluginParents == null)
                {
                    _pluginParents = new BuildList <string>();
                }
                if (_pluginChildren == null)
                {
                    _pluginChildren = new BuildList <string>();
                }

                string tempText = reader.GetAttribute("flatToc");
                if (!String.IsNullOrEmpty(tempText))
                {
                    _pluginTocFlat = Convert.ToBoolean(tempText);
                }

                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        switch (reader.Name.ToLower())
                        {
                        case "title":
                            _pluginTitle = reader.ReadString();
                            break;

                        case "parent":
                            tempText = reader.ReadString();
                            if (!String.IsNullOrEmpty(tempText))
                            {
                                _pluginParents.Add(tempText);
                            }
                            break;

                        case "child":
                            tempText = reader.ReadString();
                            if (!String.IsNullOrEmpty(tempText))
                            {
                                _pluginChildren.Add(tempText);
                            }
                            break;
                        }
                    }
                    else if (reader.NodeType == XmlNodeType.EndElement)
                    {
                        if (String.Equals(reader.Name, "plugin",
                                          StringComparison.OrdinalIgnoreCase))
                        {
                            break;
                        }
                    }
                }
            }
        }