示例#1
0
        public static AssemblyApi Traverse(string path)
        {
            if (string.IsNullOrWhiteSpace(path))
                throw new ArgumentException("Assembly Path should not be empty.");

            using (MetadataReaderHost host = new PeReader.DefaultHost())
            {
                IModule module = host.LoadUnitFrom(path) as IModule;
                if (module == null || module is Dummy)
                {
                    Environment.Exit(1);
                    throw new ArgumentException("'{0}' is not a PE file containing a CLR module or assembly.", path);
                }
                var t = new ApiTraverser(host, module.ContainingAssembly);
                t.Traverse(module);
                return t.Assembly;
            }
        }
示例#2
0
        public static AssemblyApi Traverse(string path)
        {
            if (string.IsNullOrWhiteSpace(path))
            {
                throw new ArgumentException("Assembly Path should not be empty.");
            }

            using (MetadataReaderHost host = new PeReader.DefaultHost())
            {
                IModule module = host.LoadUnitFrom(path) as IModule;
                if (module == null || module is Dummy)
                {
                    Environment.Exit(1);
                    throw new ArgumentException("'{0}' is not a PE file containing a CLR module or assembly.", path);
                }
                var t = new ApiTraverser(host, module.ContainingAssembly);
                t.Traverse(module);
                return(t.Assembly);
            }
        }