📄 codetemplate.cs
字号:
// CodeTemplate.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.Diagnostics;
namespace SharpDevelop.Internal.Templates {
/// <summary>
/// This class reperesents a single Code Template
/// </summary>
public class CodeTemplate
{
string shortcut = "";
string description = "";
string text = "";
public string Shortcut {
get {
return shortcut;
}
set {
shortcut = value;
Debug.Assert(shortcut != null, "SharpDevelop.Internal.Template : string Shortcut == null");
}
}
public string Description {
get {
return description;
}
set {
description = value;
Debug.Assert(description != null, "SharpDevelop.Internal.Template : string Description == null");
}
}
public string Text {
get {
return text;
}
set {
text = value;
Debug.Assert(text != null, "SharpDevelop.Internal.Template : string Text == null");
}
}
public CodeTemplate()
{}
public CodeTemplate(string shortcut, string description, string text)
{
this.shortcut = shortcut;
this.description = description;
this.text = text;
}
public CodeTemplate(XmlElement el)
{
if (el == null)
throw new ArgumentNullException("CodeTemplate(XmlElement el) : el can't be null");
if (el.Attributes["SHORTCUT"] == null |
el.Attributes["DESCRIPTION"] == null)
throw new Exception("CodeTemplate(XmlElement el) : SHORTCUT and DESCRIPTION attributes must exist (check the CodeTemplate XML)");
Shortcut = el.Attributes["SHORTCUT"].InnerText;
Description = el.Attributes["DESCRIPTION"].InnerText;
Text = el.InnerText;
}
public XmlElement ToXmlElement(XmlDocument doc)
{
if (doc == null)
throw new ArgumentNullException("CodeTemplate.ToXmlElement(XmlDocument doc) : doc can't be null");
XmlElement el = doc.CreateElement("TEMPLATE");
XmlAttribute shortcutattr = doc.CreateAttribute("SHORTCUT");
shortcutattr.InnerText = Shortcut;
XmlAttribute descriptionattr = doc.CreateAttribute("DESCRIPTION");
descriptionattr.InnerText = Description;
el.Attributes.Append(shortcutattr);
el.Attributes.Append(descriptionattr);
el.InnerText = Text;
return el;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -