⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plugin.cs

📁 CSharpDevelop:这是一个包含源代码的C#、VB.NET的编辑器。
💻 CS
字号:
//  Plugin.cs
//  Copyright (c) 2000 Mike Krueger
//
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

using System;
using System.Xml;
using System.Collections;
using System.Drawing;
using System.Windows.Forms;
using System.Reflection;
using System.Runtime.Serialization.Formatters.Binary;

using SharpDevelop.Gui;
using SharpDevelop.Tool.Function;
using SharpDevelop.Actions.Edit;

namespace SharpDevelop.Internal.Plugin {
	
	class Plugin 
	{
		string assemblyname;
		string name;
		string author;
		string version;
		string description = "";
		string copyright   = "";
		string url         = "";
		
		ArrayList  editactions = null;
		MenuItem[] menuitems   = null;
		
		Assembly assembly;
		MainWindow window;
		
		public ArrayList  EditActions {
			get {
				return editactions;
			}
		}
		
		public MenuItem[] MenuItems {
			get {
				return menuitems;
			}
		}
		public string AssemblyName {
			get {
				return assemblyname;
			}
		}
		
		public string Url {
			get {
				return url;
			}
		}
		public string Copyright {
			get {
				return copyright;
			}
		}
		
		public string Name {
			get {
				return name;
			}
		}
		
		public string Description {
			get {
				return description;
			}
		}
		
		public string Author {
			get {
				return author;
			}
		}
		
		public string Version {
			get {
				return version;
			}
		}
		
		public Plugin(MainWindow window, string directory, XmlElement el)
		{
			this.window = window;
			
			assemblyname = el["Plugin"].Attributes["Assembly"].InnerText;
			name         = el["Plugin"].Attributes["Name"].InnerText;
			version      = el["Plugin"].Attributes["Version"].InnerText;
			
			author      = el["Plugin"]["Author"].InnerText;
			copyright   = el["Plugin"]["Copyright"].InnerText;
			url         = el["Plugin"]["Url"].InnerText;
			description = el["Plugin"]["Description"].InnerText;
			
			if (directory[directory.Length -1] != '\\')
				directory += '\\';
			
			try {
				assembly = Assembly.LoadFrom(directory + assemblyname);
//				messagehandler = 
			} catch (Exception e) {
				throw new Exception("Can't load Assembly error :\n " + e.ToString());
			}
			
			
			if (el["MenuStructure"] != null) {
				try {
					menuitems = MenuCreator.CreateMenu(window, assembly, "", el["MenuStructure"]);
				} catch (Exception e) {
					throw new Exception("Can't create Menu error (check the XML) :\n " + e.ToString());
				}
			}
				
			if (el["EditorKeys"] != null) {
				try {
					editactions = EditActionLoader.GenEditActions(assembly, "", el["EditorKeys"]);
					foreach (object o in editactions) // insert keys into EditActionLoader
						EditActionLoader.EditAction.Add(o);
				} catch (Exception e) {
					throw new Exception("Can't create EditActions error (check the XML) :\n " + e.ToString());
				}
			}
		}
		
		public override string ToString()
		{
			return Name + " " + Version;
		}
		
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -