Exemplo n.º 1
0
        private AssemblyNode ReadAssembly()
        {
            try
            {
                AssemblyNode assembly = new AssemblyNode(new Module.TypeNodeProvider(this.GetTypeFromName),
                  new Module.TypeNodeListProvider(this.GetTypeList), new Module.CustomAttributeProvider(this.GetCustomAttributesFor),
                  new Module.ResourceProvider(this.GetResources), this.directory);
                assembly.reader = this;
                this.ReadModuleProperties(assembly);
                this.ReadAssemblyProperties(assembly); //Hashvalue, Name, etc.
                this.module = assembly;
                this.ReadAssemblyReferences(assembly);
                this.ReadModuleReferences(assembly);
                AssemblyNode cachedAssembly = this.GetCachedAssembly(assembly);
                if (cachedAssembly != null) return cachedAssembly;
                if (this.getDebugSymbols) assembly.SetupDebugReader(null);

                assembly.AfterAssemblyLoadProcessing();

                return assembly;
            }
            catch (Exception e)
            {
                if (this.module == null) return null;
                if (this.module.MetadataImportErrors == null) this.module.MetadataImportErrors = new ArrayList();
                this.module.MetadataImportErrors.Add(e);
                return this.module as AssemblyNode;
            }
        }