Beispiel #1
0
        public static BfCache Load(string filename)
        {
            BfCache bfCache = new BfCache();

            using (FileStream fileStream = new FileStream(filename, FileMode.Open))
            {
                using (BinaryReader binaryReader = new BinaryReader(fileStream))
                {
                    bfCache.assemblyCollection_0.method_8(binaryReader);
                    bfCache.namespaceCollection_0.method_8(binaryReader);
                    bfCache.typeCollection_0.method_8(binaryReader);
                    bfCache.methodCollection_0.method_8(binaryReader);
                    bfCache.fieldCollection_0.method_8(binaryReader);
                    bfCache.eventCollection_0.method_8(binaryReader);
                    bfCache.assemblyCollection_0.method_7(bfCache);
                    bfCache.namespaceCollection_0.method_7(bfCache);
                    bfCache.typeCollection_0.method_7(bfCache);
                    bfCache.methodCollection_0.method_7(bfCache);
                    bfCache.fieldCollection_0.method_7(bfCache);
                    bfCache.eventCollection_0.method_7(bfCache);
                }
            }
            GC.Collect();
            return(bfCache);
        }
		internal BfMember(BfCache cache, MemberReference memberRef, BfType type)
		{
			this._name = memberRef.Name;
			this._fullName = type.FullName + "." + this._name;
			this._cache = cache;
			this._type = type;
		}
 internal BfMember(BfCache cache, MemberReference memberRef, BfType type)
 {
     this._name     = memberRef.Name;
     this._fullName = type.FullName + "." + this._name;
     this._cache    = cache;
     this._type     = type;
 }
Beispiel #4
0
 internal override void vmethod_2(BfCache cache)
 {
     base.vmethod_2(cache);
     this.bfType_0 = ((this.bfType_0.Id == -1) ? null : cache.Types[this.bfType_0.Id]);
     this.methodCollection_0.method_9(cache);
     this.methodCollection_1.method_9(cache);
 }
Beispiel #5
0
 internal BfAssembly(BfCache cache, AssemblyDefinition assemblyDef, bool isCoreAssembly, string rootDirectory)
 {
     this.int_0 = cache.method_15();
     this.assemblyDefinition_0 = assemblyDef;
     this.string_1             = assemblyDef.Name.Name;
     this.bool_0   = isCoreAssembly;
     this.string_0 = this.assemblyDefinition_0.Name.Version.ToString();
     try
     {
         PdbFactory pdbFactory = new PdbFactory();
         string     text       = Path.Combine(rootDirectory, this.assemblyDefinition_0.Name.Name + ".dll");
         if (System.IO.File.Exists(text))
         {
             this.isymbolReader_0 = pdbFactory.CreateReader(null, text);
         }
         text = Path.Combine(rootDirectory, this.assemblyDefinition_0.Name.Name + ".exe");
         if (System.IO.File.Exists(text))
         {
             this.isymbolReader_0 = pdbFactory.CreateReader(null, text);
         }
     }
     catch (Exception ex)
     {
         Logger.LogWarning("AssemblyConstructor", "Something went wrong " + ex.ToString());
     }
 }
 internal void method_7(BfCache bfCache_0)
 {
     foreach (T current in ((IEnumerable <T>) this))
     {
         current.vmethod_2(bfCache_0);
     }
 }
Beispiel #7
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);
        }
 internal void method_9(BfCache bfCache_0)
 {
     int[] ids = this._ids;
     for (int i = 0; i < ids.Length; i++)
     {
         int index = ids[i];
         this._data.Add(bfCache_0.Namespaces[index]);
     }
     this._ids  = null;
     this._hash = null;
 }
Beispiel #9
0
 internal BfType(BfCache cache, TypeDefinition type, BfAssembly assembly)
 {
     this.typeDefinition_0 = type;
     this.bfCache_0        = cache;
     this.string_1         = this.typeDefinition_0.Name;
     this.bfAssembly_0     = assembly;
     this.bfNamespace_0    = cache.method_13(this);
     this.IsClass          = this.typeDefinition_0.IsClass;
     this.IsEnum           = this.typeDefinition_0.IsEnum;
     this.IsValueType      = this.typeDefinition_0.IsValueType;
     this.IsInterface      = this.typeDefinition_0.IsInterface;
     if (this.typeDefinition_0.IsNestedAssembly)
     {
         this.IsNested   = true;
         this.IsInternal = true;
     }
     if (this.typeDefinition_0.IsNestedFamily)
     {
         this.IsNested    = true;
         this.IsProtected = true;
     }
     if (this.typeDefinition_0.IsNestedFamilyAndAssembly)
     {
         this.IsNested = true;
         this.IsProtectedAndInternal = true;
     }
     if (this.typeDefinition_0.IsNestedFamilyOrAssembly)
     {
         this.IsNested = true;
         this.IsProtectedOrInternal = true;
     }
     if (this.typeDefinition_0.IsNestedPrivate)
     {
         this.IsNested  = true;
         this.IsPrivate = true;
     }
     if (this.typeDefinition_0.IsNestedPublic)
     {
         this.IsNested = true;
         this.IsPublic = true;
     }
     this.IsInternal = this.typeDefinition_0.IsNotPublic;
     this.IsPublic   = this.typeDefinition_0.IsPublic;
     if (this.typeDefinition_0.IsSealed && this.typeDefinition_0.IsAbstract)
     {
         this.IsStatic = true;
     }
     else
     {
         this.IsSealed   = this.typeDefinition_0.IsSealed;
         this.IsAbstract = this.typeDefinition_0.IsAbstract;
     }
 }
Beispiel #10
0
 internal override void vmethod_2(BfCache cache)
 {
     this.bfType_0 = ((this.bfType_0.Id == -1) ? null : cache.Types[this.bfType_0.Id]);
     this.fieldCollection_0.method_9(cache);
     this.methodCollection_0.method_9(cache);
     this.eventCollection_0.method_9(cache);
     this.typeCollection_0.method_9(cache);
     this.typeCollection_1.method_9(cache);
     this.typeCollection_2.method_9(cache);
     this.typeCollection_3.method_9(cache);
     this.bfAssembly_0  = ((this.bfAssembly_0.Id == -1) ? null : cache.Assemblies[this.bfAssembly_0.Id]);
     this.bfNamespace_0 = ((this.bfNamespace_0.Id == -1) ? null : cache.Namespaces[this.bfNamespace_0.Id]);
 }
Beispiel #11
0
 internal BfEvent(BfCache cache, EventDefinition eventDef, BfType type) : base(cache, eventDef, type)
 {
     this.eventDefinition_0 = eventDef;
     this.int_0             = this._cache.method_21();
     this.bfType_0          = this._cache.method_7(this.eventDefinition_0.EventType);
     this._typesUsed.method_1(this.bfType_0);
     this._typesUsed.method_2(this._cache.method_8(this.eventDefinition_0.EventType));
     this._typesUsed.ClearHash();
     this.IsInternal  = this.eventDefinition_0.AddMethod.IsAssembly;
     this.IsProtected = this.eventDefinition_0.AddMethod.IsFamily;
     this.IsPrivate   = this.eventDefinition_0.AddMethod.IsPrivate;
     this.IsPublic    = this.eventDefinition_0.AddMethod.IsPublic;
     this.IsStatic    = this.eventDefinition_0.AddMethod.IsStatic;
     this._cache.Events.method_1(this);
 }
Beispiel #12
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);
 }
 internal BfNamespace(BfCache cache, string fullname)
 {
     this.bfCache_0 = cache;
     string[] array = fullname.Split(new char[]
     {
         '.'
     });
     this.string_0 = array[array.Length - 1];
     this.string_1 = fullname;
     if (fullname == "")
     {
         this.int_0 = 0;
     }
     else
     {
         this.int_0 = array.Length;
     }
     this.int_1 = cache.method_16();
 }
Beispiel #14
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);
        }
		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);
		}
		private void method_5()
		{
			try
			{
				Dictionary<string, AssemblyTuple> dictionary = BfCache.smethod_1(this.ienumerable_0);
				if (Class13.smethod_0())
				{
					IEnumerable<KeyValuePair<string, AssemblyTuple>> arg_35_0 = dictionary;
					if (AnalyzingWindow.func_0 == null)
					{
						AnalyzingWindow.func_0 = new Func<KeyValuePair<string, AssemblyTuple>, bool>(AnalyzingWindow.smethod_0);
					}
					if (arg_35_0.Where(AnalyzingWindow.func_0).Any<KeyValuePair<string, AssemblyTuple>>())
					{
						throw new NitriqException("MergedAssemblies", "Nitriq Free Edition does not allow you analyze assemblies with more than one module (the assembly was probably merged). Nitriq Pro has no restrictions and can be purchased at www.nitriq.com");
					}
				}
				this.bfCache_0 = new BfCache(dictionary);
				base.Dispatcher.Invoke(new Action(this.method_0), new object[0]);
			}
			catch (Exception caughtException)
			{
				this.CaughtException = caughtException;
				base.Dispatcher.Invoke(new Action(this.method_0), new object[0]);
			}
		}
Beispiel #17
0
		internal override void vmethod_2(BfCache cache)
		{
			this.bfType_0 = ((this.bfType_0.Id == -1) ? null : cache.Types[this.bfType_0.Id]);
			this.fieldCollection_0.method_9(cache);
			this.methodCollection_0.method_9(cache);
			this.eventCollection_0.method_9(cache);
			this.typeCollection_0.method_9(cache);
			this.typeCollection_1.method_9(cache);
			this.typeCollection_2.method_9(cache);
			this.typeCollection_3.method_9(cache);
			this.bfAssembly_0 = ((this.bfAssembly_0.Id == -1) ? null : cache.Assemblies[this.bfAssembly_0.Id]);
			this.bfNamespace_0 = ((this.bfNamespace_0.Id == -1) ? null : cache.Namespaces[this.bfNamespace_0.Id]);
		}
Beispiel #18
0
		internal BfType(BfCache cache, TypeDefinition type, BfAssembly assembly)
		{
			this.typeDefinition_0 = type;
			this.bfCache_0 = cache;
			this.string_1 = this.typeDefinition_0.Name;
			this.bfAssembly_0 = assembly;
			this.bfNamespace_0 = cache.method_13(this);
			this.IsClass = this.typeDefinition_0.IsClass;
			this.IsEnum = this.typeDefinition_0.IsEnum;
			this.IsValueType = this.typeDefinition_0.IsValueType;
			this.IsInterface = this.typeDefinition_0.IsInterface;
			if (this.typeDefinition_0.IsNestedAssembly)
			{
				this.IsNested = true;
				this.IsInternal = true;
			}
			if (this.typeDefinition_0.IsNestedFamily)
			{
				this.IsNested = true;
				this.IsProtected = true;
			}
			if (this.typeDefinition_0.IsNestedFamilyAndAssembly)
			{
				this.IsNested = true;
				this.IsProtectedAndInternal = true;
			}
			if (this.typeDefinition_0.IsNestedFamilyOrAssembly)
			{
				this.IsNested = true;
				this.IsProtectedOrInternal = true;
			}
			if (this.typeDefinition_0.IsNestedPrivate)
			{
				this.IsNested = true;
				this.IsPrivate = true;
			}
			if (this.typeDefinition_0.IsNestedPublic)
			{
				this.IsNested = true;
				this.IsPublic = true;
			}
			this.IsInternal = this.typeDefinition_0.IsNotPublic;
			this.IsPublic = this.typeDefinition_0.IsPublic;
			if (this.typeDefinition_0.IsSealed && this.typeDefinition_0.IsAbstract)
			{
				this.IsStatic = true;
			}
			else
			{
				this.IsSealed = this.typeDefinition_0.IsSealed;
				this.IsAbstract = this.typeDefinition_0.IsAbstract;
			}
		}
 internal abstract void vmethod_2(BfCache cache);
		internal void method_6(BfCache value)
		{
			if (this.bfCache_0 != value)
			{
				this.bfCache_0 = value;
				this.FirePropertyChanged("Cache");
				this.method_4();
				this.ClearRuleResultsAndStatuses();
				this.HaveSavedProject = false;
			}
		}
Beispiel #21
0
        internal BfNamespace method_13(BfType bfType_0)
        {
            BfNamespace bfNamespace = null;
            string      text        = null;
            BfNamespace result;

            try
            {
                text = BfCache.smethod_4(bfType_0.method_2().FullName);
                if (!this.sortedDictionary_1.ContainsKey(text))
                {
                    bfNamespace = new BfNamespace(this, text);
                    this.sortedDictionary_1.Add(text, bfNamespace);
                    this.namespaceCollection_0.method_1(bfNamespace);
                }
                else
                {
                    bfNamespace = this.sortedDictionary_1[text];
                }
                if (bfNamespace.Types == null)
                {
                    Logger.LogError("BfNamespace: '" + bfNamespace.FullName + "' had null collection - " + bfType_0.FullName);
                    bfNamespace.Types = new TypeCollection();
                }
                bfNamespace.Types.method_1(bfType_0);
                result = bfNamespace;
            }
            catch (Exception)
            {
                Builder builder = new Builder("\r\n");
                try
                {
                    builder.Append("type == null => " + (bfType_0 == null));
                    builder.Append("type = " + bfType_0.ToString());
                }
                catch
                {
                }
                try
                {
                    builder.Append("type.Assembly = " + bfType_0.Assembly.ToString());
                }
                catch
                {
                }
                try
                {
                    builder.Append("type.TypeDef.Name = " + bfType_0.method_2().Name);
                }
                catch
                {
                }
                try
                {
                    builder.Append("type.TypeDef == null => " + (bfType_0.method_2() == null));
                    builder.Append("type.TypeDef = " + bfType_0.method_2().ToString());
                }
                catch
                {
                }
                try
                {
                    builder.Append("type.TypeDef.FullName == null => " + (bfType_0.method_2().FullName == null));
                    builder.Append("type.TypeDef.FullName = " + bfType_0.method_2().FullName.ToString());
                }
                catch
                {
                }
                try
                {
                    builder.Append("myNamespace == null => " + (text == null));
                    builder.Append("myNamespace = " + text.ToString());
                }
                catch
                {
                }
                try
                {
                    builder.Append("_namespaceDictionary == null => " + (this.sortedDictionary_1 == null));
                    builder.Append("_namespaceDictionary = " + this.sortedDictionary_1.Count <KeyValuePair <string, BfNamespace> >());
                }
                catch
                {
                }
                try
                {
                    builder.Append("_namespaces == null => " + (this.namespaceCollection_0 == null));
                    builder.Append("_namespaces = " + this.namespaceCollection_0.Count <BfNamespace>());
                }
                catch
                {
                }
                try
                {
                    builder.Append("bfNamespace == null => " + (bfNamespace == null));
                    builder.Append("bfNamespace = " + bfNamespace);
                }
                catch
                {
                }
                try
                {
                    builder.Append("bfNamespace.Types == null => " + (bfNamespace.Types == null));
                    builder.Append("bfNamespace.Types = " + bfNamespace.Types.Count <BfType>());
                }
                catch
                {
                }
                throw new NitriqException("NamespaceProblems", builder.ToString());
            }
            return(result);
        }
		public static BfCache Load(string filename)
		{
			BfCache bfCache = new BfCache();
			using (FileStream fileStream = new FileStream(filename, FileMode.Open))
			{
				using (BinaryReader binaryReader = new BinaryReader(fileStream))
				{
					bfCache.assemblyCollection_0.method_8(binaryReader);
					bfCache.namespaceCollection_0.method_8(binaryReader);
					bfCache.typeCollection_0.method_8(binaryReader);
					bfCache.methodCollection_0.method_8(binaryReader);
					bfCache.fieldCollection_0.method_8(binaryReader);
					bfCache.eventCollection_0.method_8(binaryReader);
					bfCache.assemblyCollection_0.method_7(bfCache);
					bfCache.namespaceCollection_0.method_7(bfCache);
					bfCache.typeCollection_0.method_7(bfCache);
					bfCache.methodCollection_0.method_7(bfCache);
					bfCache.fieldCollection_0.method_7(bfCache);
					bfCache.eventCollection_0.method_7(bfCache);
				}
			}
			GC.Collect();
			return bfCache;
		}
		protected virtual BfCache OnCoerceCache(BfCache value)
		{
			return value;
		}
		internal override void vmethod_2(BfCache cache)
		{
			base.vmethod_2(cache);
			this.typeCollection_0.method_9(cache);
			this.bfType_0 = ((this.bfType_0.Id == -1) ? null : cache.Types[this.bfType_0.Id]);
			this.methodCollection_0.method_9(cache);
			this.methodCollection_1.method_9(cache);
			this.fieldCollection_0.method_9(cache);
			this.fieldCollection_1.method_9(cache);
		}
		internal override void vmethod_2(BfCache cache)
		{
			base.vmethod_2(cache);
			this.bfType_0 = cache.Types[this.bfType_0.Id];
		}
		internal BfEvent(BfCache cache, EventDefinition eventDef, BfType type) : base(cache, eventDef, type)
		{
			this.eventDefinition_0 = eventDef;
			this.int_0 = this._cache.method_21();
			this.bfType_0 = this._cache.method_7(this.eventDefinition_0.EventType);
			this._typesUsed.method_1(this.bfType_0);
			this._typesUsed.method_2(this._cache.method_8(this.eventDefinition_0.EventType));
			this._typesUsed.ClearHash();
			this.IsInternal = this.eventDefinition_0.AddMethod.IsAssembly;
			this.IsProtected = this.eventDefinition_0.AddMethod.IsFamily;
			this.IsPrivate = this.eventDefinition_0.AddMethod.IsPrivate;
			this.IsPublic = this.eventDefinition_0.AddMethod.IsPublic;
			this.IsStatic = this.eventDefinition_0.AddMethod.IsStatic;
			this._cache.Events.method_1(this);
		}
