Beispiel #1
0
        private TypeInfo getNewTypeUsage(Il2CppType usage, MemberTypes memberType)
        {
            TypeInfo underlyingType;

            switch (usage.type)
            {
            case Il2CppTypeEnum.IL2CPP_TYPE_CLASS:
            case Il2CppTypeEnum.IL2CPP_TYPE_VALUETYPE:
                // Classes defined in the metadata
                underlyingType = TypesByDefinitionIndex[usage.datapoint];     // klassIndex
                break;

            case Il2CppTypeEnum.IL2CPP_TYPE_GENERICINST:
            case Il2CppTypeEnum.IL2CPP_TYPE_ARRAY:
            case Il2CppTypeEnum.IL2CPP_TYPE_SZARRAY:
            case Il2CppTypeEnum.IL2CPP_TYPE_PTR:
            case Il2CppTypeEnum.IL2CPP_TYPE_VAR:
            case Il2CppTypeEnum.IL2CPP_TYPE_MVAR:
                // Everything that requires special handling
                underlyingType = new TypeInfo(this, usage, memberType);
                break;

            default:
                // Primitive types
                underlyingType = GetTypeFromTypeEnum(usage.type);
                break;
            }

            // Create a reference type if necessary
            return(usage.byref? underlyingType.MakeByRefType() : underlyingType);
        }
Beispiel #2
0
        private TypeInfo resolveTypeReference(Il2CppType typeRef)
        {
            TypeInfo underlyingType;

            switch (typeRef.type)
            {
            // Classes defined in the metadata (reference to a TypeDef)
            case Il2CppTypeEnum.IL2CPP_TYPE_CLASS:
            case Il2CppTypeEnum.IL2CPP_TYPE_VALUETYPE:
                underlyingType = TypesByDefinitionIndex[typeRef.datapoint];     // klassIndex
                break;

            // Constructed types
            case Il2CppTypeEnum.IL2CPP_TYPE_GENERICINST:
            case Il2CppTypeEnum.IL2CPP_TYPE_ARRAY:
            case Il2CppTypeEnum.IL2CPP_TYPE_SZARRAY:
            case Il2CppTypeEnum.IL2CPP_TYPE_PTR:

            // Generic type and generic method parameters
            case Il2CppTypeEnum.IL2CPP_TYPE_VAR:
            case Il2CppTypeEnum.IL2CPP_TYPE_MVAR:

                underlyingType = new TypeInfo(this, typeRef);
                break;

            // Primitive types
            default:
                underlyingType = getTypeDefinitionFromTypeEnum(typeRef.type);
                break;
            }

            // Create a reference type if necessary
            return(typeRef.byref ? underlyingType.MakeByRefType() : underlyingType);
        }