示例#1
0
 internal void OnAssemblyLoaded(Assembly assembly)
 {
     foreach (var module in assembly.GetModules()) {
         NamespaceTree tree = new NamespaceTree();
         tree.Add(module.GetMetadataTables());
         ObjectModule.AddClrModules(tree.Root);
     }
 }
示例#2
0
文件: Program.cs 项目: kerwon/dlr
        private static void DumpTables(
            IEnumerable <MetadataTables> allTables,
            bool dumpPE,
            bool dumpModule,
            bool dumpStatistics,
            bool dumpNamespaces,
            bool dumpExtensionMethods,
            bool dumpNestedTypes,
            bool dumpMembers,
            bool dumpMemberDetails)
        {
            var tree = new NamespaceTree();

            foreach (MetadataTables tables in allTables)
            {
#if DEBUG && CCI
                if (dumpPE && !tables.AssemblyDef.Record.IsNull)
                {
                    tables.Dump(_output);
                }
#endif
                if (dumpModule)
                {
                    DumpModule(tables);
                }
                if (dumpNestedTypes)
                {
                    _output.WriteLine("Nested types in {0}", MdTablesToString(tables));
                    DumpNestedTypes(tables);
                }
                if (dumpExtensionMethods)
                {
                    _output.WriteLine("Extension methods in {0}", MdTablesToString(tables));
                    DumpExtensionMethods(tables);
                }
                if (dumpMembers)
                {
                    _output.WriteLine("Members");
                    Detailed = dumpMemberDetails;
                    DumpMembers(tables);
                }
                if (dumpNamespaces)
                {
                    tree.Add(tables);
                }
            }

            if (dumpStatistics)
            {
                Statistics(tree, true);
            }

            if (dumpNamespaces)
            {
                DumpNamespaceTree(tree.Root);
            }
        }
示例#3
0
 internal void OnAssemblyLoaded(Assembly assembly)
 {
     foreach (var module in assembly.GetModules())
     {
         NamespaceTree tree = new NamespaceTree();
         tree.Add(module.GetMetadataTables());
         ObjectModule.AddClrModules(tree.Root);
     }
 }
示例#4
0
文件: Program.cs 项目: kerwon/dlr
        private static void DumpMemMappedAssemblies()
        {
            var tree = new NamespaceTree();

            foreach (var file in Directory.GetFiles(Path.GetDirectoryName(typeof(object).Assembly.Location), "*.dll"))
            {
                try {
                    tree.Add(MetadataTables.OpenFile(file));
                    _output.WriteLine(file);
                } catch {
                }
            }
            DumpNamespaceTree(tree.Root);
            Statistics(tree, true);
        }
示例#5
0
文件: Program.cs 项目: kerwon/dlr
        private static void Enumerate(IEnumerable <MetadataTables> tables)
        {
            var tree = new NamespaceTree();

            foreach (var moduleTables in tables)
            {
                EnumerateExtensionMethods(moduleTables);
                tree.Add(moduleTables);
                ModuleEnumerated(moduleTables);
            }

            Counter_Types +=
                (from ns in tree.GetAllNamespaces()
                 from t in ns.GetTypeDefs()
                 select 1).Count();
        }
示例#6
0
文件: Program.cs 项目: kerwon/dlr
        private static void Statistics(NamespaceTree tree, bool dump)
        {
            var x =
                from ns in tree.GetAllNamespaces()
                let count = ns.GetTypeDefs().Count()
                            group ns by count into g
                            let gCount = g.Count()
                                         orderby g.Key descending
                                         select new { Size = g.Key, Count = gCount };

            foreach (var p in x)
            {
                if (dump)
                {
                    _output.WriteLine("{0}\t{1}", p.Size, p.Count);
                }
            }

            Counter_Types = x.Sum((a) => a.Size);
            if (dump)
            {
                _output.WriteLine("Namespace size: total {0}, avg {1}", Counter_Types, x.Average((a) => a.Size));
            }
        }
示例#7
0
文件: Program.cs 项目: TerabyteX/main
        private static void Statistics(NamespaceTree tree, bool dump)
        {
            var x =
                from ns in tree.GetAllNamespaces()
                let count = ns.GetTypeDefs().Count()
                group ns by count into g
                let gCount = g.Count()
                orderby g.Key descending
                select new { Size = g.Key, Count = gCount };

            foreach (var p in x) {
                if (dump) {
                    _output.WriteLine("{0}\t{1}", p.Size, p.Count);
                }
            }

            Counter_Types = x.Sum((a) => a.Size);
            if (dump) {
                _output.WriteLine("Namespace size: total {0}, avg {1}", Counter_Types, x.Average((a) => a.Size));
            }
        }
示例#8
0
文件: Program.cs 项目: TerabyteX/main
        private static void Enumerate(IEnumerable<MetadataTables> tables)
        {
            var tree = new NamespaceTree();
            foreach (var moduleTables in tables) {
                EnumerateExtensionMethods(moduleTables);
                tree.Add(moduleTables);
                ModuleEnumerated(moduleTables);
            }

            Counter_Types +=
                (from ns in tree.GetAllNamespaces()
                 from t in ns.GetTypeDefs()
                 select 1).Count();
        }
示例#9
0
文件: Program.cs 项目: TerabyteX/main
        private static void DumpTables(
            IEnumerable<MetadataTables> allTables,
            bool dumpPE,
            bool dumpModule,
            bool dumpStatistics,
            bool dumpNamespaces,
            bool dumpExtensionMethods,
            bool dumpNestedTypes,
            bool dumpMembers,
            bool dumpMemberDetails)
        {
            var tree = new NamespaceTree();
            foreach (MetadataTables tables in allTables) {
            #if DEBUG && CCI
                if (dumpPE && !tables.AssemblyDef.Record.IsNull) {
                    tables.Dump(_output);
                }
            #endif
                if (dumpModule) {
                    DumpModule(tables);
                }
                if (dumpNestedTypes) {
                    _output.WriteLine("Nested types in {0}", MdTablesToString(tables));
                    DumpNestedTypes(tables);
                }
                if (dumpExtensionMethods) {
                    _output.WriteLine("Extension methods in {0}", MdTablesToString(tables));
                    DumpExtensionMethods(tables);
                }
                if (dumpMembers) {
                    _output.WriteLine("Members");
                    Detailed = dumpMemberDetails;
                    DumpMembers(tables);
                }
                if (dumpNamespaces) {
                    tree.Add(tables);
                }
            }

            if (dumpStatistics) {
                Statistics(tree, true);
            }

            if (dumpNamespaces) {
                DumpNamespaceTree(tree.Root);
            }
        }
示例#10
0
文件: Program.cs 项目: TerabyteX/main
 private static void DumpMemMappedAssemblies()
 {
     var tree = new NamespaceTree();
     foreach (var file in Directory.GetFiles(Path.GetDirectoryName(typeof(object).Assembly.Location), "*.dll")) {
         try {
             tree.Add(MetadataTables.OpenFile(file));
             _output.WriteLine(file);
         } catch {
         }
     }
     DumpNamespaceTree(tree.Root);
     Statistics(tree, true);
 }