Esempio n. 1
0
        private void ReadNameSection(ModuleReader reader, BinaryReader sr, SectionHeader nameSectionHeader)
        {
            var bs = sr.BaseStream;

            while ((bs.Position < nameSectionHeader.StreamPayloadEnd) && (bs.Position < bs.Length))
            {
                var id   = reader.Reader.ReadByte();
                var size = (uint)reader.Reader.ReadLEBUInt();
                switch (id)
                {
                // Function names
                case 1:
                    reader.ReadList((i) => {
                        var idx  = (uint)reader.Reader.ReadLEBUInt();
                        var name = reader.Reader.ReadPString();

                        FunctionNames.Add(idx, name);

                        return((object)null);
                    });
                    break;

                // Module name
                case 0:
                // Local names
                case 2:
                default:
                    sr.BaseStream.Seek(size, SeekOrigin.Current);
                    break;
                }
            }
        }