public MstRecord32 ReadRecord2
        (
            long offset
        )
        {
            if (_stream.Seek(offset, SeekOrigin.Begin) != offset)
            {
                throw new IOException();
            }

            Encoding encoding = Encoding.Default;

            MemoryStream memory = new MemoryStream(PreloadLength);

            _AppendStream(_stream, memory, PreloadLength);
            memory.Position = 0;

            MstRecordLeader32 leader = MstRecordLeader32.Read(memory);
            int amountToRead         = (int)(leader.Length - memory.Length);

            if (amountToRead > 0)
            {
                _AppendStream(_stream, memory, amountToRead);
            }

            List <MstDictionaryEntry32> dictionary
                = new List <MstDictionaryEntry32>();

            for (int i = 0; i < leader.Nvf; i++)
            {
                MstDictionaryEntry32 entry = new MstDictionaryEntry32
                {
                    Tag      = memory.ReadInt16Host(),
                    Position = memory.ReadInt16Host(),
                    Length   = memory.ReadInt16Host()
                };
                dictionary.Add(entry);
            }

            foreach (MstDictionaryEntry32 entry in dictionary)
            {
                long endOffset = leader.Base + entry.Position;
                memory.Seek(endOffset, SeekOrigin.Begin);
                entry.Bytes = memory.ReadBytes(entry.Length);
                if (entry.Bytes != null)
                {
                    entry.Text = encoding.GetString(entry.Bytes);
                }
            }

            MstRecord32 result = new MstRecord32
            {
                Leader     = leader,
                Dictionary = dictionary
            };

            return(result);
        }
        public MstRecord32 ReadRecord
        (
            long offset
        )
        {
            if (_stream.Seek(offset, SeekOrigin.Begin) != offset)
            {
                throw new IOException();
            }

            //new ObjectDumper()
            //    .DumpStream(_stream,offset,64)
            //    .WriteLine();

            Encoding encoding = Encoding.Default;

            MstRecordLeader32 leader = MstRecordLeader32.Read(_stream);

            List <MstDictionaryEntry32> dictionary
                = new List <MstDictionaryEntry32>();

            for (int i = 0; i < leader.Nvf; i++)
            {
                MstDictionaryEntry32 entry = new MstDictionaryEntry32
                {
                    Tag      = _stream.ReadInt16Host(),
                    Position = _stream.ReadInt16Host(),
                    Length   = _stream.ReadInt16Host()
                };
                dictionary.Add(entry);
            }

            foreach (MstDictionaryEntry32 entry in dictionary)
            {
                long endOffset = offset + leader.Base + entry.Position;
                _stream.Seek(endOffset, SeekOrigin.Begin);
                entry.Bytes = _stream.ReadBytes(entry.Length);
                if (entry.Bytes != null)
                {
                    entry.Text = encoding.GetString(entry.Bytes);
                }
            }

            MstRecord32 result = new MstRecord32
            {
                Leader     = leader,
                Dictionary = dictionary
            };

            return(result);
        }
        /// <summary>
        /// Decode the field.
        /// </summary>
        public RecordField DecodeField
        (
            [NotNull] MstDictionaryEntry32 entry
        )
        {
            string catenated = string.Format
                               (
                "{0}#{1}",
                entry.Tag,
                entry.Text
                               );

            RecordField result = RecordField.Parse(catenated);

            return(result);
        }