Exemple #1
0
        public NameTableReader(SpanStream r)
        {
            UInt32 magic = r.ReadUInt32();

            if (magic != MAGIC)
            {
                throw new InvalidDataException($"Invalid verHdr magic 0x{magic:X}");
            }

            Version = r.ReadEnum <NameTableVersion>();
            switch (Version)
            {
            case NameTableVersion.Hash:
                hasher = HasherV1.HashData;
                break;

            case NameTableVersion.HashV2:
                hasher = HasherV2.HashData;
                break;
            }

            byte[] buf = Deserializers.ReadBuffer(r);
            rdr = new SpanStream(buf);

            Indices          = Deserializers.ReadArray <UInt32>(r);
            NumberOfElements = r.ReadUInt32();
        }
        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);
        }
Exemple #3
0
        public UdtNameTableReader(IServiceContainer ctx, byte[] namesData) : base(namesData)
        {
            this.Tpi      = ctx.GetService <TPIReader>();
            this.resolver = ctx.GetService <TypeResolver>();

            Magic = ReadUInt32();
            if (Magic != MAGIC)
            {
                throw new InvalidDataException();
            }

            Version = ReadEnum <UdtNameTableVersion>();

            data = Deserializers.ReadBuffer(this);
            rdr  = new SpanStream(data);

            NameIndices         = Deserializers.ReadArray <uint>(this);
            NumberOfNameIndices = ReadUInt32();

            //BuildTypeMap();
        }