Пример #1
0
        public Message(EndianBinaryReader reader, int index)
        {
            Name   = $"msg_{ index }";
            IsUsed = "False";

            int msgBeginTest = reader.PeekReadInt32();

            while (msgBeginTest > (int)TextBoxType.COSMOSPHERE_CENTER_PORTRAIT || msgBeginTest < 0)
            {
                msgBeginTest = reader.ReadInt32();
                if (msgBeginTest <= (int)TextBoxType.COSMOSPHERE_CENTER_PORTRAIT && msgBeginTest >= 0)
                {
                    reader.BaseStream.Position -= 4;
                }
            }

            mBoxType               = (TextBoxType)reader.ReadInt32();
            mCharacterName         = (CharacterNameID)reader.ReadInt32();
            mCharacterIDOrPortrait = reader.ReadInt32();
            mMessageIndex          = reader.ReadInt32();
            mPortraitPosition      = (PortraitPosition)reader.ReadInt16();
            mUnknown1              = reader.ReadInt16();
            mMessageLength         = reader.ReadInt32();

            byte[] rawMessageData = reader.ReadBytes(mMessageLength);
            mMessageData = MessageDataProcessor.DecodeBytes(rawMessageData).Trim();

            MessageDataProcessor.PadMessageReader(reader);
        }
Пример #2
0
        public void Write(EndianBinaryWriter writer, int index)
        {
            writer.Write((int)mBoxType);
            writer.Write((int)mCharacterName);
            writer.Write(mCharacterIDOrPortrait);
            writer.Write(index);
            writer.Write((short)mPortraitPosition);
            writer.Write((short)1);

            byte[] rawMessageData = MessageDataProcessor.EncodeString(Text);

            writer.Write(rawMessageData.Length);
            writer.Write(rawMessageData);

            MessageDataProcessor.PadMessageWriter(writer);
        }