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

📄 pluginmanager.cs

📁 CSharpDevelop:这是一个包含源代码的C#、VB.NET的编辑器。
💻 CS
字号:
//  PluginManager.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.Collections;
using System.IO;
using System.Windows.Forms;
using System.Xml;


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

namespace SharpDevelop.Internal.Plugin {
	
	public class PluginManager
	{
		MainWindow window    = null;
		ArrayList  menuitems = new ArrayList();
		ArrayList  plugins   = new ArrayList();
		
		public PluginManager(MainWindow window)
		{
			this.window = window;
			try {
				FileUtility.SearchDirectory(Application.StartupPath + "\\plugins", "*.xml", new FileSearchDelegate(LoadPlugin));
			} catch (Exception e) { // TODO
				MessageBox.Show("can't load plugins, check if the plugin directory exists.\n" + e.ToString(), "Can't load plugins",
								MessageBoxButtons.OK, MessageBoxIcon.Warning);
				plugins = new ArrayList();
			}
		}
		
		void LoadPlugin(string filename)
		{
			XmlDocument doc = new XmlDocument();
			doc.Load(filename);
			try {
				plugins.Add(new Plugin(window, Path.GetDirectoryName(filename), doc.DocumentElement));
			} catch (Exception e) {
				MessageBox.Show("can't load plugin " + doc.DocumentElement.Attributes["NAME"].InnerText + "\n\nexception thrown : \n" + e.ToString(), "Can't load plugin",
								MessageBoxButtons.OK, MessageBoxIcon.Warning);
			}
		}
		
		public ArrayList PlugIns {
			get {
				return plugins;
			}
		}
		
		public ArrayList MenuItems {
			get {
				ArrayList items = new ArrayList();
				for (int i = 0; i < plugins.Count; ++i) {
					MenuItem[] menuitems = ((Plugin)plugins[i]).MenuItems;
					foreach (MenuItem item in menuitems)
						items.Add(item);
				}
				return items;
			}
		}
	}
}

⌨️ 快捷键说明

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