private void WriteMainHeader(SaveIO.SaveWriter writer) { // Write the new header to a MemoryStream for resigning purposes MemoryStream tempStream = new MemoryStream(HeaderSize - CRC32Size); SaveIO.SaveWriter tempWriter = new SaveIO.SaveWriter(tempStream); tempWriter.WriteUInt32(_unknown); tempWriter.WriteInt32(_cfgSize); tempWriter.WriteInt32(_dataBlock1Size); tempWriter.WriteInt32(_dataBlock2Size); tempWriter.WriteInt32(_saveDataSize); // Grab its CRC32 CRC32 crc32 = new CRC32(); byte[] checksum = crc32.ComputeHash(tempStream.GetBuffer()); // Now write it to the destination stream writer.WriteBlock(checksum); writer.WriteBlock(tempStream.GetBuffer()); tempWriter.Close(); }