ADB - Documentation Compiler for Managed Class Libraries






4.60/5 (4 votes)
ADB produces MSDN style documentation by reflecting and integrating XML Documentation Comments.
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:
- Build the solution and click the Debug button to start ADB to debug the custom builder:
- Testing:
- Let ADB load MyBuilder when starting:
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)
{
//insert a custom section named "Custom Section" into member pages
_memberPageSections = new PageSection[base.MemberPageSections.Length + 1];
base.MemberPageSections.CopyTo(_memberPageSections, 0);
_memberPageSections[base.MemberPageSections.Length] =
new PageSection("Custom Section",
PageSectionType.FromXML, "CustomSection");
//insert a custom section named "Custom Section" into type pages
_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":
{
//Generate content of CustomSection tag
//The content will display in the "Custom Section"
//Section in member pages and type pages
return GetInnerTags(elem, xmlFile);
}
case "image":
{
StringBuilder tag = new StringBuilder();
string src = elem.GetAttribute("src");
if (!string.IsNullOrEmpty(src))
{
try
{
//Copy the image to the directory that cache page files.
FileSystem.CopyFile(xmlFile + "\\" +
src, HtmlFileDirectory +
"\\" + src, true);
}
finally
{
}
//Generate HTML tag
tag.AppendFormat("<img src='{0}'/>", src);
}
return tag.ToString();
}
default:
{
return base.GetTag(elem, xmlFile);
}
}
}
}
}
The following is the class and its comments for testing:
namespace ClassLibrary1
{
/// <summary>
/// Comments for Class1
/// </summary>
/// <CustomSection>
/// <image src='1.gif'/>
/// </CustomSection>
public class Class1
{
}
}
The document generated by MyBuilder:
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):