public ReferenceGroup(string groupName, string groupId) : base(groupName, groupId) { _versionType = ReferenceVersionType.None; _rootTitle = "Programmer's Reference"; _rootTopicId = String.Empty; _topicContent = new ReferenceContent(); }
/// <summary> /// Initializes a new instance of the <see cref="ReferenceGroup"/> class with /// parameters copied from the specified argument, a copy constructor. /// </summary> /// <param name="source"> /// An instance of the <see cref="ReferenceGroup"/> class specifying the initial /// properties and states for this newly created instance. /// </param> /// <exception cref="ArgumentNullException"> /// If the <paramref name="source"/> is <see langword="null"/>. /// </exception> public ReferenceGroup(ReferenceGroup source) : base(source) { _versionType = source._versionType; _xmlnsForXaml = source._xmlnsForXaml; _rootTitle = source._rootTitle; _rootTopicId = source._rootTopicId; _topicSource = source._topicSource; _topicContent = source._topicContent; _rootTopicId = source._rootTopicId; }
/// <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); }
private static void TestMain(BuildDocumenter documenter, TestOptions options, ReferenceEngineSettings engineSettings) { // Decide which version information to use... ReferenceVersionType versionType = ReferenceVersionType.Advanced; string libraryDir = Path.Combine(sampleDir, @"SampleLibrary\"); string outputDir = Path.Combine(libraryDir, @"Output\"); string projectDoc = Path.Combine(outputDir, "Project.xml"); ReferenceGroup apiGroup = new ReferenceGroup( "Test API References", TestGroupIds.TestLibGroupId); apiGroup.RunningHeaderText = "Sandcastle Helpers: Test API Reference"; if (engineSettings != null && engineSettings.RootNamespaceContainer) { apiGroup.RootNamespaceTitle = "SampleLibrary Test References"; } ReferenceContent apiContent = apiGroup.Content; apiContent.FrameworkType = BuildFrameworkType.Framework35; apiContent.AddItem(projectDoc, null); apiContent.AddItem(Path.Combine(outputDir, "TestLibrary.xml"), Path.Combine(outputDir, "TestLibrary.dll")); apiGroup.AddSnippet(new CodeSnippetContent(Path.Combine( libraryDir, "CodeSnippetSample.snippets"))); string helpTestDir = Path.Combine(sampleDir, @"SampleTopics\"); string mediaLinks = Path.Combine(helpTestDir, "MediaContent.media"); apiGroup.AddMedia(new MediaContent(mediaLinks, Path.Combine(helpTestDir, "Media"))); // Create and add an API filter... ReferenceNamespaceFilter namespaceFilter = new ReferenceNamespaceFilter("TestLibrary", true); namespaceFilter.Add(new ReferenceTypeFilter("Point3D", false, false)); apiContent.TypeFilters.Add(namespaceFilter); documenter.AddGroup(apiGroup); ReferenceVersionInfo versionInfo = null; if (versionType == ReferenceVersionType.Advanced) { libraryDir = Path.Combine(sampleDir, @"SampleLibraryVersion\"); outputDir = Path.Combine(libraryDir, @"Output\"); apiContent = new ReferenceContent(); apiContent.FrameworkType = BuildFrameworkType.Framework20; apiContent.AddItem(Path.Combine(outputDir, "TestLibrary.xml"), Path.Combine(outputDir, "TestLibrary.dll")); versionInfo = new ReferenceVersionInfo(); versionInfo.PlatformFilters = true; //versionInfo.PlatformId = "netfw"; versionInfo.PlatformTitle = ".NET Framework"; //versionInfo.VersionId = "netfw20"; versionInfo.VersionLabel = "2.0"; ReferenceVersionSource source = new ReferenceVersionSource(); //source.VersionId = "netfw10"; source.VersionLabel = "1.0"; source.Content = apiContent; versionInfo.AddSource(source); apiGroup.VersionType = versionType; apiGroup.VersionInfo = versionInfo; } if (versionType == ReferenceVersionType.Advanced && versionInfo != null) { libraryDir = Path.Combine(sampleDir, @"SampleLibrarySilverlight\"); outputDir = Path.Combine(libraryDir, @"Output\"); apiContent = new ReferenceContent(); apiContent.FrameworkType = BuildFrameworkType.Silverlight40; apiContent.AddItem(Path.Combine(outputDir, "TestLibrary.xml"), Path.Combine(outputDir, "TestLibrary.dll")); ReferenceVersionRelated relatedVersion = new ReferenceVersionRelated(); relatedVersion.PlatformId = "silverlight_mobile"; //relatedVersion.PlatformTitle = "Silverlight for Windows Phone"; ReferenceVersionSource source = new ReferenceVersionSource(); source.VersionId = "silverlight_mobile_v1"; //source.VersionLabel = "Windows Phone OS 7.0"; source.Content = apiContent; relatedVersion.Add(source); versionInfo.AddRelated(relatedVersion); } }
/// <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); } 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; if (versionType != ReferenceVersionType.Advanced) { return(false); } ReferenceVersionInfo versionInfo = refGroup.VersionInfo; if (versionInfo == null || versionInfo.IsEmpty || !versionInfo.PlatformFilters) { return(false); } IList <ReferenceVersions> platforms = theContext.Versions; if (platforms == null || platforms.Count == 0) { return(false); } //<component type="Microsoft.Ddue.Tools.PlatformsComponent" assembly="%DXROOT%\ProductionTools\BuildComponents.dll"> // <!-- The order of filter files in this config determines the order of platforms in the output. --> // <filter files=".\SupportFiles\Platforms\WinVista.xml"/> // <filter files=".\SupportFiles\Platforms\WinXP.xml"/> // <filter files=".\SupportFiles\Platforms\WinXpMediaCenter.xml"/> // <filter files=".\SupportFiles\Platforms\WinXPPro64.xml"/> // <filter files=".\SupportFiles\Platforms\WinXPSE.xml"/> // <filter files=".\SupportFiles\Platforms\WinSvr2003.xml"/> // <filter files=".\SupportFiles\Platforms\WinSvr2000.xml"/> // <filter files=".\SupportFiles\Platforms\WinME.xml"/> // <filter files=".\SupportFiles\Platforms\Win98.xml"/> // <filter files=".\SupportFiles\Platforms\WindowsCE.xml"/> // <filter files=".\SupportFiles\Platforms\SmartPhone.xml"/> // <filter files=".\SupportFiles\Platforms\PocketPC.xml"/> // <filter files=".\SupportFiles\Platforms\Xbox360.xml"/> //</component> writer.WriteComment(" The order of filter files in this config determines the order of platforms in the output. "); for (int i = 0; i < platforms.Count; i++) { ReferenceVersions platform = platforms[i]; string platformFile = platform.PlatformFile; if (String.IsNullOrEmpty(platformFile) || !File.Exists(platformFile)) { continue; } writer.WriteStartElement("filter"); //start: filter writer.WriteAttributeString("files", platformFile); writer.WriteEndElement(); //end: filter } return(true); }
protected override void OnReadPropertyGroupXml(XmlReader reader) { string startElement = reader.Name; Debug.Assert(String.Equals(startElement, "propertyGroup")); Debug.Assert(String.Equals(reader.GetAttribute("name"), "Reference")); if (reader.IsEmptyElement) { return; } while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { if (String.Equals(reader.Name, "property", StringComparison.OrdinalIgnoreCase)) { string tempText = null; switch (reader.GetAttribute("name").ToLower()) { case "xmlnsforxaml": tempText = reader.ReadString(); if (!String.IsNullOrEmpty(tempText)) { _xmlnsForXaml = Convert.ToBoolean(tempText); } break; case "roottitle": _rootTitle = reader.ReadString(); break; case "roottopicid": _rootTopicId = reader.ReadString(); break; case "versiontype": tempText = reader.ReadString(); if (!String.IsNullOrEmpty(tempText)) { _versionType = (ReferenceVersionType)Enum.Parse( typeof(ReferenceVersionType), tempText, true); } break; default: // Should normally not reach here... throw new NotImplementedException(reader.GetAttribute("name")); } } } else if (reader.NodeType == XmlNodeType.EndElement) { if (String.Equals(reader.Name, startElement, StringComparison.OrdinalIgnoreCase)) { break; } } } }