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 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 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 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> > >(); }