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); } } } }
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))); }
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 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 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 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 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, 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, System.Reflection.MethodBase method) { foreach (var p in method.GetParameters()) { this.Add(env.GetType(p.ParameterType)); } }
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 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, 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 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 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 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 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 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); } } } }
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 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, 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, 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 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("!!")) { this.Add(GetTType(env, p, method, _methodgen)); } else { this.Add(env.GetType(paramname, method.Module)); } } } }
public Field_Common_System(ICLRSharp_Environment env, FieldInfo field) { this.info = field; this.FieldType = env.GetType(field.FieldType); this.DeclaringType = env.GetType(field.DeclaringType); }
public Type_Common_CLRSharp(ICLRSharp_Environment env, TypeDefinition type) { this.env = env; this.type_CLRSharp = type; bool isEnum = type.IsEnum; if (isEnum) { this._isenum = true; } bool flag = this.type_CLRSharp.BaseType != null; if (flag) { this.BaseType = env.GetType(this.type_CLRSharp.BaseType.FullName); bool flag2 = this.BaseType is ICLRType_System; if (flag2) { bool flag3 = this.BaseType.TypeForSystem == typeof(Enum) || this.BaseType.TypeForSystem == typeof(object) || this.BaseType.TypeForSystem == typeof(ValueType) || this.BaseType.TypeForSystem == typeof(Enum); if (!flag3) { env.logger.Log_Error("ScriptType:" + this.Name + " Based On a SystemType:" + this.BaseType.Name); this.HasSysBase = true; throw new Exception("不得继承系统类型,脚本类型系统和脚本类型系统是隔离的"); } this.BaseType = null; } bool hasInterfaces = this.type_CLRSharp.HasInterfaces; if (hasInterfaces) { this._Interfaces = new List <ICLRType>(); bool flag4 = true; foreach (TypeReference current in this.type_CLRSharp.Interfaces) { ICLRType type2 = env.GetType(current.FullName); bool flag5 = type2 is ICLRType_System; if (flag5) { Type typeForSystem = (type2 as ICLRType_System).TypeForSystem; bool flag6 = flag4 & env.GetCrossBind(typeForSystem) == null; if (flag6) { bool isInterface = typeForSystem.IsInterface; if (isInterface) { Type[] interfaces = typeForSystem.GetInterfaces(); for (int i = 0; i < interfaces.Length; i++) { Type type3 = interfaces[i]; bool flag7 = env.GetCrossBind(type3) != null; if (flag7) { flag4 = false; break; } } } bool flag8 = flag4; if (flag8) { env.logger.Log_Warning("警告:没有CrossBind的情况下直接继承\nScriptType:" + this.Name + " Based On a SystemInterface:" + type2.Name); } } this.HasSysBase = true; } this._Interfaces.Add(type2); } } } foreach (MethodDefinition current2 in this.type_CLRSharp.Methods) { bool flag9 = current2.Name == ".cctor"; if (flag9) { this.NeedCCtor = true; break; } } }
public MethodParamList(ICLRSharp_Environment env, MethodReference method) { bool hasParameters = method.HasParameters; if (hasParameters) { GenericInstanceType genericInstanceType = method.DeclaringType as GenericInstanceType; GenericInstanceMethod genericInstanceMethod = method as GenericInstanceMethod; MethodParamList methodParamList = null; bool flag = genericInstanceMethod != null; if (flag) { methodParamList = new MethodParamList(env, genericInstanceMethod); } foreach (ParameterDefinition current in method.Parameters) { string text = current.ParameterType.FullName; bool isGenericParameter = current.ParameterType.IsGenericParameter; if (isGenericParameter) { bool flag2 = current.ParameterType.Name.Contains("!!"); if (flag2) { int index = int.Parse(current.ParameterType.Name.Substring(2)); text = methodParamList[index].FullName; } else { bool flag3 = current.ParameterType.Name.Contains("!"); if (flag3) { int index2 = int.Parse(current.ParameterType.Name.Substring(1)); text = genericInstanceType.GenericArguments[index2].FullName; } } } bool flag4 = text.Contains("!!"); if (flag4) { for (int i = 0; i < methodParamList.Count; i++) { string oldValue = "!!" + i.ToString(); text = text.Replace(oldValue, methodParamList[i].FullName); } } bool flag5 = text.Contains("!"); if (flag5) { Collection <TypeReference> genericArguments = (method.DeclaringType as GenericInstanceType).GenericArguments; for (int j = 0; j < genericArguments.Count; j++) { string oldValue2 = "!" + j.ToString(); text = text.Replace(oldValue2, genericArguments[j].FullName); } } ICLRType type = env.GetType(text); bool flag6 = type.IsEnum(); if (flag6) { type = env.GetType(type.TypeForSystem); } base.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 __enumerator2 = (type_CLRSharp.Interfaces).GetEnumerator(); while (__enumerator2.MoveNext()) { var i = __enumerator2.Current; { 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) { { var __array12 = ts.GetInterfaces(); var __arrayLength12 = __array12.Length; for (int __i12 = 0; __i12 < __arrayLength12; ++__i12) { var t = __array12[__i12]; { 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) var __enumerator3 = (this.type_CLRSharp.Methods).GetEnumerator(); while (__enumerator3.MoveNext()) { var m = __enumerator3.Current; { if (m.Name == ".cctor") { NeedCCtor = true; break; } } } } methodCache = new Dictionary <string, List <KeyValuePair <MethodDefinition, Method_Common_CLRSharp> > >(); }
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; } } }