Introduction
ADB produces MSDN style documentation by reflecting and integrating XML documentation comments. ADB has the following key features:
- Merge multiple assemblies in a document.
- Auto search XML documentation comment file of assemblies and their dependent assemblies.
- Extent XML documentation comments tags according to your needs.
- Develop custom document builder according to your needs.
Instructions
Develop Custom Document Builder
Extent XML Documentation Comments Tag
ADB supports developing a custom document builder according to your needs. The following is an example developing a custom document builder named “MyBuilder” that extends the following features:
- Extend an
<image>
tag for inserting images to the document. - Insert a section named “Custom Section” to the type page and member page.
Steps:
- Click then menu Tool->Generate Custom Builder Solution->Extent XML Comments Tag, then input the information of the custom builder:
- Click “OK”, ADB will generate a solution for you and open the solution.
- Open the “MyBuilder.cs” file and input the following code:
using System;
using System.Collections.Generic;
using System.Text;
using ADB.Factories;
using Microsoft.VisualBasic.FileIO;
namespace ADB.Builders
{
public class MyBuilder : ADB.Factories.MSDNStyleCHMDocumentBuilder
{
static PageSection[] _memberPageSections, _typePageSections;
public MyBuilder(IGetData data, IInteract interact)
: base(data, interact)
{
_memberPageSections = new PageSection[base.MemberPageSections.Length + 1];
base.MemberPageSections.CopyTo(_memberPageSections, 0);
_memberPageSections[base.MemberPageSections.Length] =
new PageSection("Custom Section",
PageSectionType.FromXML, "CustomSection");
_typePageSections = new PageSection[base.TypePageSections.Length + 1];
base.TypePageSections.CopyTo(_typePageSections, 0);
_typePageSections[base.TypePageSections.Length] =
new PageSection("Custom Section",
PageSectionType.FromXML, "CustomSection");
}
public override PageSection[] MemberPageSections
{
get
{
return _memberPageSections;
}
}
public override PageSection[] TypePageSections
{
get
{
return _typePageSections;
}
}
protected override string GetTag(System.Xml.XmlElement elem, string xmlFile)
{
switch (elem.Name)
{
case "CustomSection":
{
return GetInnerTags(elem, xmlFile);
}
case "image":
{
StringBuilder tag = new StringBuilder();
string src = elem.GetAttribute("src");
if (!string.IsNullOrEmpty(src))
{
try
{
FileSystem.CopyFile(xmlFile + "\\" +
src, HtmlFileDirectory +
"\\" + src, true);
}
finally
{
}
tag.AppendFormat("<img src='{0}'/>", src);
}
return tag.ToString();
}
default:
{
return base.GetTag(elem, xmlFile);
}
}
}
}
}
- Build the solution and click the Debug button to start ADB to debug the custom builder:
- Testing:
The following is the class and its comments for testing:
namespace ClassLibrary1
{
public class Class1
{
}
}
The document generated by MyBuilder:
- Let ADB load MyBuilder when starting:
Open the base directory of ADB and create a folder named “MyBuilder” in “builders”, then copy “MyBuilder.dll” and “MyBuilder.builder” to the “MyBuilder” directory (as shown):
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.