/// <summary> /// Initializes a new instance of the <see cref="PdbStringTable"/> class. /// </summary> /// <param name="reader">Stream binary reader.</param> public PdbStringTable(IBinaryReader reader) { // Read header Signature = reader.ReadUint(); HashVersion = reader.ReadUint(); StringsStreamSize = reader.ReadUint(); // Read strings table StringsStream = reader.ReadSubstream(StringsStreamSize); stringsCache = new DictionaryCache <uint, string>((uint offset) => { StringsStream.Position = offset; return(StringsStream.ReadCString().String); }); // Read table of offsets that can be accessed by hash function uint offsetsCount = reader.ReadUint(); Offsets = reader.ReadUintArray((int)offsetsCount); // Read epilogue StringsCount = reader.ReadInt(); dictionaryCache = SimpleCache.CreateStruct(() => { Dictionary <uint, string> strings = new Dictionary <uint, string>(); foreach (uint offset in Offsets) { strings[offset] = stringsCache[offset]; } return(strings); }); }
/// <summary> /// Initializes a new instance of the <see cref="PdbStringTable"/> class. /// </summary> /// <param name="reader">Stream binary reader.</param> public PdbStringTable(IBinaryReader reader) { // Read header Signature = reader.ReadUint(); HashVersion = reader.ReadUint(); StringsStreamSize = reader.ReadUint(); // Read strings table StringsStream = reader.ReadSubstream(StringsStreamSize); stringsCache = new DictionaryCache <uint, string>((uint offset) => { StringsStream.Position = offset; return(StringsStream.ReadCString()); }); // Read table of offsets that can be accessed by hash function uint offsetsCount = reader.ReadUint(); Offsets = reader.ReadUintArray((int)offsetsCount); // Read epilogue StringsCount = reader.ReadInt(); }