コード例 #1
0
        private TypeReference TypeReferenceFor(TypeNameParseInfo typeNameInfo)
        {
            TypeReference typeByName = this.GetTypeByName(CecilElementTypeNameFor(typeNameInfo), typeNameInfo.Assembly);

            if (typeByName == null)
            {
                throw new TypeResolutionException(typeNameInfo);
            }
            if (typeNameInfo.HasGenericArguments)
            {
                GenericInstanceType genericInstanceType = new GenericInstanceType(typeByName);
                foreach (TypeNameParseInfo info in typeNameInfo.TypeArguments)
                {
                    genericInstanceType.GenericArguments.Add(this.TypeReferenceFor(info));
                }
                genericInstanceType.Accept(this._visitor);
                typeByName = genericInstanceType;
            }
            if (typeNameInfo.IsPointer)
            {
                throw new TypeResolutionException(typeNameInfo);
            }
            if (!typeNameInfo.IsArray)
            {
                return(typeByName);
            }
            ArrayType type2 = new ArrayType(typeByName, typeNameInfo.Ranks[0]);

            for (int i = 1; i < typeNameInfo.Ranks.Length; i++)
            {
                type2 = new ArrayType(type2, typeNameInfo.Ranks[i]);
            }
            type2.Accept(this._visitor);
            return(type2);
        }
コード例 #2
0
 public bool AddType(string typeName, TypeNameParseInfo typeNameInfo)
 {
     try
     {
         this.TypeReferenceFor(typeNameInfo);
         return(true);
     }
     catch (TypeResolutionException)
     {
         return(false);
     }
 }
コード例 #3
0
        private static string CecilElementTypeNameFor(TypeNameParseInfo typeNameInfo)
        {
            if (!typeNameInfo.IsNested)
            {
                return(typeNameInfo.ElementTypeName);
            }
            string name = typeNameInfo.Name;

            if (!string.IsNullOrEmpty(typeNameInfo.Namespace))
            {
                name = typeNameInfo.Namespace + "." + name;
            }
            if (< > f__am$cache0 == null)
            {
コード例 #4
0
        private void AddExtraTypes(InflatedCollectionCollector genericsCollectionCollector)
        {
            ExtraTypesSupport support = new ExtraTypesSupport(genericsCollectionCollector, this._assembliesOrderedByDependency);

            foreach (string str in BuildExtraTypesList())
            {
                TypeNameParseInfo typeNameInfo = Unity.IL2CPP.Common.TypeNameParser.Parse(str);
                if (typeNameInfo == null)
                {
                    Console.WriteLine("WARNING: Cannot parse type name {0} from the extra types list. Skipping.", str);
                }
                else if (!support.AddType(str, typeNameInfo))
                {
                    Console.WriteLine("WARNING: Cannot add extra type {0}. Skipping.", str);
                }
            }
        }
コード例 #5
0
 public TypeResolutionException(TypeNameParseInfo typeNameInfo)
 {
     this._typeNameInfo = typeNameInfo;
 }