示例#1
0
 /// <summary>
 /// Constructs a new Table and reads the header.
 /// </summary>
 /// <param name="reader">
 /// The SaveReader to read from. It should be positioned at the start of the table header.
 /// When the function finishes, it will point to the first entry in the entry list (see the HeaderSize constant).
 /// </param>
 public Table(SaveIO.SaveReader reader)
 {
     _name = reader.ReadAscii(0x1E);
     reader.Skip(2);  // Index of last entry - 1, not needed
     _entryCount = reader.ReadUInt16();
     _entrySize  = reader.ReadUInt16();
     reader.Skip(2 + 2 + 4); // 2 unknown uint16's + uint32 magic number
     _firstDeleted  = reader.ReadUInt16();
     _nextFree      = reader.ReadUInt16();
     _activeEntries = reader.ReadUInt16();
     _nextSalt      = reader.ReadUInt16();
     _memAddress    = reader.ReadUInt32();
 }
示例#2
0
        public void ReadFrom(SaveIO.SaveReader reader)
        {
            // Ignore the CRC32 but read everything else
            reader.Skip(CRC32Size);
            _unknown        = reader.ReadUInt32();
            _cfgSize        = reader.ReadInt32();
            _dataBlock1Size = reader.ReadInt32();
            _dataBlock2Size = reader.ReadInt32();
            _saveDataSize   = reader.ReadInt32();
            if (_saveDataSize == 0)
            {
                throw new ArgumentException("The save file is empty. Please get a different save and ensure that you reach a checkpoint first.");
            }

            // Skip the CFG CRC32 and read the CFG text
            reader.Skip(CRC32Size);
            CFGText = reader.ReadAscii(_cfgSize - CRC32Size);

            // Parse the CFG data
            CFGData = new SaveCFG(CFGText);
        }