NDOC use brief manual

xiaoxiao2021-03-06  54

NDOC is a .NET code document generated tool, a bit like JDOC, but this is a tool under .NET.

NDOC uses the assembly and XML documents generated during the Visual Studio.net development process to generate some compiled HTML help documents such as Visual Studio.net and .NET FRMAEWORK online help documents.

It is an OpenSource project, in http://ndoc.sourceforge.net, you can download to Sourcecode.

Use very simple, such as creating a simple item to see what NDOC does do? Create a simple item called TestNDo, only one WindowForm, with a Button, click Show Information. Package the information of the information is the ShowMSG class, only one method showMessage.

The code is as follows: showmsg.cs

Using

?Tem;

Using

? System.windows.form;

Namespace

? testndoc

{???? /// ????? ///? SHOWMSG? Summary Description. ???? ///? Display the class of test information ???? /// ????? public? Class? Showmsg ???? {???????? public? ShowMSG () ?? ?????? {????????????? ?????????????????????? //? TODO:? Add constructor logic???? ????????? // ?????????} ????????? /// ?????????? ///? Test string ???? ???? /// ????????? private? string? teststr? =? null; ???????? # region? Display information in the information box public function ???? ???? /// ????????? ///? Display information in the information box ???????? /// ????????? / //?

Passing string parameters ???????? public? Void? ShowMessage (String? Msg) ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? MessageBox.show (AddStr (msg)); ????????} ??????????????????????? ///? Add a private function of several characters ??????????// ?????????//?

Transferring string parameters ???????? ///?

Return to the handled string ???????? protected? String? Addstr (string? Msg) ???????? {???????????? // returned character Strings ???????????? Return? "Stradd:"? ? Msg; ???????????????? / ?????????? ///? test? addok ????????? ///??

????????? ///?

???????? protected? string? addok (string? msg) ????????????? Return? "OK:" ? msg; ????????} ????}}

Form1.cs

Using

?Tem;

Using

?Tem.drawing;

Using

?Tem.collections;

Using

? System.componentmodel;

Using

? System.windows.form;

Using

?Tem.data;

Namespace

? testndoc

{???? /// ????? ///? Form1? Summary description. ???? /// ????? public? Class? testndoc?:? system.windows.forms.form ???? {???????? private? system.windows.Forms.Button? BTNSHOWMSG; ??????????? system.windows.Forms.Button? btnnosummary; ????????? /// ????????? ///? necessary designer variable. ????????? /// ????????? private? system.componentmodel.container? Components? =? null; ???????? public? testndoc ()??? ????? {????????????????????????? //? Windows? Form designer supports necessary ????? ??????? // ???????????? initializecomponent ();? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ? //? Todo :? InitializationComponent? Add any constructor code after call ????????????} ???????? // ????????? ///? Clean all the resources being used. ????????? /// ????????? protected? override? void? dispose (? bool? disposing?) ???????? {??????? ????? f (? disposing?) ???????????? {???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????? {???????????????????????????? ??????????} ????????????} ????????????????????? ???} ???????? windows? The code generated by the form designer ???????? /// ????????? ///? Designer supports the required Method? -? Don't use the code editor to modify ???????? ///? This method is.

????????? /// ???????????????????????? {???????????? THIS. BTNSHOWMSG? =? new? system.windows.Forms.Button (); ???????????? this.btnosummary? =? new? system.windows.Forms.Button (); ???? ???????? this.suspendlayout (); ????????????????????? btnshowmsg ????? ????????// ?????????????? this.btnshowmsg.location? =? new? system.drawing.point (72,? 104); ?????? ?????? this.btnshowmsg.name?=?"btnshowmsg";????????????this.btnshowmsg.size?=?new?system.drawing.size (128 ,?32 ); ???????????? this.btnshowmsg.tabindex? =? 0; ???????????? this.btnshowmsg.Text? =? "showMSG"; ?? ?????????? this.btnshowmsg.click? =? new? system.eventhandler (this.btnshowmsg_click; ????????????? // ?????? ????????//? btnnosummary ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? Drawing.point (72,? 160); ???????????? this.btnnosummary.Name?=?"btnnosummary";????????????this.btnnosummary. Size? =? New? System.drawing.size (128,? 32); ???????????? this.btnnosummary.tabindex? =? 1; ?????????? ?? this.btnnosummary.text? =? "no? summary"; ???????????? t His.btnnosummary.click? =?new?system.eventhandler (this.btnnosummary_click );??????????????????//? TestNDOC ??????????????????????????? this.AutoscaleBaseSize? =? new? system.drawing.size (6,? 14);?? ?????????? this.ClientSize? =? new? system.drawing.size (520,? 341); ???????????? this.Controls.Add (THIS. BTNNOSUMMARY); ???????????? this.controls.add (this.btnshowmsg); ????????????? this.name? =? "TestNDOC"; ?? ?????????? this.text? =? "testndoc"; ???????????? this.ResumeLayout (false); ????????} ?? ?????? # EndRegion ???????? /// ????????? ///? The primary entry point of the application.

????????? /// ????????? [stathread] ???????? static? Void? Main () ????????? {?? ?????????? Application.run (new? Testndoc ()); ??????????????????//? ????????? ///? Click Button display information ??????????? /// ????????? / //?

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? showMSG? SMSG? =? new? Showmsg (); ???????????? SMSG.SHOWMESSAGE ("Hello?"); ????????} ???????? private? void ? btnnosummary_click (Object? Sender,? system.eventargs? e) ?????????????????????? showMSG? SMSG? =? new? showmsg ();??? ????????? SMSG.SHOWMESSAGE ("NO? Summary? Click!"); ????????} ????}}

