Dwell.Net CodeDoc
CodeDoc API - Overview

This page provides a general overview of the CodeDoc API (application programming interface), which implements most of the core functionality of CodeDoc.exe. You can call the CodeDoc API from your applications, though for most purposes you'll likely find that using the CodeDoc.exe console application is sufficient.

For detailed API information, consult the CodeDoc API Reference.

Using the CodeDoc API

The CodeDoc.exe console application is responsible for reading and interpreting CodeDoc XML project files. It then makes calls to the CodeDoc API (implemented by CodeDocApi.dll and CodeDocRenderer.dll), to perform most of the work of processing C# source code files. (Note that documentation browser generation is performed by CodeDoc.exe, not the CodeDoc API.)

The following diagram gives a general overview of the flow of data through CodeDoc, and the key data types involved. (Tip: if you click on a hyperlink to an API reference topic, you can click in the left pane of the documentation browser to locate the topic in the table of contents.)

The general pattern for using the CodeDoc API is as follows:

  1. Create an instance of DocumentationSet, which represents one documentation set instance—parallel to a single CodeDoc XML project file (though the API itself has no knowledge of project files).
  2. Hook up to various events, such as ParsingError and AddedSourceFile. In the latter case, each time a source file is added the application should enumerate the warnings from adding that source file (see SourceFile.Warnings). See DocumentationSet for a complete list of events.
  3. Call various methods of DocumentationSet to specify options for processing source files; for example, DocumentationSet.DefineSymbol is analogous to the CodeDoc XML project file element <DefinedSymbols>.
  4. Call DocumentationSet.AddSourceFile and DocumentationSet.AddSourceFilesInDirectoryTree to load and parse C# source files.
  5. Iterate through the Topic objects of the DocumentationSet, and set Topic.IsDocumented to true for each topic you want included in the documentation set.
  6. If desired, call DefaultTopicRenderer.GenerateDocHtml to generate documentation pages.
  7. If desired, call DefaultSourceFileRenderer.GenerateCodeHtml to generate formatted source code pages.

See App.cs source code for examples of how to use the CodeDoc API.

For More Information
Introduction to CodeDoc
CodeDoc User Guide
CodeDoc Project File Reference
CodeDoc API - Reference
CodeDoc Source Code