Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
 public SimpleEnumerator(ArrayMirror arr)
 {
     this.arr    = arr;
     this.pos    = -1;
     this.length = arr.Length;
 }