Esempio n. 1
0
        /*^
         #pragma warning disable 2669
         * ^*/

        /// <summary>
        /// Allocates a factory for loading assemblies and modules persisted as portable executable (pe) files.
        /// </summary>
        /// <param name="metadataReaderHost">
        /// The host is used for providing access to pe files (OpenBinaryDocument),
        /// applying host specific unification policies (UnifyAssembly, UnifyAssemblyReference, UnifyModuleReference) and for deciding
        /// whether and how to load referenced assemblies and modules (ResolvingAssemblyReference, ResolvingModuleReference).
        /// </param>
        public PeReader(
            IMetadataReaderHost metadataReaderHost
            )
        {
            this.ErrorsReporter     = new MetadataReaderErrorsReporter();
            this.metadataReaderHost = metadataReaderHost;
            _internedIdToModuleMap  = new Hashtable <Module>();
            INameTable nameTable = metadataReaderHost.NameTable;

            this.value__               = nameTable.GetNameFor("value__");
            this.AsyncCallback         = nameTable.GetNameFor("AsyncCallback");
            this.ParamArrayAttribute   = nameTable.GetNameFor("ParamArrayAttribute");
            this.IAsyncResult          = nameTable.GetNameFor("IAsyncResult");
            this.ICloneable            = nameTable.GetNameFor("ICloneable");
            this.RuntimeArgumentHandle = nameTable.GetNameFor("RuntimeArgumentHandle");
            this.RuntimeFieldHandle    = nameTable.GetNameFor("RuntimeFieldHandle");
            this.RuntimeMethodHandle   = nameTable.GetNameFor("RuntimeMethodHandle");
            this.RuntimeTypeHandle     = nameTable.GetNameFor("RuntimeTypeHandle");
            this.ArgIterator           = nameTable.GetNameFor("ArgIterator");
            this.IList        = nameTable.GetNameFor("IList");
            this.IEnumerable  = nameTable.GetNameFor("IEnumerable");
            this.IList1       = nameTable.GetNameFor("IList`1");
            this.ICollection1 = nameTable.GetNameFor("ICollection`1");
            this.IEnumerable1 = nameTable.GetNameFor("IEnumerable`1");
            this.Mscorlib     = nameTable.GetNameFor("mscorlib");
            this.System_Collections_Generic = nameTable.GetNameFor("System.Collections.Generic");
            this._Deleted_ = nameTable.GetNameFor("_Deleted*");
            this._Module_  = nameTable.GetNameFor("<Module>");
        }
Esempio n. 2
0
 /*^
 #pragma warning disable 2669
 ^*/
 /// <summary>
 /// Allocates a factory for loading assemblies and modules persisted as portable executable (pe) files.
 /// </summary>
 /// <param name="metadataReaderHost">
 /// The host is used for providing access to pe files (OpenBinaryDocument),
 /// applying host specific unification policies (UnifyAssembly, UnifyAssemblyReference, UnifyModuleReference) and for deciding
 /// whether and how to load referenced assemblies and modules (ResolvingAssemblyReference, ResolvingModuleReference).    
 /// </param>
 public PeReader(
   IMetadataReaderHost metadataReaderHost
 ) {
   this.ErrorsReporter = new MetadataReaderErrorsReporter();
   this.metadataReaderHost = metadataReaderHost;
   this.InternedIdToModuleMap = new Hashtable<Module>();
   INameTable nameTable = metadataReaderHost.NameTable;
   this.Value__ = nameTable.GetNameFor("value__");
   this.AsyncCallback = nameTable.GetNameFor("AsyncCallback");
   this.ParamArrayAttribute = nameTable.GetNameFor("ParamArrayAttribute");
   this.IAsyncResult = nameTable.GetNameFor("IAsyncResult");
   this.ICloneable = nameTable.GetNameFor("ICloneable");
   this.RuntimeArgumentHandle = nameTable.GetNameFor("RuntimeArgumentHandle");
   this.RuntimeFieldHandle = nameTable.GetNameFor("RuntimeFieldHandle");
   this.RuntimeMethodHandle = nameTable.GetNameFor("RuntimeMethodHandle");
   this.RuntimeTypeHandle = nameTable.GetNameFor("RuntimeTypeHandle");
   this.ArgIterator = nameTable.GetNameFor("ArgIterator");
   this.IList = nameTable.GetNameFor("IList");
   this.Mscorlib = nameTable.GetNameFor("mscorlib");
   this.System_Runtime = nameTable.GetNameFor("System.Runtime");
   this._Deleted_ = nameTable.GetNameFor("_Deleted*");
 }