Exemple #1
0
        internal T GetObject <T> (long id, long domain_id, long type_id) where T : ObjectMirror
        {
            lock (objects_lock) {
                if (objects == null)
                {
                    objects = new Dictionary <long, ObjectMirror> ();
                }
                ObjectMirror obj;
                if (!objects.TryGetValue(id, out obj))
                {
                    /*
                     * Obtain the domain/type of the object to determine the type of
                     * object we need to create.
                     */
                    if (domain_id == 0)
                    {
                        domain_id = conn.Object_GetDomain(id);
                    }
                    AppDomainMirror d = GetDomain(domain_id);

                    if (type_id == 0)
                    {
                        type_id = conn.Object_GetType(id);
                    }
                    TypeMirror t = GetType(type_id);

                    if (t.Assembly == d.Corlib && t.Namespace == "System.Threading" && t.Name == "Thread")
                    {
                        obj = new ThreadMirror(this, id);
                    }
                    else if (t.Assembly == d.Corlib && t.Namespace == "System" && t.Name == "String")
                    {
                        obj = new StringMirror(this, id);
                    }
                    else if (typeof(T) == typeof(ArrayMirror))
                    {
                        obj = new ArrayMirror(this, id);
                    }
                    else
                    {
                        obj = new ObjectMirror(this, id);
                    }
                    objects [id] = obj;
                }
                return((T)obj);
            }
        }
Exemple #2
0
        CustomAttributeDataMirror[] GetCAttrs(TypeMirror type, bool inherit)
        {
            // FIXME: Handle inherit
            if (cattrs == null)
            {
                CattrInfo[] info = vm.conn.Type_GetFieldCustomAttributes(DeclaringType.Id, id, 0, false);
                cattrs = CustomAttributeDataMirror.Create(vm, info);
            }
            var res = new List <CustomAttributeDataMirror> ();

            foreach (var attr in cattrs)
            {
                if (type == null || attr.Constructor.DeclaringType == type)
                {
                    res.Add(attr);
                }
            }
            return(res.ToArray());
        }
Exemple #3
0
        public TypeMirror[] GetNestedTypes(BindingFlags bindingAttr)
        {
            if (nested != null)
            {
                return(nested);
            }

            // FIXME: bindingAttr
            GetInfo();
            var arr = new TypeMirror [info.nested.Length];

            for (int i = 0; i < arr.Length; ++i)
            {
                arr [i] = vm.GetType(info.nested [i]);
            }
            nested = arr;

            return(nested);
        }
Exemple #4
0
 internal TypeMirror GetType(long id)
 {
     lock (types_lock) {
         if (types == null)
         {
             types = new Dictionary <long, TypeMirror> ();
         }
         TypeMirror obj;
         if (id == 0)
         {
             return(null);
         }
         if (!types.TryGetValue(id, out obj))
         {
             obj        = new TypeMirror(this, id);
             types [id] = obj;
         }
         return(obj);
     }
 }
Exemple #5
0
 internal EnumMirror(VirtualMachine vm, TypeMirror type, Value[] fields) : base(vm, type, fields)
 {
 }
Exemple #6
0
 public ExceptionEventRequest CreateExceptionRequest(TypeMirror exc_type)
 {
     return(new ExceptionEventRequest(this, exc_type));
 }
Exemple #7
0
 internal StructMirror(VirtualMachine vm, TypeMirror type, Value[] fields) : base(vm, 0)
 {
     this.type   = type;
     this.fields = fields;
 }