📄 externaltool.cs
字号:
// ExternalTool.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.Reflection;
using System.Collections;
using System.Drawing;
using System.IO;
using System.ComponentModel;
using System.Windows.Forms;
using System.Xml;
using System.Diagnostics;
namespace SharpDevelop.Internal.ExternalTool {
/// <summary>
/// This class describes an external tool, which is a external program
/// that can be launched from the toolmenu inside Sharp Develop.
/// </summary>
public class ExternalTool
{
string menucommand = "New Tool";
string command = "";
string arguments = "";
string initialdirectory = "";
bool promtforarguments = false;
public string MenuCommand {
get {
return menucommand;
}
set {
menucommand = value;
Debug.Assert(menucommand != null, "SharpDevelop.Internal.ExternalTool.ExternalTool : string MenuCommand == null");
}
}
public string Command {
get {
return command;
}
set {
command = value;
Debug.Assert(command != null, "SharpDevelop.Internal.ExternalTool.ExternalTool : string Command == null");
}
}
public string Arguments {
get {
return arguments;
}
set {
arguments = value;
Debug.Assert(arguments != null, "SharpDevelop.Internal.ExternalTool.ExternalTool : string Arguments == null");
}
}
public string InitialDirectory {
get {
return initialdirectory;
}
set {
initialdirectory = value;
Debug.Assert(initialdirectory != null, "SharpDevelop.Internal.ExternalTool.ExternalTool : string InitialDirectory == null");
}
}
public bool PromtForArguments {
get {
return promtforarguments;
}
set {
promtforarguments = value;
}
}
public ExternalTool()
{}
public ExternalTool(XmlElement el)
{
if (el == null)
throw new ArgumentNullException("ExternalTool(XmlElement el) : el can't be null");
if (el["INITIALDIRECTORY"] == null ||
el["ARGUMENTS"] == null ||
el["COMMAND"] == null ||
el["MENUCOMMAND"] == null ||
el["PROMPTFORARGUMENTS"] == null)
throw new Exception("ExternalTool(XmlElement el) : INITIALDIRECTORY and ARGUMENTS and COMMAND and MENUCOMMAND and PROMPTFORARGUMENTS attributes must exist.(check the ExternalTool XML)");
InitialDirectory = el["INITIALDIRECTORY"].InnerText;
Arguments = el["ARGUMENTS"].InnerText;
Command = el["COMMAND"].InnerText;
MenuCommand = el["MENUCOMMAND"].InnerText;
PromtForArguments = Boolean.Parse(el["PROMPTFORARGUMENTS"].InnerText);
}
public override string ToString()
{
return menucommand;
}
public XmlElement ToXmlElement(XmlDocument doc)
{
if (doc == null)
throw new ArgumentNullException("ExternalTool.ToXmlElement(XmlDocument doc) : doc can't be null");
XmlElement el = doc.CreateElement("TOOL");
XmlElement x = doc.CreateElement("INITIALDIRECTORY");
x.InnerText = InitialDirectory;
el.AppendChild(x);
x = doc.CreateElement("ARGUMENTS");
x.InnerText = Arguments;
el.AppendChild(x);
x = doc.CreateElement("COMMAND");
x.InnerText = Command;
el.AppendChild(x);
x = doc.CreateElement("MENUCOMMAND");
x.InnerText = MenuCommand;
el.AppendChild(x);
x = doc.CreateElement("PROMPTFORARGUMENTS");
x.InnerText = PromtForArguments.ToString();
el.AppendChild(x);
return el;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -