Example #1
0
        public static void      InspectModule(AssemblyUsages result, ModuleDefinition moduleDef)
        {
            if (AssemblyUsagesExtractor.debug > 1)
            {
                AssemblyUsagesExtractor.Log("Module {0}", moduleDef);
            }

            using (AutoIndent.Instance)
            {
                AssemblyUsagesExtractor.InspectAttributes(result, moduleDef);

                if (moduleDef.HasTypes == true)
                {
                    int filterNamespacesLength = result.FilterNamespaces.Length;

                    foreach (TypeDefinition typeDef in moduleDef.Types)
                    {
                        if (filterNamespacesLength == 0 || AssemblyUsagesExtractor.IsFilteredIn(result.FilterNamespaces, typeDef.Namespace) == true)
                        {
                            AssemblyUsagesExtractor.InspectType(result, typeDef);
                        }
                    }
                }
            }
        }
Example #2
0
        public static void      InspectType(AssemblyUsages result, TypeDefinition typeDef)
        {
            if (AssemblyUsagesExtractor.debug > 1)
            {
                AssemblyUsagesExtractor.Log("Type {0}", typeDef);
            }

            using (AutoIndent.Instance)
            {
                AssemblyUsagesExtractor.InspectAttributes(result, typeDef);
                AssemblyUsagesExtractor.InspectSecurityDeclarations(result, typeDef);
                AssemblyUsagesExtractor.InspectGenericParameters(result, typeDef);

                if (typeDef.HasInterfaces == true)
                {
                    foreach (InterfaceImplementation interfaceImpl in typeDef.Interfaces)
                    {
                        AssemblyUsagesExtractor.InspectInterface(result, interfaceImpl);
                    }
                }

                if (typeDef.HasNestedTypes == true)
                {
                    foreach (TypeDefinition nestedType in typeDef.NestedTypes)
                    {
                        AssemblyUsagesExtractor.InspectType(result, nestedType);
                    }
                }

                if (typeDef.HasEvents == true)
                {
                    foreach (EventDefinition eventDef in typeDef.Events)
                    {
                        AssemblyUsagesExtractor.InspectEvent(result, eventDef);
                    }
                }

                if (typeDef.HasFields == true)
                {
                    foreach (FieldDefinition fieldDef in typeDef.Fields)
                    {
                        AssemblyUsagesExtractor.InspectField(result, fieldDef);
                    }
                }

                if (typeDef.HasProperties == true)
                {
                    foreach (PropertyDefinition propertyDef in typeDef.Properties)
                    {
                        AssemblyUsagesExtractor.InspectProperty(result, propertyDef);
                    }
                }

                if (typeDef.HasMethods == true)
                {
                    foreach (MethodDefinition methodDef in typeDef.Methods)
                    {
                        AssemblyUsagesExtractor.InspectMethod(result, methodDef);
                    }
                }
            }
        }