sharpdevelop中如何加载addin文件

Sharpdevelop中的addin文件是一个xml文件,SD的作者在其中设置了一些特定的规则,来描述菜单,工具栏,视图的创建及dll的加载,
作者创建了一个addin类(代码存在于addin.cs)来完成对addin文件的操作
addin文件其中包含了,作者,版本,描述,版权等等各个方面的信息,
 addin的一个例子
 
<AddIn name        = "SharpDevelop Core"

       author      
= "Mike Krueger"      
       description 
= "NCvs core module"

       version     
= "1.0.0">

    
<Runtime>
        
<Import assembly="SharpDevelop.Base.dll"/>
        
<Import assembly="CSharpParser.dll"/>
    
</Runtime>  
</AddIn>
//简化的对addin文件的操作类
using System;
using
 System.Collections.Generic;
using
 System.Text;
using
 System.Xml;
using
 System.IO;
using
 System.Windows.Forms;
using
 System.Diagnostics;


namespace
 CSLearn
{
    
/// <summary>

    
/// 读取xml文本的一个类
    
/// </summary>

    public class cxyxmlreader
    { 
        
public cxyxmlreader(string
 tpxmfile)
        {
            Debug.Assert(
string.IsNullOrEmpty(xmlfile), "xml文件不能为空"
);
            
this.xmlfile =
 tpxmfile;
            Initlization();
        }

        
/// <summary>

        
/// 加载xml文件 初始化变量,
        
/// </summary>

        private void Initlization()
        {

            System.Diagnostics.Debug.Assert(File.Exists(xmlfile), 
"配置文件不存在"
);
            XmlDocument doc 
= new
 XmlDocument();
            doc.Load(xmlfile);


            
try

            {
                
//selectsinglenode中的参数注意大小写
                version = doc.SelectSingleNode("AddIn/@version").Value;
                author 
= doc.SelectSingleNode("AddIn/@author"
).Value;
                description 
= doc.SelectSingleNode("AddIn/@description"
).Value;
                version 
= doc.SelectSingleNode("AddIn/@version"
).Value;

            }
            
catch
 (Exception ex)
            {
                
//todo:处理异常

                throw ex;
            }
             
        }


        
string
 xmlfile,author,description,version;
        
/// <summary>

        
/// 配置文件名
        
/// </summary>

        public String XmlFileName  {  set { xmlfile = value; }  }
        
/// <summary>

        
/// 作者
        
/// </summary>

        public string Author { get { return author; }  }
        
/// <summary>

        
/// addin描述
        
/// </summary>

        public string Description { get { return description; } }
        
/// <summary>

        
/// 版本信息
        
/// </summary>

        public string Version { get { return version; } }
       
           
       
    }

    
}
//类的使用方法

 cxyxmlreader reader = new cxyxmlreader("xmlfile1.xml");
MessageBox.Show(reader.Version);
原文地址:https://www.cnblogs.com/sunbingzibo/p/970926.html