Ejemplo n.º 1
0
 TypeReference LookupSystemType(ref TypeReference reference, string name, CecilElementType element_type)
 {
     lock (module.SyncRoot) {
         if (reference != null)
         {
             return(reference);
         }
         var type = LookupType("System", name);
         type.etype = element_type;
         return(reference = type);
     }
 }
Ejemplo n.º 2
0
 TypeReference LookupSystemValueType(ref TypeReference typeRef, string name, CecilElementType element_type)
 {
     lock (module.SyncRoot) {
         if (typeRef != null)
         {
             return(typeRef);
         }
         var type = LookupType("System", name);
         type.etype = element_type;
         type.KnownValueType();
         return(typeRef = type);
     }
 }
Ejemplo n.º 3
0
        public static bool TryGetPrimitiveElementType(TypeDefinition type, out CecilElementType etype)
        {
            etype = CecilElementType.None;

            if (type.Namespace != "System")
            {
                return(false);
            }

            Row <CecilElementType, bool> primitive_data;

            if (TryGetPrimitiveData(type, out primitive_data))
            {
                etype = primitive_data.Col1;
                return(true);
            }

            return(false);
        }
Ejemplo n.º 4
0
        public static bool IsPrimitive(this CecilElementType self)
        {
            switch (self)
            {
            case CecilElementType.Boolean:
            case CecilElementType.Char:
            case CecilElementType.I:
            case CecilElementType.U:
            case CecilElementType.I1:
            case CecilElementType.U1:
            case CecilElementType.I2:
            case CecilElementType.U2:
            case CecilElementType.I4:
            case CecilElementType.U4:
            case CecilElementType.I8:
            case CecilElementType.U8:
            case CecilElementType.R4:
            case CecilElementType.R8:
                return(true);

            default:
                return(false);
            }
        }