In order to generate a document using NDOC, there must be a compiled assembly and an exported XML file. To generate this XML file, you must generate an XML file in the project properties.

Options Fill in the file name, as shown below: Compile with a corresponding XML file: Open the XML file to see the following (Note: This XML file is not NDOC generated, but Visual Studio.net):

XML? Version = "1.0"?> ???? ???????? testNDOC

Name> ????

askEMBLY> ???? ???????? ????????????

????? ??????? Form1? Abstract. ????????????

Summary> ????????

MEMBER> ???????? ????????????????????????????????????????????????????????????????????????????????????????????????? ?? The required designer variable. ????????????

Summary> ????????

MEMBER> ???????? ????????????

????? ??????? Clean all the resources being used. ????????????

Summary> ????????

MEMBER> ???????? ????????????????????????????????????????????????????????????????????????????????????????? ?? Designer supports the method you need? -? Do not use the code editor to modify ?????????????????? ????????????

Summary> ????????

MEMBER> ???????? ????????????

?????????? ??The main entry point for the application. ???????????? summary> ????????

MEMBER> ????????

PARAM> ????????????

PARAM> ????????

MEMBER> ???????? ????????????

???????????? Summation description of Showmsg? ???????????? display the class of test information ????????????

Summary> ????????

MEMBER> ???????? ????????????????????????????????????????? ?? Test string ????????????

Summary> ????????

MEMBER> ???????? ????????????

????? ??????? display information in the information box ????????????

Summary> ???????????? Passing string parameters

PARAM> ????????

MEMBER> ???????? ????????????

????? ??????? Increase a private function of several characters ????????????

Summary> ???????????? Passing string parameters

Param> ???????????? Returns the processed string

Returns> ????????

MEMBER> ???????? ????????????

????? ??????? Test? addok ????????????

Summary> ????????????

PARAM> ????????????

Returns> ????????

MEMBER> ????

MEMBERS>

Doc>

Carefully compare the relationship between this XML file and source code can be found: 1. This XML file lists most methods, whether these methods are private, public or protected, even constructive; 2. part of the agion does not Included in the XML file; 3. The method without a comment is not included in the XML file, such as the constructor of ShowMSG and the BTNNOSummary_Click function portion in Form1.cs; Private system.componentmodel.container components = NULL and SHOWMSG class in the price string teststr = null; 5. The annotation of this approach has not been filed;

Summary: The following approach is included in the XML file.

????????

/// ?????????? ///? Add a private function of several characters ?????????// ?????????//?

Transferring string parameters ???????? ///?

Returns the handled string

So, how is the NDOC processing?

Install the NDOC running program, select the assembly, and the corresponding XML file, then set the relevant parameters of the generated document to support 6 types: htmlhelp2? Note that this document needs to be installed with Visual Studio Help Integration Kit, can be Microsoft website download; Javadoc ??? Similar to the Java API documentation, habits to see Java API more like Latex (alpha) lineArhtml (alpha) MSDNXML

Selecting different document types requires some different parameters, here choosing the HTMLHELP2 format. You can set the parameters, many of the default values, each of which can be seen below, this example selects the settings as shown below: Select Documentation-> Build on the menu to generate the needs help documentation .

At this point, a DOC directory is generated in the directory where the NDoc file is located, and all generated files are placed in this directory.

Open NDOCTEST.CHM, see the effects as follows: Here you can see the information generated is not only dependent on the XML files discussed above, and there is a lot of complete information, which should be read by the reflex mechanism. .

The comparison result can be seen: 1. The generated CHM only shows public and protected, and Private does not display, whether it is in XML, and the method of inherits will also be displayed in CHM; 3. Generate CHM Based on the assembly, the method of public and protected is displayed, while XML is mainly used as a reference, such as a common method in the project, there is no comment in the XML, but in CHM will also be displayed. Summary: NDOC generated CHM did not completely extract all of the comments in the project, but it is very useful as generating API documents.

Also, it is worth noting that the synchronization of NDOC seems to be some problems in use. For example, after the first generation, some modifications have made some modifications, and the modification of the comment can be updated synchronously, but some method changes are not directly reacted. For example, the public is changed to protected and does not directly react in the generated CHM.

?

====================

Some parameter settings in NDOC can control the generation display, as shown below:

转载请注明原文地址:https://www.9cbs.com/read-116473.html

New Post(0)