internal TypeInfo(RuntimeType typeOfObj)
 {
     this.ServerType = GetQualifiedTypeName(typeOfObj);
     RuntimeType baseType = (RuntimeType) typeOfObj.BaseType;
     int num = 0;
     while ((baseType != typeof(MarshalByRefObject)) && (baseType != null))
     {
         baseType = (RuntimeType) baseType.BaseType;
         num++;
     }
     string[] strArray = null;
     if (num > 0)
     {
         strArray = new string[num];
         baseType = (RuntimeType) typeOfObj.BaseType;
         for (int i = 0; i < num; i++)
         {
             strArray[i] = GetQualifiedTypeName(baseType);
             baseType = (RuntimeType) baseType.BaseType;
         }
     }
     this.ServerHierarchy = strArray;
     Type[] interfaces = typeOfObj.GetInterfaces();
     string[] strArray2 = null;
     bool isInterface = typeOfObj.IsInterface;
     if ((interfaces.Length > 0) || isInterface)
     {
         strArray2 = new string[interfaces.Length + (isInterface ? 1 : 0)];
         for (int j = 0; j < interfaces.Length; j++)
         {
             strArray2[j] = GetQualifiedTypeName((RuntimeType) interfaces[j]);
         }
         if (isInterface)
         {
             strArray2[strArray2.Length - 1] = GetQualifiedTypeName(typeOfObj);
         }
     }
     this.InterfacesImplemented = strArray2;
 }
예제 #2
0
        [System.Security.SecurityCritical]  // auto-generated 
        internal TypeInfo(RuntimeType typeOfObj)
        { 
            ServerType = GetQualifiedTypeName(typeOfObj);

            // Compute the length of the server hierarchy
            RuntimeType currType = (RuntimeType)typeOfObj.BaseType; 
            // typeOfObj is the root of all classes, but not included in the hierarachy.
            Message.DebugOut("RemotingServices::TypeInfo: Determining length of server heirarchy\n"); 
            int hierarchyLen = 0; 
            while ((currType != typeof(MarshalByRefObject)) &&
                   (currType != null)) 
            {
                currType = (RuntimeType)currType.BaseType;
                hierarchyLen++;
            } 

            // Allocate an array big enough to store the hierarchy 
            Message.DebugOut("RemotingServices::TypeInfo: Determined length of server heirarchy\n"); 
            String[] serverHierarchy = null;
            if (hierarchyLen > 0) 
            {
                serverHierarchy = new String[hierarchyLen];

                currType = (RuntimeType)typeOfObj.BaseType; 
                for (int i = 0; i < hierarchyLen; i++)
                { 
                    serverHierarchy[i] = GetQualifiedTypeName(currType); 
                    currType = (RuntimeType)currType.BaseType;
                } 
            }

            this.ServerHierarchy = serverHierarchy;
 
            Message.DebugOut("RemotingServices::TypeInfo: Getting implemented interfaces\n");
            // Set the interfaces implemented 
            Type[] interfaces = typeOfObj.GetInterfaces(); 
            String[] interfaceNames = null;
            // If the requested type itself is an interface we should add that to the 
            // interfaces list as well
            bool isInterface = typeOfObj.IsInterface;
            if (interfaces.Length > 0 || isInterface)
            { 
                interfaceNames = new String[interfaces.Length + (isInterface ? 1 : 0)];
                for (int i = 0; i < interfaces.Length; i++) 
                { 
                    interfaceNames[i] = GetQualifiedTypeName((RuntimeType)interfaces[i]);
                } 
                if (isInterface)
                    interfaceNames[interfaceNames.Length - 1] = GetQualifiedTypeName(typeOfObj);
            }
 
            this.InterfacesImplemented = interfaceNames;
        } // TypeInfo