Ejemplo n.º 1
0
        protected override void OnWritePropertyGroupXml(XmlWriter writer)
        {
            writer.WriteStartElement("propertyGroup");  // start - propertyGroup
            writer.WriteAttributeString("name", "Reference");

            writer.WritePropertyElement("XmlnsForXaml", _xmlnsForXaml);
            writer.WritePropertyElement("RootTitle", _rootTitle);
            writer.WritePropertyElement("RootTopicId", _rootTopicId);
            writer.WritePropertyElement("VersionType", _versionType.ToString());

            writer.WriteEndElement();                   // end - propertyGroup
        }
        /// <summary>
        /// The creates the configuration information or settings required by the
        /// target component for the build process.
        /// </summary>
        /// <param name="group">
        /// A build group, <see cref="BuildGroup"/>, representing the documentation
        /// target for configuration.
        /// </param>
        /// <param name="writer">
        /// An <see cref="XmlWriter"/> object used to create one or more new
        /// child nodes at the end of the list of child nodes of the current node.
        /// </param>
        /// <returns>
        /// Returns <see langword="true"/> for a successful configuration;
        /// otherwise, it returns <see langword="false"/>.
        /// </returns>
        /// <remarks>
        /// The <see cref="XmlWriter"/> writer passed to this configuration object
        /// may be passed on to other configuration objects, so do not close or
        /// dispose it.
        /// </remarks>
        public override bool Configure(BuildGroup group, XmlWriter writer)
        {
            BuildExceptions.NotNull(group, "group");
            BuildExceptions.NotNull(writer, "writer");

            if (!this.Enabled || !this.IsInitialized)
            {
                return(false);
            }

            Debug.Assert(_settings != null, "The settings object is required.");
            if (_settings == null || _context == null)
            {
                return(false);
            }

            ReferenceGroup refGroup = group as ReferenceGroup;

            if (refGroup == null)
            {
                return(false);
            }

            ReferenceGroupContext theContext = _context.GroupContexts[group.Id]
                                               as ReferenceGroupContext;

            if (theContext == null)
            {
                throw new BuildException(
                          "The group context is not provided, and it is required by the build system.");
            }

            ReferenceVersionType versionType = refGroup.VersionType;

            bool isBasicVersion = versionType == ReferenceVersionType.Assembly ||
                                  versionType == ReferenceVersionType.AssemblyAndFile;

            writer.WriteStartElement("versionInfo");  //start: versionInfo
            writer.WriteAttributeString("enabled", isBasicVersion.ToString());
            writer.WriteAttributeString("type", versionType.ToString());
            writer.WriteAttributeString("sourceFile",
                                        Path.Combine(_context.WorkingDirectory, theContext["$ReflectionFile"]));
            writer.WriteEndElement();                 //end: versionInfo

            //NOTE: This is now handled by the ReferenceCommentVisitor...
            //if (_settings.BuildConceptual)
            //{
            //    IList<BuildGroupContext> groupContexts = _context.GroupContexts;
            //    for (int i = 0; i < groupContexts.Count; i++)
            //    {
            //        BuildGroupContext groupContext = groupContexts[i];
            //        if (groupContext.GroupType == BuildGroupType.Conceptual)
            //        {
            //            writer.WriteStartElement("conceptualLinks");  //start: conceptualLinks
            //            writer.WriteAttributeString("enabled", "true");
            //            writer.WriteEndElement();                     //end: conceptualLinks
            //            break;
            //        }
            //    }
            //}

            return(true);
        }