Beispiel #27
0
 internal static string smethod_2(TypeReference typeReference_0)
 {
     typeReference_0 = BfCache.smethod_3(typeReference_0);
     return(Regex.Replace(typeReference_0.FullName, "<[^>]+>", ""));
 }
		internal BfAssembly(BfCache cache, AssemblyDefinition assemblyDef, bool isCoreAssembly, string rootDirectory)
		{
			this.int_0 = cache.method_15();
			this.assemblyDefinition_0 = assemblyDef;
			this.string_1 = assemblyDef.Name.Name;
			this.bool_0 = isCoreAssembly;
			this.string_0 = this.assemblyDefinition_0.Name.Version.ToString();
			try
			{
				PdbFactory pdbFactory = new PdbFactory();
				string text = Path.Combine(rootDirectory, this.assemblyDefinition_0.Name.Name + ".dll");
				if (System.IO.File.Exists(text))
				{
					this.isymbolReader_0 = pdbFactory.CreateReader(null, text);
				}
				text = Path.Combine(rootDirectory, this.assemblyDefinition_0.Name.Name + ".exe");
				if (System.IO.File.Exists(text))
				{
					this.isymbolReader_0 = pdbFactory.CreateReader(null, text);
				}
			}
			catch (Exception ex)
			{
				Logger.LogWarning("AssemblyConstructor", "Something went wrong " + ex.ToString());
			}
		}
Beispiel #29
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);
        }
		internal override void vmethod_2(BfCache cache)
		{
			this._type = ((this._type.Id == -1) ? null : cache.Types[this._type.Id]);
			this._typesUsed.method_9(cache);
		}
