/// <summary>Create instance of BLOB heap class</summary> /// <param name="meta">MetaData directory</param> /// <param name="header">.NET stream header</param> /// <exception cref="T:InvalidOperationException">Blob heap can read only UnicodeString and Blob heaps</exception> public BlobHeap(MetaData meta, Cor.STREAM_HEADER header) : base(meta, header) { if (base.Header.Type != Cor.StreamHeaderType.UnicodeSting && base.Header.Type != Cor.StreamHeaderType.Blob) { throw new InvalidOperationException(); } }
/// <summary>Create instance of Guid heap class</summary> /// <param name="meta">MetaData directory</param> /// <param name="header">.NET stream header</param> /// <exception cref="T:InvalidOperationException">GuidHeap can only read Guid heaps</exception> public GuidHeap(MetaData meta, Cor.STREAM_HEADER header) : base(meta, header) { if (base.Header.Type != Cor.StreamHeaderType.Guid) { throw new InvalidOperationException(); } }
/// <summary>Create instance of stream tables class</summary> /// <param name="meta">MetaData directory</param> /// <param name="header">stream header</param> /// <exception cref="T:InvalidOperationException">StreamTable can only read optimized or unoptimized stream tables</exception> public StreamTables(MetaData meta, Cor.STREAM_HEADER header) : base(meta, header) { if (header.Type != Cor.StreamHeaderType.StreamTable && header.Type != Cor.StreamHeaderType.StreamTableUnoptimized) { throw new InvalidOperationException(); } }
private IEnumerable <StreamHeader> GetStreams() { var meta = this.Header; if (meta.HasValue) { UInt32 position = base.Directory.VirtualAddress + MetaData.SizeOfCor20Metadata1 + meta.Value.Length + MetaData.SizeOfCor20MetaData2; for (Int32 loop = 0; loop < meta.Value.Streams; loop++) { Cor.STREAM_HEADER header = base.Parent.Parent.Header.PtrToStructure <Cor.STREAM_HEADER>(position); switch (header.Type) { case Cor.StreamHeaderType.StreamTable: case Cor.StreamHeaderType.StreamTableUnoptimized: //TODO: Не проверено. Пока ещё не нашёл ни одного файла с таким заголовком yield return(new StreamTables(this, header)); break; case Cor.StreamHeaderType.Guid: yield return(new GuidHeap(this, header)); break; case Cor.StreamHeaderType.Blob: yield return(new BlobHeap(this, header)); break; case Cor.StreamHeaderType.String: yield return(new StringHeap(this, header)); break; case Cor.StreamHeaderType.UnicodeSting: yield return(new USHeap(this, header)); break; default: yield return(new StreamHeader(this, header)); break; } Int32 length = header.Name.Length + 1; Int32 padding = ((length % 4) != 0) ? (4 - (length % 4)) : 0; position += sizeof(UInt32) * 2 + (UInt32)length + (UInt32)padding; } } }
/// <summary>Create instance of the typed stream header</summary> /// <param name="loader">MetaData</param> /// <param name="header">Stream header</param> public StreamHeaderTyped(MetaData loader, Cor.STREAM_HEADER header) : base(loader, header) { }
/// <summary>Create instance of stream header class</summary> /// <param name="loader">MetaData</param> /// <param name="header">Stream header</param> public StreamHeader(MetaData loader, Cor.STREAM_HEADER header) { this._meta = loader; this._header = header; }
// TODO: Неизвестно как правильно обращаться к элементам массива. См. комментарий к методу DataString //private SortedList<Int32, String> _data; /// <summary>Create instance of user strings heap class</summary> /// <param name="meta">MetaData directory</param> /// <param name="header">.NET stream header</param> public USHeap(MetaData meta, Cor.STREAM_HEADER header) : base(meta, header) { }