public Field_Common_System(ICLRSharp_Environment env, System.Reflection.FieldInfo field) { info = field; FieldType = env.GetType(field.FieldType); DeclaringType = env.GetType(field.DeclaringType); }
public MethodParamList(ICLRSharp_Environment env, Mono.Cecil.GenericInstanceMethod method) { { // foreach(var p in method.GenericArguments) var __enumerator4 = (method.GenericArguments).GetEnumerator(); while (__enumerator4.MoveNext()) { var p = __enumerator4.Current; { string paramname = p.FullName; if (p.IsGenericParameter) { var typegen = method.DeclaringType as Mono.Cecil.GenericInstanceType; if (p.Name[0] == '!') { int index = int.Parse(p.Name.Substring(1)); paramname = typegen.GenericArguments[index].FullName; } } var type = env.GetType(paramname); if (type.IsEnum()) { type = env.GetType(type.TypeForSystem); } this.Add(type); } } } }
void Init(ICLRSharp_Environment env, CLRSharp_Instance instance) { mRuntimeObject = instance; var type = instance.type; mGetDataModel = type.GetMethod("GetDataModel", new MethodParamList(new[] { env.GetType(typeof(string)) })); mClose = type.GetMethod("Close", MethodParamList.constEmpty()); mCleanUp = type.GetMethod("CleanUp", MethodParamList.constEmpty()); mRefreshDate = type.GetMethod("RefreshData", new MethodParamList(new[] { env.GetType(typeof(UIInitArguments)) })); mGetState = type.GetMethod("get_State", MethodParamList.constEmpty()); mSetState = type.GetMethod("set_State", new MethodParamList(new[] { env.GetType(typeof(FrameState)) })); mTick = type.GetMethod("Tick", new MethodParamList(MethodParamList.constEmpty())); mOnChangeScene = type.GetMethod("OnChangeScene", new MethodParamList(new[] { env.GetType(typeof(int)) })); mCallFromMethod = type.GetMethod("CallFromOtherClass", new MethodParamList(new[] { env.GetType(typeof(string)), env.GetType(typeof(object[])) })); mOnShow = type.GetMethod("OnShow", MethodParamList.constEmpty()); }
public MethodParamList(ICLRSharp_Environment env, System.Reflection.MethodBase method) { foreach (var p in method.GetParameters()) { this.Add(env.GetType(p.ParameterType)); } }
public MethodCreatePrimitive(ICLRSharp_Environment env, ICLRType type) { this.env = env; this.DeclaringType = type; this.ReturnType = env.GetType(typeof(GameObject)); ParamList = MethodParamList.Make(env.GetType(typeof(PrimitiveType))); }
public MethodParamList(ICLRSharp_Environment env, GenericInstanceMethod method) { foreach (TypeReference current in method.GenericArguments) { string fullName = current.FullName; bool isGenericParameter = current.IsGenericParameter; if (isGenericParameter) { GenericInstanceType genericInstanceType = method.DeclaringType as GenericInstanceType; bool flag = current.Name[0] == '!'; if (flag) { int index = int.Parse(current.Name.Substring(1)); fullName = genericInstanceType.GenericArguments[index].FullName; } } ICLRType type = env.GetType(fullName); bool flag2 = type.IsEnum(); if (flag2) { type = env.GetType(type.TypeForSystem); } base.Add(type); } }
public MethodFind(ICLRSharp_Environment env, ICLRType type) { this.env = env; this.DeclaringType = type; this.ReturnType = env.GetType(typeof(GameObject)); ParamList = MethodParamList.Make(env.GetType(typeof(string))); }
public Type_Common_System(ICLRSharp_Environment env, System.Type type, ICLRType[] subtype) { this.env = env; this.TypeForSystem = type; FullNameWithAssembly = type.AssemblyQualifiedName; this.SubTypes = subtype; }
public MethodParamList(ICLRSharp_Environment env, Mono.Collections.Generic.Collection <Mono.Cecil.Cil.VariableDefinition> ps) { foreach (var p in ps) { string paramname = p.VariableType.FullName; this.Add(env.GetType(paramname)); } }
public static MethodParamList const_OneParam_Int(ICLRSharp_Environment env) { if (_OneParam_Int == null) { _OneParam_Int = new MethodParamList(new ICLRType[] { env.GetType(typeof(int)) }); } return(_OneParam_Int); }
public MethodParamList(ICLRSharp_Environment env, Mono.Cecil.MethodReference method) { if (method.HasParameters) { Mono.Cecil.GenericInstanceType _typegen = null; _typegen = method.DeclaringType as Mono.Cecil.GenericInstanceType; Mono.Cecil.GenericInstanceMethod gm = method as Mono.Cecil.GenericInstanceMethod; MethodParamList _methodgen = null; if (gm != null) { _methodgen = new MethodParamList(env, gm); } foreach (var p in method.Parameters) { string paramname = p.ParameterType.FullName; if (p.ParameterType.IsGenericParameter) { if (p.ParameterType.Name.Contains("!!")) { int index = int.Parse(p.ParameterType.Name.Substring(2)); paramname = _methodgen[index].FullName; } else if (p.ParameterType.Name.Contains("!")) { int index = int.Parse(p.ParameterType.Name.Substring(1)); paramname = _typegen.GenericArguments[index].FullName; } } if (paramname.Contains("!!")) { //string typename = param.ParameterType.FullName; for (int i = 0; i < _methodgen.Count; i++) { string pp = "!!" + i.ToString(); paramname = paramname.Replace(pp, _methodgen[i].FullName); } //this.Add(GetTType(env, p, _methodgen)); } if (paramname.Contains("!"))//函数有T { var gens = (method.DeclaringType as Mono.Cecil.GenericInstanceType).GenericArguments; for (int i = 0; i < gens.Count; i++) { string pp = "!" + i.ToString(); paramname = paramname.Replace(pp, gens[i].FullName); } } //else { this.Add(env.GetType(paramname)); } } } }
public MethodParamList(ICLRSharp_Environment env, MethodBase method) { ParameterInfo[] parameters = method.GetParameters(); for (int i = 0; i < parameters.Length; i++) { ParameterInfo parameterInfo = parameters[i]; base.Add(env.GetType(parameterInfo.ParameterType)); } }
public static MethodParamList MakeList_OneParam_Int(ICLRSharp_Environment env) { if (_OneParam_Int == null) { _OneParam_Int = new MethodParamList(); _OneParam_Int.Add(env.GetType(typeof(int).FullName, null)); } return(_OneParam_Int); }
public ThreadContext(ICLRSharp_Environment env, int DebugLevel) { this.environment = env; this.DebugLevel = DebugLevel; if (_activeContext != null) { env.logger.Log_Error("在同一线程上多次创建ThreadContext"); } _activeContext = this; }
public ScriptableController(ICLRSharp_Environment env, ICLRType type, string name) { var method = type.GetMethod(".ctor", MethodParamList.constEmpty()); mRuntimeObject = method.Invoke(ThreadContext.activeContext, null, null); mName = name; Init(env, (CLRSharp_Instance)mRuntimeObject); }
private static ICLRType GetTType(ICLRSharp_Environment env, ParameterDefinition param, MethodParamList _methodgen) { string text = param.ParameterType.FullName; for (int i = 0; i < _methodgen.Count; i++) { string oldValue = "!!" + i.ToString(); text = text.Replace(oldValue, _methodgen[i].FullName); } return(env.GetType(text)); }
static ICLRType GetTType(ICLRSharp_Environment env, Mono.Cecil.ParameterDefinition param, MethodParamList _methodgen) { string typename = param.ParameterType.FullName; for (int i = 0; i < _methodgen.Count; i++) { string p = "!!" + i.ToString(); typename = typename.Replace(p, _methodgen[i].FullName); } return(env.GetType(typename)); }
public ThreadContext(ICLRSharp_Environment env) { this.environment = env; this.DebugLevel = 0; bool flag = ThreadContext._activeContext != null; if (flag) { env.logger.Log_Error("在同一线程上多次创建ThreadContext"); } ThreadContext._activeContext = this; }
public Type_Common_CLRSharp(ICLRSharp_Environment env, Mono.Cecil.TypeDefinition type) { this.env = env; this.type_CLRSharp = type; if (type.IsEnum) { _isenum = true; } if (type_CLRSharp.BaseType != null) { BaseType = env.GetType(type_CLRSharp.BaseType.FullName); if (BaseType is ICLRType_System) { if (BaseType.TypeForSystem == typeof(Enum) || BaseType.TypeForSystem == typeof(object) || BaseType.TypeForSystem == typeof(ValueType) || BaseType.TypeForSystem == typeof(System.Enum)) {//都是这样,无所谓 BaseType = null; } else {//继承了其他系统类型 env.logger.Log_Error("ScriptType:" + Name + " Based On a SystemType:" + BaseType.Name); HasSysBase = true; throw new Exception("不得继承系统类型,脚本类型系统和脚本类型系统是隔离的"); } } if (type_CLRSharp.HasInterfaces) { _Interfaces = new List <ICLRType>(); foreach (var i in type_CLRSharp.Interfaces) { var itype = env.GetType(i.FullName); if (itype is ICLRType_System) { //继承了其他系统类型 if (env.GetCrossBind((itype as ICLRType_System).TypeForSystem) == null) { env.logger.Log_Warning("警告:没有CrossBind的情况下直接继承\nScriptType:" + Name + " Based On a SystemInterface:" + itype.Name); } HasSysBase = true; } _Interfaces.Add(itype); } } } foreach (var m in this.type_CLRSharp.Methods) { if (m.Name == ".cctor") { NeedCCtor = true; break; } } }
public ICLRType GetNestType(ICLRSharp_Environment env, string fullname) { foreach (var stype in type_CLRSharp.NestedTypes) { if (stype.Name == fullname) { var itype = new Type_Common_CLRSharp(env, stype); env.RegType(itype); return(itype); } } return(null); }
public Type_Common_CLRSharp(ICLRSharp_Environment env, Mono.Cecil.TypeDefinition type) { this.env = env; this.type_CLRSharp = type; foreach (var m in this.type_CLRSharp.Methods) { if (m.Name == ".cctor") { NeedCCtor = true; break; } } }
public static MethodParamList const_OneParam_Int(ICLRSharp_Environment env) { bool flag = MethodParamList._OneParam_Int == null; if (flag) { MethodParamList._OneParam_Int = new MethodParamList(new ICLRType[] { env.GetType(typeof(int)) }); } return(MethodParamList._OneParam_Int); }
public MethodParamList(ICLRSharp_Environment env, Mono.Collections.Generic.Collection <Mono.Cecil.Cil.VariableDefinition> ps) { foreach (var p in ps) { string paramname = p.VariableType.FullName; var type = env.GetType(paramname); if (type != null && type.IsEnum()) { type = env.GetType(type.TypeForSystem); } this.Add(type); } }
public MethodParamList(ICLRSharp_Environment env, System.Reflection.MethodBase method) { { var __array5 = method.GetParameters(); var __arrayLength5 = __array5.Length; for (int __i5 = 0; __i5 < __arrayLength5; ++__i5) { var p = __array5[__i5]; { this.Add(env.GetType(p.ParameterType)); } } } }
public MethodParamList(ICLRSharp_Environment env, Collection <VariableDefinition> ps) { foreach (VariableDefinition current in ps) { string fullName = current.VariableType.FullName; ICLRType type = env.GetType(fullName); bool flag = type != null && type.IsEnum(); if (flag) { type = env.GetType(type.TypeForSystem); } base.Add(type); } }
public MethodParamList(ICLRSharp_Environment env, Mono.Cecil.GenericInstanceMethod method) { foreach (var p in method.GenericArguments) { string paramname = p.FullName; if (p.IsGenericParameter) { var typegen = method.DeclaringType as Mono.Cecil.GenericInstanceType; if (p.Name[0] == '!') { int index = int.Parse(p.Name.Substring(1)); paramname = typegen.GenericArguments[index].FullName; } } this.Add(env.GetType(paramname)); } }
public void Init(ICLRSharp_Environment env) { bool flag = this.bInited; if (!flag) { bool hasVariables = this.bodyNative.HasVariables; if (hasVariables) { this.typelistForLoc = new MethodParamList(env, this.bodyNative.Variables); } for (int i = 0; i < this.bodyNative.Instructions.Count; i++) { Instruction instruction = this.bodyNative.Instructions[i]; CodeBody.OpCode opCode = new CodeBody.OpCode(); opCode.code = (CodeEx)instruction.OpCode.Code; opCode.addr = instruction.Offset; bool flag2 = instruction.SequencePoint != null; if (flag2) { bool flag3 = this.debugDoc == null; if (flag3) { this.debugDoc = new Dictionary <string, int>(); } bool flag4 = !this.debugDoc.ContainsKey(instruction.SequencePoint.Document.Url); if (flag4) { this.debugDoc.Add(instruction.SequencePoint.Document.Url, instruction.SequencePoint.StartLine); } opCode.debugline = instruction.SequencePoint.StartLine; } this.opCodes.Add(opCode); this.addr[opCode.addr] = i; } ThreadContext activeContext = ThreadContext.activeContext; for (int j = 0; j < this.bodyNative.Instructions.Count; j++) { CodeBody.OpCode opCode2 = this.opCodes[j]; Instruction instruction2 = this.bodyNative.Instructions[j]; opCode2.InitToken(activeContext, this, instruction2.Operand); } this.bInited = true; } }
public Type_Common_CLRSharp(ICLRSharp_Environment env, Mono.Cecil.TypeDefinition type) { this.env = env; this.type_CLRSharp = type; if (type_CLRSharp.BaseType != null) { BaseType = env.GetType(type_CLRSharp.BaseType.FullName); if (BaseType is ICLRType_System) { if (BaseType.TypeForSystem == typeof(object)) {//都是这样,无所谓 BaseType = null; } else {//继承了其他系统类型 env.logger.Log("ScriptType:" + Name + " Based On a SystemType:" + BaseType.Name); HasSysBase = true; } } if (type_CLRSharp.HasInterfaces) { _Interfaces = new List<ICLRType>(); foreach (var i in type_CLRSharp.Interfaces) { var itype = env.GetType(i.FullName); if (itype is ICLRType_System) { //继承了其他系统类型 env.logger.Log("ScriptType:" + Name + " Based On a SystemType:" + itype.Name); HasSysBase = true; } _Interfaces.Add(itype); } } } foreach (var m in this.type_CLRSharp.Methods) { if (m.Name == ".cctor") { NeedCCtor = true; break; } } }
public ICLRType GetNestType(ICLRSharp_Environment env, string fullname) { ICLRType result; foreach (TypeDefinition current in this.type_CLRSharp.NestedTypes) { bool flag = current.Name == fullname; if (flag) { Type_Common_CLRSharp type_Common_CLRSharp = new Type_Common_CLRSharp(env, current); env.RegType(type_Common_CLRSharp); result = type_Common_CLRSharp; return(result); } } result = null; return(result); }
public Type_Common_CLRSharp(ICLRSharp_Environment env, Mono.Cecil.TypeDefinition type) { this.env = env; this.type_CLRSharp = type; if (type_CLRSharp.BaseType != null) { BaseType = env.GetType(type_CLRSharp.BaseType.FullName); if (BaseType is ICLRType_System) { if (BaseType.TypeForSystem == typeof(object)) {//都是这样,无所谓 BaseType = null; } else {//继承了其他系统类型 env.logger.Log("ScriptType:" + Name + " Based On a SystemType:" + BaseType.Name); HasSysBase = true; } } if (type_CLRSharp.HasInterfaces) { _Interfaces = new List <ICLRType>(); foreach (var i in type_CLRSharp.Interfaces) { var itype = env.GetType(i.FullName); if (itype is ICLRType_System) { //继承了其他系统类型 env.logger.Log("ScriptType:" + Name + " Based On a SystemType:" + itype.Name); HasSysBase = true; } _Interfaces.Add(itype); } } } foreach (var m in this.type_CLRSharp.Methods) { if (m.Name == ".cctor") { NeedCCtor = true; break; } } }
public MethodParamList(ICLRSharp_Environment env, Mono.Collections.Generic.Collection <Mono.Cecil.Cil.VariableDefinition> ps) { { // foreach(var p in ps) var __enumerator3 = (ps).GetEnumerator(); while (__enumerator3.MoveNext()) { var p = __enumerator3.Current; { string paramname = p.VariableType.FullName; var type = env.GetType(paramname); if (type != null && type.IsEnum()) { type = env.GetType(type.TypeForSystem); } this.Add(type); } } } }
public Type_Common_CLRSharp(ICLRSharp_Environment env, Mono.Cecil.TypeDefinition type) { this.env = env; this.type_CLRSharp = type; if (type.IsEnum) { _isenum = true; } if (type_CLRSharp.BaseType != null) { BaseType = env.GetType(type_CLRSharp.BaseType.FullName); if (BaseType is ICLRType_System) { if (BaseType.TypeForSystem == typeof(Enum) || BaseType.TypeForSystem == typeof(object) || BaseType.TypeForSystem == typeof(ValueType) || BaseType.TypeForSystem == typeof(System.Enum)) {//都是这样,无所谓 BaseType = null; } else {//继承了其他系统类型 env.logger.Log_Error("ScriptType:" + Name + " Based On a SystemType:" + BaseType.Name); HasSysBase = true; throw new Exception("不得继承系统类型,脚本类型系统和脚本类型系统是隔离的"); } } if (type_CLRSharp.HasInterfaces) { _Interfaces = new List<ICLRType>(); bool bWarning = true; foreach (var i in type_CLRSharp.Interfaces) { var itype = env.GetType(i.FullName); if (itype is ICLRType_System) { //继承了其他系统类型 Type ts = (itype as ICLRType_System).TypeForSystem; if (bWarning & env.GetCrossBind(ts) == null) { if (ts.IsInterface) { foreach(var t in ts.GetInterfaces()) { if(env.GetCrossBind(t)!=null) { bWarning = false; break; } } } if (bWarning) { env.logger.Log_Warning("警告:没有CrossBind的情况下直接继承\nScriptType:" + Name + " Based On a SystemInterface:" + itype.Name); } } HasSysBase = true; } _Interfaces.Add(itype); } } } foreach (var m in this.type_CLRSharp.Methods) { if (m.Name == ".cctor") { NeedCCtor = true; break; } } }
public ThreadContext(ICLRSharp_Environment env) { this.environment = env; DebugLevel = 0; }
public ThreadContext(ICLRSharp_Environment env, int DebugLevel) { this.environment = env; this.DebugLevel = DebugLevel; }
public ICLRType GetNestType(ICLRSharp_Environment env, string fullname) { foreach (var stype in type_CLRSharp.NestedTypes) { if (stype.Name == fullname) { var itype = new Type_Common_CLRSharp(env, stype); env.RegType(itype); return itype; } } return null; }
public ICLRType GetNestType(ICLRSharp_Environment env, string fullname) { throw new NotImplementedException(); }