Beispiel #31
0
 internal override void vmethod_2(BfCache cache)
 {
     this._type = ((this._type.Id == -1) ? null : cache.Types[this._type.Id]);
     this._typesUsed.method_9(cache);
 }
		internal BfMethod(BfCache cache, MethodDefinition methodDef, BfType type) : base(cache, methodDef, type)
		{
			this.methodDefinition_0 = methodDef;
			this.int_0 = this._cache.method_18();
			this.string_0 = BfMethod.smethod_0(this.methodDefinition_0);
			if (type.IsInCoreAssembly)
			{
				this.bfType_0 = cache.method_7(methodDef.ReturnType.ReturnType);
				this._typesUsed.method_2(this._cache.method_8(methodDef.ReturnType.ReturnType));
				this._typesUsed.method_1(this.bfType_0);
				this._typesUsed.method_2(this._cache.method_8(this.methodDefinition_0));
				IEnumerator enumerator;
				if (methodDef.Body != null)
				{
					enumerator = methodDef.Body.Variables.GetEnumerator();
					try
					{
						while (enumerator.MoveNext())
						{
							VariableDefinition variableDefinition = (VariableDefinition)enumerator.Current;
							this._typesUsed.method_2(this._cache.method_8(variableDefinition.VariableType));
							this._typesUsed.method_1(this._cache.method_7(variableDefinition.VariableType));
						}
					}
					finally
					{
						IDisposable disposable = enumerator as IDisposable;
						if (disposable != null)
						{
							disposable.Dispose();
						}
					}
				}
				enumerator = methodDef.Parameters.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						ParameterDefinition parameterDefinition = (ParameterDefinition)enumerator.Current;
						this._typesUsed.method_2(this._cache.method_8(parameterDefinition.ParameterType));
						this._typesUsed.method_1(this._cache.method_7(parameterDefinition.ParameterType));
						this.typeCollection_0.method_2(this._cache.method_8(parameterDefinition.ParameterType));
						this.typeCollection_0.method_1(this._cache.method_7(parameterDefinition.ParameterType));
					}
				}
				finally
				{
					IDisposable disposable = enumerator as IDisposable;
					if (disposable != null)
					{
						disposable.Dispose();
					}
				}
				this.typeCollection_0.ClearHash();
			}
		}
		private static object smethod_0(DependencyObject dependencyObject_0, BfCache bfCache_0)
		{
			IconProvider iconProvider = dependencyObject_0 as IconProvider;
			object result;
			if (iconProvider != null)
			{
				result = iconProvider.OnCoerceCache((BfCache)bfCache_0);
			}
			else
			{
				result = bfCache_0;
			}
			return result;
		}
		protected virtual void OnCacheChanged(BfCache oldValue, BfCache newValue)
		{
		}
