typeshortcutcollection.cs

来自「语音视频功能 里面实现了基本的QQ与语音对话」· CS 代码 · 共 72 行

CS
72
字号
using System;
using System.Xml;
namespace gowk.GXF
{
	/// <summary>
	/// TypeShortcutCollection 的摘要说明。
	/// </summary>
	public class TypeShortcutCollection:System.Collections.Hashtable
	{
		private XmlDocument doc;
		public TypeShortcutCollection(XmlDocument doc)
		{
			this.XmlDocument=doc;
		}
		public string this[string shortcup]
		{
			get{return (string)base[shortcup];}
			set
			{
				if(value==null || value==string.Empty)
				{
					this.Remove(shortcup);
				}
				else
					base[shortcup]=value;
			}
		}
		public Type GetType(string shortcup)
		{
			System.Diagnostics.Trace.WriteLine("get type"+shortcup);
			if(shortcup=="GListView")
			{
				System.Diagnostics.Trace.WriteLine("get type"+shortcup);
			}
			return Type.GetType(this[shortcup]);
		}
		public void Add(string shortcup,string fullType)
		{
			base.Add(shortcup,fullType);
		}
		public void Add(string shortcup,Type type)
		{
			base.Add(shortcup,type.FullName);
		}
		public void Add(XmlNode node)
		{
			foreach(XmlNode sub in node.ChildNodes)
			{
				if(sub.Name.ToLower()=="add")
				{
					string shortcup=sub.Attributes["shortcup"].Value;
					string type=sub.Attributes["type"].Value;
					base.Add(shortcup,type);
				}
			}
		}
		public XmlDocument XmlDocument
		{
			get{return this.XmlDocument;}
			set
			{
				if(value==null)return;
				this.Clear();
				this.doc=value;
				XmlNode node=doc.SelectSingleNode(@"descendant::shortcuts");
				if(node!=null)
					this.Add(node);
			}
		}
	}
}

⌨️ 快捷键说明

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