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

📄 parserstate.cs

📁 语音视频功能 里面实现了基本的QQ与语音对话
💻 CS
字号:
using System;
using System.Xml;
using System.Reflection;
using System.Diagnostics;
using System.ComponentModel;
using System.Collections;
namespace gowk.GXF
{
	internal class ParserState
	{
		
		private object parent;
		private object tag;
		private object instance;
		MemberInitializer mi;
		public MemberInitializer MemberInitializer
		{
			get{return this.mi;}
			set{this.mi=value;}
		}
		public object Tag
		{
			get{return this.tag;}set{this.tag=value;}
		}

		public object Parent
		{
			get	
			{
				return this.parent;
			}
			set	
			{
				this.parent=value;
			}
		}
		public object Instance
		{
			get{return this.instance;}
			set{this.instance=value;}
		}

		public ParserState()
		{
		}
	}
	internal class MemberInitializer
	{
		System.Collections.Hashtable hsfi;
		System.Collections.Hashtable hspi;
		public object Target;
		public MemberInitializer(object target)
		{
			this.Target=target;
			this.hsfi=new System.Collections.Hashtable();
			this.hspi=new System.Collections.Hashtable();
			Type t=target.GetType();
			foreach(System.Reflection.FieldInfo fi in t.GetFields(BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance|BindingFlags.SetField|BindingFlags.FlattenHierarchy))
			{
				this.hsfi.Add(fi.Name,fi);
			}
			foreach(System.Reflection.PropertyInfo pi in t.GetProperties(BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance|BindingFlags.SetProperty|BindingFlags.FlattenHierarchy))
			{
				this.hspi.Add(pi.Name,pi);
			}
		}
		public void SetValue(string name,object value)
		{
			System.Diagnostics.Trace.WriteLine("setvalue:"+name+" "+value.ToString());
			try
			{
				if(this.hsfi.ContainsKey(name))
				{
					System.Reflection.FieldInfo fi=(FieldInfo)this.hsfi[name];
					ObjectCreator.Instance.MemberInvokers.SetValue(this.Target,fi,value,null);
				}
				else if(this.hspi.Contains(name))
				{
					System.Reflection.PropertyInfo pi=(PropertyInfo)this.hspi[name];
					ObjectCreator.Instance.MemberInvokers.SetValue(this.Target,pi,value,null);				
				}
			}
			catch(System.Exception ex)
			{
				System.Windows.Forms.MessageBox.Show(ex.Message);
				throw;
			}
		}
	}
}

⌨️ 快捷键说明

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