Exemplo n.º 1
0
        internal BfField method_6(FieldReference fieldReference_0)
        {
            BfAssembly bfAssembly;
            BfField    result;

            if (fieldReference_0.DeclaringType.Scope is AssemblyNameReference)
            {
                bfAssembly = this.dictionary_0[((AssemblyNameReference)fieldReference_0.DeclaringType.Scope).FullName];
            }
            else
            {
                if (!(fieldReference_0.DeclaringType.Scope is ModuleDefinition))
                {
                    Logger.LogWarning("GetBfField1", "Couldn't find assembly for field: " + fieldReference_0.ToString());
                    result = null;
                    return(result);
                }
                bfAssembly = this.dictionary_0[((ModuleDefinition)fieldReference_0.DeclaringType.Scope).Assembly.Name.FullName];
            }
            string key = BfCache.smethod_2(fieldReference_0.DeclaringType);
            BfType bfType;

            bfAssembly.method_4().TryGetValue(key, out bfType);
            if (bfType == null)
            {
                Logger.LogWarning("GetBfField2", "Couldn't find type for field: " + fieldReference_0.ToString());
                result = null;
            }
            else
            {
                foreach (BfField bfField in ((IEnumerable <BfField>)bfType.Fields))
                {
                    BfField bfField;
                    if (fieldReference_0.Name == bfField.Name)
                    {
                        result = bfField;
                        return(result);
                    }
                }
                foreach (FieldDefinition fieldDefinition in bfType.method_2().Fields)
                {
                    if (fieldDefinition.Name == fieldReference_0.Name)
                    {
                        BfField bfField = new BfField(this, fieldDefinition, bfType);
                        this.fieldCollection_0.method_1(bfField);
                        bfType.Fields.method_1(bfField);
                        result = bfField;
                        return(result);
                    }
                }
                Logger.LogWarning("GetBfField3", "Couldn't find field " + fieldReference_0.ToString() + " in type: " + bfType.FullName);
                result = null;
            }
            return(result);
        }
Exemplo n.º 2
0
 internal BfField(BfCache cache, FieldDefinition fieldDef, BfType type) : base(cache, fieldDef, type)
 {
     this.fieldDefinition_0      = fieldDef;
     this.int_0                  = cache.method_20();
     this.IsInternal             = this.fieldDefinition_0.IsAssembly;
     this.IsProtected            = this.fieldDefinition_0.IsFamily;
     this.IsProtectedAndInternal = this.fieldDefinition_0.IsFamilyAndAssembly;
     this.IsProtectedOrInternal  = this.fieldDefinition_0.IsFamilyOrAssembly;
     this.IsPrivate              = this.fieldDefinition_0.IsPrivate;
     this.IsPublic               = this.fieldDefinition_0.IsPublic;
     this.IsStatic               = this.fieldDefinition_0.IsStatic;
     this.IsConstant             = this.fieldDefinition_0.HasConstant;
     this.bfType_0               = this._cache.method_7(this.fieldDefinition_0.FieldType);
     this._typesUsed.method_1(this.bfType_0);
     this._typesUsed.method_2(this._cache.method_8(this.fieldDefinition_0.FieldType));
     this._typesUsed.ClearHash();
     this.string_0 = BfCache.smethod_2(this.fieldDefinition_0.DeclaringType);
 }
Exemplo n.º 3
0
        internal BfType method_12(TypeDefinition typeDefinition_0, BfAssembly bfAssembly_0)
        {
            string text = BfCache.smethod_2(typeDefinition_0);
            BfType result;

            if (!bfAssembly_0.method_4().ContainsKey(text))
            {
                BfType bfType = new BfType(this, typeDefinition_0, bfAssembly_0);
                bfAssembly_0.method_4().Add(BfCache.smethod_2(typeDefinition_0), bfType);
                this.Types.method_1(bfType);
                bfAssembly_0.Namespaces.method_1(bfType.Namespace);
                result = bfType;
            }
            else
            {
                Logger.LogWarning("CreateBfType", "Why the hell is this type already exist " + text);
                result = bfAssembly_0.method_4()[text];
            }
            return(result);
        }
Exemplo n.º 4
0
        internal BfType method_7(TypeReference typeReference_0)
        {
            BfType result;

            if (typeReference_0 == null)
            {
                result = null;
            }
            else
            {
                BfType bfType = null;
                typeReference_0 = BfCache.smethod_3(typeReference_0);
                if (typeReference_0 is GenericParameter)
                {
                    IEnumerable <BfAssembly> arg_53_0 = this.dictionary_0.Values;
                    if (BfCache.func_1 == null)
                    {
                        BfCache.func_1 = new Func <BfAssembly, bool>(BfCache.smethod_6);
                    }
                    BfAssembly bfAssembly = arg_53_0.Where(BfCache.func_1).FirstOrDefault <BfAssembly>();
                    if (bfAssembly == null)
                    {
                        IEnumerable <BfAssembly> arg_8F_0 = this.dictionary_0.Values;
                        if (BfCache.func_2 == null)
                        {
                            BfCache.func_2 = new Func <BfAssembly, bool>(BfCache.smethod_7);
                        }
                        bfAssembly = arg_8F_0.Where(BfCache.func_2).FirstOrDefault <BfAssembly>();
                    }
                    if (bfAssembly.method_4().ContainsKey(typeReference_0.FullName))
                    {
                        bfType = bfAssembly.method_4()[typeReference_0.FullName];
                    }
                    else
                    {
                        bfType = this.method_12(new TypeDefinition(typeReference_0.Name, typeReference_0.Namespace, TypeAttributes.Abstract, null), bfAssembly);
                    }
                    result = bfType;
                }
                else
                {
                    BfAssembly bfAssembly2 = null;
                    try
                    {
                        if (typeReference_0.Scope is AssemblyNameReference)
                        {
                            bfAssembly2 = this.dictionary_0[((AssemblyNameReference)typeReference_0.Scope).FullName];
                        }
                        else if (typeReference_0.Scope is ModuleDefinition)
                        {
                            bfAssembly2 = this.dictionary_0[((ModuleDefinition)typeReference_0.Scope).Assembly.Name.FullName];
                        }
                        else if (typeReference_0.Scope is ModuleReference)
                        {
                            bfAssembly2 = this.dictionary_1[((ModuleReference)typeReference_0.Scope).Name];
                        }
                    }
                    catch (KeyNotFoundException)
                    {
                        throw new Exception("Could not find assembly: " + typeReference_0.Scope.ToString());
                    }
                    bfAssembly2.method_4().TryGetValue(BfCache.smethod_2(typeReference_0), out bfType);
                    if (bfType == null)
                    {
                        foreach (ModuleDefinition moduleDefinition in bfAssembly2.method_3().Modules)
                        {
                            foreach (TypeDefinition typeDefinition in moduleDefinition.Types)
                            {
                                if (typeReference_0.FullName == typeDefinition.FullName)
                                {
                                    bfType = this.method_12(typeDefinition, bfAssembly2);
                                    break;
                                }
                            }
                        }
                    }
                    if (bfType != null)
                    {
                        result = bfType;
                    }
                    else
                    {
                        Logger.LogInfo("can't find: " + typeReference_0.FullName);
                        result = null;
                    }
                }
            }
            return(result);
        }