예제 #1
0
 void IMetadataProvider.Read(TokenTypes token, out AssemblyRefRow result)
 {
     TableHeap theap = (TableHeap)_streams[(int)HeapType.Tables];
     theap.Read(token, out result);
 }
예제 #2
0
파일: TableHeap.cs 프로젝트: hj1980/Mosa
        /// <summary>
        /// Reads the specified token.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <param name="result">The result.</param>
        public void Read(TokenTypes token, out AssemblyRefRow result)
        {
            if ((token & TokenTypes.TableMask) != TokenTypes.AssemblyRef)
                throw new ArgumentException ("Invalid token type for AssemblyRefRow.", "token");

            using (BinaryReader reader = CreateReaderForToken (token))
            {
                result = new AssemblyRefRow (reader.ReadUInt16 (), reader.ReadUInt16 (), reader.ReadUInt16 (), reader.ReadUInt16 (), (AssemblyFlags)reader.ReadUInt32 (), ReadIndexValue (reader, IndexType.BlobHeap), ReadIndexValue (reader, IndexType.StringHeap), ReadIndexValue (reader, IndexType.StringHeap), ReadIndexValue (reader, IndexType.BlobHeap));
            }
        }
예제 #3
0
        /// <summary>
        /// Resolves the given assembly reference and loads the associated IMetadataModule.
        /// </summary>
        /// <param name="provider">The metadata provider, which contained the assembly reference.</param>
        /// <param name="assemblyRef">The assembly reference to resolve.</param>
        /// <returns>
        /// An instance of IMetadataModule representing the resolved assembly.
        /// </returns>
        public IMetadataModule Resolve(IMetadataProvider provider, AssemblyRefRow assemblyRef)
        {
            string name;
            provider.Read(assemblyRef.NameIdx, out name);

            IMetadataModule result = GetLoadedAssembly(name) ?? DoLoadAssembly(name + ".dll");
            if (result == null)
                throw new TypeLoadException();

            return result;
        }
예제 #4
0
 public AssemblyRefRowExt(IMetadataProvider metadata, AssemblyRefRow row)
     : base(metadata)
 {
     this.row = row;
 }