public NameIndexTableReader(SpanStream r) { byte[] stringTableData = Deserializers.ReadBuffer(r); rdr = new SpanStream(stringTableData); Offset_Index = Deserializers.ReadMap <uint, uint>(r); MaxIndices = r.ReadUInt32(); // reverse of Offset_Index Index_Offset = Offset_Index.ToDictionary(x => x.Value, x => x.Key); }
public TPIHashReader(IServiceContainer ctx, byte[] hashData) : base(hashData) { TPIReader tpi = ctx.GetService <TPIReader>(); TPIHash hash = tpi.Header.Hash; switch (hash.HashKeySize) { case sizeof(UInt16): case sizeof(UInt32): break; default: throw new InvalidDataException(); } if (hash.TypeOffsets.Size > 0) { Position = hash.TypeOffsets.Offset; uint NumTiPairs = (uint)(hash.TypeOffsets.Size / Marshal.SizeOf <TIOffset>()); for (int i = 1; i < NumTiPairs; i++) { TIOffset tiOff = Read <TIOffset>(); TypeIndexToOffset.Add(tiOff.TypeIndex, tiOff.Offset); } } if (hash.HashValues.Size > 0) { Position = hash.HashValues.Offset; uint NumHashValues = hash.HashValues.Size / sizeof(UInt32); RecordHashValues = PerformAt(hash.HashValues.Offset, () => { return(Enumerable.Range(1, (int)NumHashValues) .Select(_ => ReadUInt32()) .ToArray()); }); } if (hash.HashHeadList.Size > 0) { Position = hash.HashHeadList.Offset; NameIndexToTypeIndex = Deserializers.ReadMap <UInt32, UInt32>(this); } }