📄 editactionloader.cs
字号:
// EditActionLoader.cs
// Copyright (C) 2001 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.IO;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Xml;
using System.Windows.Forms;
namespace SharpDevelop.Actions.Edit {
public class EditActionLoader
{
static ArrayList editactions = null;
public static ArrayList EditAction {
get {
Debug.Assert(editactions != null, "SharpDevelop.Action.EditAction.EditActionLoader : editactions == null");
return editactions;
}
}
public static ArrayList GenEditActions(Assembly asm, string nspace, XmlElement root)
{
XmlNodeList nodes = root.GetElementsByTagName("ACTION");
ArrayList actions = new ArrayList();
for (int i = 0; i < nodes.Count; ++i) {
XmlElement el = (XmlElement)nodes[i];
string[] keydef = el.Attributes["KEYS"].InnerText.Split(new char[] { ',' });
Keys[] keys = new Keys[keydef.Length];
for (int j = 0; j < keydef.Length; ++j) {
string[] keydescr = keydef[j].Split(new char[] { '|' });
Keys key = (Keys)((Keys.Space.GetType()).InvokeMember(keydescr[0], BindingFlags.GetField, null, Keys.Space, new object[0]));
for (int k = 1; k < keydescr.Length; ++k)
key |= (Keys)((Keys.Space.GetType()).InvokeMember(keydescr[k], BindingFlags.GetField, null, Keys.Space, new object[0]));
keys[j] = key;
}
string objname = nspace + el.Attributes["EVENT"].InnerText;
ISdEditAction action = (ISdEditAction)asm.CreateInstance(objname);
if (action == null) {
MessageBox.Show("Can't create EditAction " + el.Attributes["EVENT"].InnerText, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
actions.Add(new EditAction(keys, action));
}
return actions;
}
/// <summary>
/// This method loads the external tools from a XML based
/// configuration file.
/// </summary>
public static void LoadEditActions()
{
XmlDocument editkeydefinition = new XmlDocument();
editkeydefinition.Load(Application.StartupPath + "\\options\\EditActions.xml");
editactions = GenEditActions(Assembly.GetCallingAssembly(), "SharpDevelop.Actions.Edit.", editkeydefinition.DocumentElement);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -