Пример #1
0
        private bool ReadRecordTable(int pos, int numEntries, BinaryReader reader, StreamWriter outStream)
        {
            try
            {
                m_recordInfo = new Hashtable((int)Math.Round(numEntries * 1.2), (float)1.0);
                reader.BaseStream.Seek(pos, SeekOrigin.Begin);

                if (outStream != null)
                {
                    outStream.WriteLine("RecordTable located at 0x{0:X}", pos);
                }

                for (int i = 0; i < numEntries; ++i)
                {
                    RecordInfo r = new RecordInfo();
                    r.Decode(reader, 24, this); // 24 is the offset of where all record data begins

                    m_recordInfo.Add(NormalizeRecordPath(r.ID), r);

                    // output this record
                    if (outStream != null)
                    {
                        outStream.WriteLine("{0},{1},{2}", i, r.ID, r.RecordType);
                    }
                }
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #2
0
        /// <summary>
        /// Reads the entire record table into memory from a stream.
        /// </summary>
        /// <param name="pos">position within the file.</param>
        /// <param name="numEntries">number of entries in the file.</param>
        /// <param name="reader">input BinaryReader</param>
        /// <param name="outStream">output StreamWriter.</param>
        private void ReadRecordTable(int pos, int numEntries, BinaryReader reader, StreamWriter outStream)
        {
            this.recordInfo = new Dictionary <string, RecordInfo>((int)Math.Round(numEntries * 1.2));
            reader.BaseStream.Seek(pos, SeekOrigin.Begin);

            if (outStream != null)
            {
                outStream.WriteLine("RecordTable located at 0x{0:X}", pos);
            }

            for (int i = 0; i < numEntries; ++i)
            {
                RecordInfo recordInfo = new RecordInfo();
                recordInfo.Decode(reader, 24, this);                 // 24 is the offset of where all record data begins

                this.recordInfo.Add(TQData.NormalizeRecordPath(recordInfo.ID), recordInfo);

                // output this record
                if (outStream != null)
                {
                    outStream.WriteLine("{0},{1},{2}", i, recordInfo.ID, recordInfo.RecordType);
                }
            }
        }