void ReadRawData() { MemoryStream stream = new MemoryStream(RawData); BinaryReader reader = new BinaryReader(stream, Encoding.UTF8); // Read Version - must be 0x26 Version = reader.ReadByte(); if (Version != VersionNumber) throw new Exception("SaveTree file has an invalid version number, must be 0x26."); // Read CharacterPosition.RecordType - must be 0x01 CharacterPosition = new CharacterPositionRecord(); CharacterPosition.RecordType = reader.ReadByte(); if (CharacterPosition.RecordType != (int)RecordTypes.CharacterPosition) throw new Exception("Expected CharacterPosition in SaveTreeHeader has an invalid record type, must be 0x01."); // Read CharacterPosition.Unknown CharacterPosition.Unknown = reader.ReadUInt16(); // Read CharacterPosition.Position CharacterPosition.Position = SaveTree.ReadPosition(reader); // Read Unknown Unknown = reader.ReadUInt16(); reader.Close(); }
void ReadRawData() { MemoryStream stream = new MemoryStream(RawData); BinaryReader reader = new BinaryReader(stream, Encoding.UTF8); // Read Version - must be 0x26 Version = reader.ReadByte(); if (Version != VersionNumber) { throw new Exception("SaveTree file has an invalid version number, must be 0x26."); } // Read CharacterPosition.RecordType - must be 0x01 CharacterPosition = new CharacterPositionRecord(); CharacterPosition.RecordType = reader.ReadByte(); if (CharacterPosition.RecordType != (int)RecordTypes.CharacterPosition) { throw new Exception("Expected CharacterPosition in SaveTreeHeader has an invalid record type, must be 0x01."); } // Read CharacterPosition.Unknown CharacterPosition.Unknown = reader.ReadUInt16(); // Read CharacterPosition.Position CharacterPosition.Position = SaveTree.ReadPosition(reader); // Read Unknown Unknown = reader.ReadUInt16(); reader.Close(); }