Exemplo n.º 1
0
 public bool IsInst(object obj)
 {
     if (obj is CLRSharp_Instance)
     {
         CLRSharp_Instance ins = obj as CLRSharp_Instance;
         if (ins.type == this)
         {
             return(true);
         }
         //这里还要实现继承关系
         if (ins.type is ICLRType_Sharp)
         {
             Type_Common_CLRSharp sharps = ins.type as Type_Common_CLRSharp;
             if (sharps._Interfaces.Count > 0)
             {
                 foreach (var i in sharps._Interfaces)
                 {
                     if (i == this)
                     {
                         return(true);
                     }
                 }
             }
         }
     }
     return(false);
 }
Exemplo n.º 2
0
        public Method_Common_CLRSharp(Type_Common_CLRSharp type, Mono.Cecil.MethodDefinition method)
        {
            if (method == null)
            {
                throw new Exception("not allow null method.");
            }
            this._DeclaringType = type;

            method_CLRSharp = method;
            ReturnType      = type.env.GetType(method.ReturnType.FullName, null);
            ParamList       = new MethodParamList(type.env, method);
        }
Exemplo n.º 3
0
 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 Method_Common_CLRSharp(Type_Common_CLRSharp type, MethodDefinition method)
        {
            bool flag = method == null;

            if (flag)
            {
                throw new Exception("not allow null method.");
            }
            this._DeclaringType  = type;
            this.method_CLRSharp = method;
            this.ReturnType      = type.env.GetType(method.ReturnType.FullName);
            this.ParamList       = new MethodParamList(type.env, method);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
 public ICLRType GetNestType(ICLRSharp_Environment env, string fullname)
 {
     {
         // foreach(var stype in type_CLRSharp.NestedTypes)
         var __enumerator11 = (type_CLRSharp.NestedTypes).GetEnumerator();
         while (__enumerator11.MoveNext())
         {
             var stype = __enumerator11.Current;
             {
                 if (stype.Name == fullname)
                 {
                     var itype = new Type_Common_CLRSharp(env, stype);
                     env.RegType(itype);
                     return(itype);
                 }
             }
         }
     }
     return(null);
 }
Exemplo n.º 7
0
        public bool IsInst(object obj)
        {
            bool flag = obj is CLRSharp_Instance;
            bool result;

            if (flag)
            {
                CLRSharp_Instance cLRSharp_Instance = obj as CLRSharp_Instance;
                bool flag2 = cLRSharp_Instance.type == this;
                if (flag2)
                {
                    result = true;
                    return(result);
                }
                bool flag3 = cLRSharp_Instance.type != null;
                if (flag3)
                {
                    Type_Common_CLRSharp type_Common_CLRSharp = cLRSharp_Instance.type as Type_Common_CLRSharp;
                    bool flag4 = type_Common_CLRSharp._Interfaces.Count > 0;
                    if (flag4)
                    {
                        foreach (ICLRType current in type_Common_CLRSharp._Interfaces)
                        {
                            bool flag5 = current == this;
                            if (flag5)
                            {
                                result = true;
                                return(result);
                            }
                        }
                    }
                }
            }
            result = false;
            return(result);
        }
Exemplo n.º 8
0
 public Field_Common_CLRSharp(Type_Common_CLRSharp type, Mono.Cecil.FieldDefinition field)
 {
     this.field          = field;
     this.FieldType      = type.env.GetType(field.FieldType.FullName);
     this._DeclaringType = type;
 }
Exemplo n.º 9
0
        public Method_Common_CLRSharp(Type_Common_CLRSharp type, Mono.Cecil.MethodDefinition method)
        {
            if (method == null)
                throw new Exception("not allow null method.");
            this._DeclaringType = type;

            method_CLRSharp = method;
            ReturnType = type.env.GetType(method.ReturnType.FullName);

            ParamList = new MethodParamList(type.env, method);
        }
Exemplo n.º 10
0
 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;
 }
Exemplo n.º 11
0
 public Field_Common_CLRSharp(Type_Common_CLRSharp type, Mono.Cecil.FieldDefinition field)
 {
     this.field = field;
     this.FieldType = type.env.GetType(field.FieldType.FullName);
     this._DeclaringType = type;
 }
Exemplo n.º 12
0
 private void getInterfaces(Type_Common_CLRSharp clrType, ref List<ICLRType> interfaces)
 {
     if (clrType == null)
     {
         return;
     }
     if(clrType._Interfaces != null)
     {
         interfaces.AddRange(clrType._Interfaces);
     }
     if (clrType.BaseType != null)
     {
         getInterfaces(clrType.BaseType as Type_Common_CLRSharp, ref interfaces);
     }
 }
Exemplo n.º 13
0
 /// <summary>
 /// 判断A类是否是继承B类
 /// </summary>
 /// <param name="A"></param>
 /// <param name="B"></param>
 /// <returns></returns>
 public bool isExtend(Type_Common_CLRSharp typeA, Type_Common_CLRSharp typeB)
 {
     if (typeA == null || typeB == null)
     {
         return false;
     }
     if (typeA == typeB)
     {
         return true;
     }
     return isExtend(typeA.BaseType as Type_Common_CLRSharp, typeB);
 }
Exemplo n.º 14
0
 /// <summary>
 /// 获取所有接口
 /// </summary>
 /// <param name="type">L#类</param>
 /// <returns></returns>
 public List<ICLRType> getInterfaces(Type_Common_CLRSharp clrType)
 {
     List<ICLRType> interfaces = new List<ICLRType>();
     getInterfaces(clrType, ref interfaces);
     return interfaces;
 }