Пример #1
0
        void AddSequenceNumber(OutputMessage message)
        {
            int pos = message.Tell();

            message.Seek(0);
            message.AddU32(m_SequenceNumber++);
            message.IncreaseHeaderLength(sizeof(uint));
            message.Seek(pos + sizeof(uint));
        }
Пример #2
0
        void AddMessageLength(OutputMessage message)
        {
            int pos = message.Tell();

            message.Seek(0);
            message.AddU16((ushort)message.GetBufferLength());
            message.IncreaseHeaderLength(sizeof(ushort));
            message.Seek(pos + sizeof(ushort));
        }
Пример #3
0
        void AddChecksum(OutputMessage message)
        {
            if (ChecksumEnabled)
            {
                uint checksum = Adler32(message.GetBuffer().ToArray(), (uint)message.GetBufferLength());

                int pos = message.Tell();
                message.Seek(0);
                message.AddU32(checksum);
                message.IncreaseHeaderLength(sizeof(uint));
                message.Seek(pos + sizeof(uint));
            }
        }