コード例 #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");

            if (!this.IsValid)
            {
                return;
            }

            writer.WriteStartElement(TagName);  // start - TagName
            writer.WriteAttributeString("name", this.Name);

            writer.WriteStartElement("propertyGroup");  // start - propertyGroup
            writer.WriteAttributeString("name", "General");
            writer.WritePropertyElement("Title", this.Title);
            writer.WritePropertyElement("SearchRecursive", _isRecursive);
            writer.WritePropertyElement("SearchPattern", _searchPattern);
            writer.WritePropertyElement("FrameworkType", _frameworkType.ToString());
            writer.WriteEndElement();              // end - propertyGroup

            writer.WriteStartElement("location");  // start - location
            _sourcePath.WriteXml(writer);
            writer.WriteEndElement();              // end - location

            writer.WriteStartElement("excludes");  // start - excludes
            if (_excludeSet != null)
            {
                foreach (string exclude in _excludeSet)
                {
                    writer.WriteStartElement("exclude");  // start - exclude
                    writer.WriteAttributeString("name", exclude);
                    writer.WriteEndElement();             // end - exclude
                }
            }
            writer.WriteEndElement();              // end - excludes

            // Write the user-defined contents...
            this.WriteContents(writer);

            // Write the filters...
            this.WriteFilters(writer);

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

            if (!this.IsValid)
            {
                return;
            }

            writer.WriteStartElement(TagName);  // start - TagName
            writer.WriteAttributeString("name", this.Name);

            writer.WriteStartElement("propertyGroup");  // start - propertyGroup
            writer.WriteAttributeString("name", "General");
            writer.WritePropertyElement("Title", this.Title);
            writer.WritePropertyElement("Id", _sourceId);
            writer.WritePropertyElement("LinkType", _linkType.ToString());
            writer.WritePropertyElement("FrameworkType", _frameworkType.ToString());
            writer.WriteEndElement();                   // end - propertyGroup

            // 3. The reference items defining the API content
            writer.WriteComment(" The reference items defining the API content ");
            writer.WriteStartElement("referenceItems");  // start - referenceItems
            for (int i = 0; i < _listItems.Count; i++)
            {
                ReferenceItem item = _listItems[i];
                if (item != null && !item.IsEmpty)
                {
                    item.WriteXml(writer);
                }
            }
            writer.WriteEndElement();                    // end - referenceItems

            // Write the user-defined contents...
            this.WriteContents(writer);

            // Write the filters...
            this.WriteFilters(writer);

            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);
            writer.WriteAttributeString("version", _contentVersion.ToString(2));

            // 1. The content directory, if not the same as the content file.
            writer.WriteComment(
                " 1. The content directory, if not the same as the content file. ");
            writer.WriteStartElement("location"); // start - location
            if (_contentDir != null &&
                !_contentDir.IsDirectoryOf(_contentFile))
            {
                _contentDir.WriteXml(writer);
            }
            writer.WriteEndElement();             // end - location

            // 2. The general content settings
            writer.WriteComment(" 2. The general content settings ");
            writer.WriteStartElement("propertyGroup");  // start - propertyGroup
            writer.WriteAttributeString("name", "General");

            writer.WritePropertyElement("Id", _contentId);
            writer.WritePropertyElement("FrameworkType", _frameworkType.ToString());

            writer.WriteEndElement();                   // end - propertyGroup

            // 3. The reference items defining the API content
            writer.WriteComment(" 3. The reference items defining the API content ");
            writer.WriteStartElement("referenceItems");  // start - referenceItems
            for (int i = 0; i < this.Count; i++)
            {
                ReferenceItem item = this[i];
                if (item != null && !item.IsEmpty)
                {
                    item.WriteXml(writer);
                }
            }
            writer.WriteEndElement();                    // end - referenceItems

            // 4. The various contents required for documentation
            writer.WriteComment(" 4. The various contents required for documentation ");
            writer.WriteStartElement("contents");  // start - contents

            if (_commentContent != null)
            {
                BuildFilePath filePath = _commentContent.ContentFile;
                writer.WriteStartElement("content");
                writer.WriteAttributeString("type", "Comments");
                if (filePath != null && filePath.IsValid)
                {
                    BuildPathResolver resolver = BuildPathResolver.Resolver;
                    Debug.Assert(resolver != null && resolver.Id == _contentId);

                    writer.WriteAttributeString("source",
                                                resolver.ResolveRelative(filePath));
                    _commentContent.Save();
                }
                else
                {
                    _commentContent.WriteXml(writer);
                }
                writer.WriteEndElement();
            }
            if (_dependencies != null)
            {
                writer.WriteStartElement("content");
                writer.WriteAttributeString("type", "Dependencies");
                _dependencies.WriteXml(writer);
                writer.WriteEndElement();
            }
            if (_tocContent != null)
            {
                writer.WriteStartElement("content");
                writer.WriteAttributeString("type", "HierarchicalToc");
                _tocContent.WriteXml(writer);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();              // end - contents

            // 5. The API/attribute filters associated with the documentations
            writer.WriteComment(" 5. The API/attribute filters associated with the documentations ");
            writer.WriteStartElement("filters");  // start - filters
            if (_typeFilters != null)
            {
                _typeFilters.WriteXml(writer);
            }
            if (_attributeFilters != null)
            {
                _attributeFilters.WriteXml(writer);
            }
            writer.WriteEndElement();             // end - filters

            writer.WriteEndElement();
        }