コード例 #1
0
        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();
        }
コード例 #2
0
        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();
        }