Beispiel #35
0
 internal override void vmethod_2(BfCache cache)
 {
     this.namespaceCollection_0.method_9(cache);
 }
		internal override void vmethod_2(BfCache cache)
		{
			this.namespaceCollection_0.method_9(cache);
			this.typeCollection_0.method_9(cache);
		}
		public LightWrapper(IEnumerable results, BfCache cache)
		{
			if (results == null)
			{
				Console.WriteLine("no results");
			}
			else
			{
				object obj = results.OfType<object>().FirstOrDefault<object>();
				if (obj == null)
				{
					Console.WriteLine("results are empty");
				}
				else
				{
					IEnumerable<PropertyInfo> arg_A8_0 = obj.GetType().GetProperties();
					if (LightWrapper.func_0 == null)
					{
						LightWrapper.func_0 = new Func<PropertyInfo, bool>(LightWrapper.smethod_0);
					}
					PropertyInfo propertyInfo = arg_A8_0.FirstOrDefault(LightWrapper.func_0);
					if (propertyInfo != null)
					{
						Dictionary<int, object> idToLeaf = new Dictionary<int, object>();
						foreach (object current in results)
						{
							int key = (int)propertyInfo.GetGetMethod().Invoke(current, null);
							if (!idToLeaf.ContainsKey(key))
							{
								idToLeaf.Add(key, current);
							}
						}
						if (string.Compare(propertyInfo.Name, "MethodId", true) == 0)
						{
							var enumerable = from method in cache.Methods
							where idToLeaf.ContainsKey(method.MethodId)
							select new
							{
								Type = method.Type,
								Assembly = method.Type.Assembly,
								Namespace = method.Type.Namespace,
								Leaf = idToLeaf[method.MethodId]
							};
							string childType = "Method";
							foreach (var current2 in enumerable)
							{
								LightAssembly lightAssembly = new LightAssembly(current2.Assembly, childType);
								lightAssembly = this.Assemblies.method_2(lightAssembly);
								LightNamespace lightNamespace = new LightNamespace(current2.Namespace, childType);
								lightNamespace = lightAssembly.Namespaces.method_2(lightNamespace);
								LightNamespace lightNamespace2 = new LightNamespace(current2.Namespace, childType);
								lightNamespace2 = this.Namespaces.method_2(lightNamespace2);
								LightType lightType = new LightType(current2.Type, childType);
								lightType = this.Types.method_2(lightType);
								lightNamespace.Types.method_2(lightType);
								lightNamespace2.Types.method_2(lightType);
								lightType.Children.method_2(current2.Leaf);
								this.TypesChildren.method_2(current2.Leaf);
							}
						}
						if (string.Compare(propertyInfo.Name, "FieldId", true) == 0)
						{
							var enumerable = from field in cache.Fields
							where idToLeaf.ContainsKey(field.FieldId)
							select new
							{
								Type = field.Type,
								Assembly = field.Type.Assembly,
								Namespace = field.Type.Namespace,
								Leaf = idToLeaf[field.FieldId]
							};
							string childType = "Field";
							foreach (var current2 in enumerable)
							{
								LightAssembly lightAssembly = new LightAssembly(current2.Assembly, childType);
								lightAssembly = this.Assemblies.method_2(lightAssembly);
								LightNamespace lightNamespace = new LightNamespace(current2.Namespace, childType);
								lightNamespace = lightAssembly.Namespaces.method_2(lightNamespace);
								LightNamespace lightNamespace2 = new LightNamespace(current2.Namespace, childType);
								lightNamespace2 = this.Namespaces.method_2(lightNamespace2);
								LightType lightType = new LightType(current2.Type, childType);
								lightType = this.Types.method_2(lightType);
								lightNamespace.Types.method_2(lightType);
								lightNamespace2.Types.method_2(lightType);
								lightType.Children.method_2(current2.Leaf);
								this.TypesChildren.method_2(current2.Leaf);
							}
						}
						if (string.Compare(propertyInfo.Name, "EventId", true) == 0)
						{
							var enumerable = from ev in cache.Events
							where idToLeaf.ContainsKey(ev.EventId)
							select new
							{
								Type = ev.Type,
								Assembly = ev.Type.Assembly,
								Namespace = ev.Type.Namespace,
								Leaf = idToLeaf[ev.EventId]
							};
							string childType = "Event";
							foreach (var current2 in enumerable)
							{
								LightAssembly lightAssembly = new LightAssembly(current2.Assembly, childType);
								lightAssembly = this.Assemblies.method_2(lightAssembly);
								LightNamespace lightNamespace = new LightNamespace(current2.Namespace, childType);
								lightNamespace = lightAssembly.Namespaces.method_2(lightNamespace);
								LightNamespace lightNamespace2 = new LightNamespace(current2.Namespace, childType);
								lightNamespace2 = this.Namespaces.method_2(lightNamespace2);
								LightType lightType = new LightType(current2.Type, childType);
								lightType = this.Types.method_2(lightType);
								lightNamespace.Types.method_2(lightType);
								lightNamespace2.Types.method_2(lightType);
								lightType.Children.method_2(current2.Leaf);
								this.TypesChildren.method_2(current2.Leaf);
							}
						}
						if (string.Compare(propertyInfo.Name, "TypeId", true) == 0)
						{
							var enumerable2 = from type in cache.Types
							where idToLeaf.ContainsKey(type.TypeId)
							select new
							{
								type = type,
								Assembly = type.Assembly,
								Namespace = type.Namespace,
								Leaf = idToLeaf[type.TypeId]
							};
							string childType = "Type";
							foreach (var current3 in enumerable2)
							{
								LightAssembly lightAssembly = new LightAssembly(current3.Assembly, childType);
								lightAssembly = this.Assemblies.method_2(lightAssembly);
								LightNamespace lightNamespace = new LightNamespace(current3.Namespace, childType);
								lightNamespace = lightAssembly.Namespaces.method_2(lightNamespace);
								LightNamespace lightNamespace2 = new LightNamespace(current3.Namespace, childType);
								lightNamespace2 = this.Namespaces.method_2(lightNamespace2);
								LightType lightType = new LightType(current3.type, childType);
								lightType = this.Types.method_2(lightType);
								lightNamespace.Types.method_2(lightType);
								lightNamespace2.Types.method_2(lightType);
								lightNamespace.Children.method_2(current3.Leaf);
								lightNamespace2.Children.method_2(current3.Leaf);
								this.TypesChildren.method_2(current3.Leaf);
							}
						}
						if (string.Compare(propertyInfo.Name, "NamespaceId", true) == 0)
						{
							var enumerable3 = from nspace in cache.Namespaces
							where idToLeaf.ContainsKey(nspace.NamespaceId)
							select new
							{
								nspace = nspace,
								Leaf = idToLeaf[nspace.NamespaceId]
							};
							string childType = "GeneralNamespace";
							foreach (var current4 in enumerable3)
							{
								LightNamespace lightNamespace2 = new LightNamespace(current4.nspace, childType);
								lightNamespace2 = this.Namespaces.method_2(lightNamespace2);
								lightNamespace2.Children.method_2(current4.Leaf);
							}
						}
						if (string.Compare(propertyInfo.Name, "AssemblyId", true) == 0)
						{
							var enumerable4 = from assembly in cache.Assemblies
							where idToLeaf.ContainsKey(assembly.AssemblyId)
							select new
							{
								assembly = assembly,
								Leaf = idToLeaf[assembly.AssemblyId]
							};
							string childType = "Assembly";
							foreach (var current5 in enumerable4)
							{
								LightAssembly lightAssembly2 = new LightAssembly(current5.assembly, childType);
								this.Assemblies.method_2(lightAssembly2);
								lightAssembly2.Children.method_2(current5.Leaf);
							}
						}
					}
					LightCollection<LightAssembly> arg_863_0 = this.lightCollection_0;
					if (LightWrapper.comparison_0 == null)
					{
						LightWrapper.comparison_0 = new Comparison<LightAssembly>(LightWrapper.smethod_1);
					}
					arg_863_0.method_1(LightWrapper.comparison_0);
					foreach (LightAssembly lightAssembly in ((IEnumerable<LightAssembly>)this.lightCollection_0))
					{
						LightAssembly lightAssembly;
						LightCollection<LightNamespace> arg_8A8_0 = lightAssembly.Namespaces;
						if (LightWrapper.comparison_1 == null)
						{
							LightWrapper.comparison_1 = new Comparison<LightNamespace>(LightWrapper.smethod_2);
						}
						arg_8A8_0.method_1(LightWrapper.comparison_1);
						foreach (LightNamespace current6 in ((IEnumerable<LightNamespace>)lightAssembly.Namespaces))
						{
							LightCollection<LightType> arg_8EB_0 = current6.Types;
							if (LightWrapper.comparison_2 == null)
							{
								LightWrapper.comparison_2 = new Comparison<LightType>(LightWrapper.smethod_3);
							}
							arg_8EB_0.method_1(LightWrapper.comparison_2);
						}
					}
					LightCollection<LightNamespace> arg_94A_0 = this.lightCollection_1;
					if (LightWrapper.comparison_3 == null)
					{
						LightWrapper.comparison_3 = new Comparison<LightNamespace>(LightWrapper.smethod_4);
					}
					arg_94A_0.method_1(LightWrapper.comparison_3);
					foreach (LightNamespace current6 in ((IEnumerable<LightNamespace>)this.lightCollection_1))
					{
						LightCollection<LightType> arg_98C_0 = current6.Types;
						if (LightWrapper.comparison_4 == null)
						{
							LightWrapper.comparison_4 = new Comparison<LightType>(LightWrapper.smethod_5);
						}
						arg_98C_0.method_1(LightWrapper.comparison_4);
					}
					LightCollection<LightType> arg_9CE_0 = this.lightCollection_2;
					if (LightWrapper.comparison_5 == null)
					{
						LightWrapper.comparison_5 = new Comparison<LightType>(LightWrapper.smethod_6);
					}
					arg_9CE_0.method_1(LightWrapper.comparison_5);
				}
			}
		}
		internal BfNamespace(BfCache cache, string fullname)
		{
			this.bfCache_0 = cache;
			string[] array = fullname.Split(new char[]
			{
				'.'
			});
			this.string_0 = array[array.Length - 1];
			this.string_1 = fullname;
			if (fullname == "")
			{
				this.int_0 = 0;
			}
			else
			{
				this.int_0 = array.Length;
			}
			this.int_1 = cache.method_16();
		}
Beispiel #39
0
 internal override void vmethod_2(BfCache cache)
 {
     base.vmethod_2(cache);
     this.bfType_0 = cache.Types[this.bfType_0.Id];
 }
		internal abstract void vmethod_2(BfCache cache);