西西軟件園多重安全檢測(cè)下載網(wǎng)站、值得信賴(lài)的軟件下載站!
軟件
軟件
文章
搜索

首頁(yè)編程開(kāi)發(fā)C#.NET → .NET文檔生成工具ADB使用圖文教程

.NET文檔生成工具ADB使用圖文教程

相關(guān)軟件相關(guān)文章發(fā)表評(píng)論 來(lái)源:西西整理時(shí)間:2012/6/28 9:11:04字體大小:A-A+

作者:佚名點(diǎn)擊:50次評(píng)論:0次標(biāo)簽: .NET

.NETv3.0 可再發(fā)行組件包
  • 類(lèi)型:編程輔助大。2.7M語(yǔ)言:中文 評(píng)分:1.8
  • 標(biāo)簽:
立即下載

ADB2.3使用指南

ADB2.3使用方法如下圖所示:

(1)主界面:

(2)批量選擇:

4.生成的文檔

(1)命名空間頁(yè)面:

2.類(lèi)型頁(yè)面:

3.成員頁(yè)面:

 

5.開(kāi)發(fā)自定義文檔生成器

ADB2.3支持加載用戶自定義的文檔生成器,用戶可根據(jù)自己的需求開(kāi)發(fā)文檔生成器,下面以開(kāi)發(fā)自定義文檔生成器MyBuilder為例,說(shuō)明如何開(kāi)發(fā)自定義文檔生成器:

⑴目標(biāo):

開(kāi)發(fā)一個(gè)自定義文檔生成器,該文檔生成器在ADB默認(rèn)文檔生成器基礎(chǔ)上擴(kuò)展以下功能:

a.在XML文檔注釋可以用插入圖片;

b.在類(lèi)型頁(yè)面和成員頁(yè)面中增加一個(gè)名稱(chēng)為“自定義節(jié)”的內(nèi)容節(jié)。

⑵開(kāi)發(fā)步驟

a.點(diǎn)擊菜單 工具->生成自定義文檔解決方案->擴(kuò)展XML文檔注釋?zhuān)趶棾龅膶?duì)話框中輸入文檔生成器名稱(chēng)

b.打開(kāi)工程中的MyBuilder.cs文件,輸入以下代碼

using System;
using System.Collections.Generic;
using System.Text;
using ADB.Factories;
using Microsoft.VisualBasic.FileIO;

namespace CustomBuilder
{
    /// 
    /// MyBuilder
    /// 
    public class MyBuilder : ADB.Factories.MSDNStyleCHMDocumentBuilder
    {
        static PageSection[] _memberPageSections, _typePageSections;

        public MyBuilder(IGetData data, IInteract interact)
            : base(data, interact)
        {
            //base.MemberPageSections為頁(yè)面原有的節(jié),將自定義節(jié)插入到頁(yè)面的最后
            _memberPageSections = new PageSection[base.MemberPageSections.Length + 1];
            base.MemberPageSections.CopyTo(_memberPageSections, 0);
            _memberPageSections[base.MemberPageSections.Length] = 
                new PageSection("自定義節(jié)", PageSectionType.FromXML, "CustomSection");

            //base.MemberPageSections為頁(yè)面原有的節(jié),將自定義節(jié)插入到頁(yè)面的最后
            _typePageSections = new PageSection[base.TypePageSections.Length + 1];
            base.TypePageSections.CopyTo(_typePageSections, 0);
            _typePageSections[base.TypePageSections.Length] = 
                new PageSection("自定義節(jié)", PageSectionType.FromXML, "CustomSection");
        }

        //重寫(xiě)基類(lèi)的MemberPageSections屬性
        public override PageSection[] MemberPageSections
        {
            get
            {
                return _memberPageSections;
            }
        }

        //重寫(xiě)基類(lèi)的TypePageSections屬性
        public override PageSection[] TypePageSections
        {
            get
            {
                return _typePageSections;
            }
        }

        protected override string GetTag(System.Xml.XmlElement elem, string xmlFile)
        {
            switch (elem.Name)
            {
            case "CustomSection":
                {
                    //生成"自定義節(jié)"的內(nèi)容
                    return GetInnerTags(elem, xmlFile);
                }
            case "image":
                {
                    StringBuilder tag = new StringBuilder();
                    string src = elem.GetAttribute("src");
                    if (!string.IsNullOrEmpty(src))
                    {
                        try
                        {
                            //將圖片拷貝到生成頁(yè)面的目錄中
                            //(通過(guò)屬性HtmlFileDirectory獲取保存頁(yè)面的目錄)
                            FileSystem.CopyFile(
                                xmlFile + "\\" + src, 
                                HtmlFileDirectory + "\\" + src, 
                                true
                            );
                        }
                        finally
                        {
                        }
                        //生成HTML標(biāo)志
                       tag.AppendFormat("<img src='{0}'/>", src);
                    }
                    return tag.ToString();
                }
            default:
                {
                    //其它標(biāo)志由基類(lèi)處理
                    return base.GetTag(elem, xmlFile);
                }
            }
        }
    }
}

c.點(diǎn)擊調(diào)試按鈕調(diào)試自定義文檔生成器 

⑶測(cè)試

由于測(cè)試的類(lèi)及其XML注釋?zhuān)?/p>

namespace ClassLibrary1
{
    /// 
    /// Class摘要
    /// 
    /// 
    /// 自定義的節(jié)
    /// 
<image src="1.gif"/>
/// public class Class1 { }}

用自定義文檔生成器MyBuilder生成的文檔

⑷讓ADB啟動(dòng)時(shí)自動(dòng)加載文檔生成器

在ADB目錄下新建目錄MyBuilder,并將MyBuilder.dll和MyBuilder.builder拷貝到該文件夾中

ADB2.3支持的注釋標(biāo)記

    相關(guān)評(píng)論

    閱讀本文后您有什么感想? 已有人給出評(píng)價(jià)!

    • 8 喜歡喜歡
    • 3 頂
    • 1 難過(guò)難過(guò)
    • 5 囧
    • 3 圍觀圍觀
    • 2 無(wú)聊無(wú)聊

    熱門(mén)評(píng)論

    最新評(píng)論

    發(fā)表評(píng)論 查看所有評(píng)論(0)

    昵稱(chēng):
    表情: 高興 可 汗 我不要 害羞 好 下下下 送花 屎 親親
    字?jǐn)?shù): 0/500 (您的評(píng)論需要經(jīng)過(guò)審核才能顯示)