Exemple #1
0
        public void Decode(byte[] buffer, int length, LogicMessageFactory factory)
        {
            ByteStream stream = new ByteStream(buffer, length);

            if (!stream.IsAtEnd())
            {
                this.m_ackMessageIdCount = stream.ReadVInt();

                if (this.m_ackMessageIdCount <= 1400)
                {
                    this.m_ackMessageIds = stream.ReadBytes(this.m_ackMessageIdCount, 1400);

                    if (!stream.IsAtEnd())
                    {
                        int messageCount = stream.ReadVInt();

                        if (messageCount <= 1400)
                        {
                            this.m_messages.EnsureCapacity(messageCount);

                            for (int i = 0; i < messageCount; i++)
                            {
                                UdpMessage message = new UdpMessage();

                                message.Decode(stream, factory);

                                if (message.GetPiranhaMessage() == null)
                                {
                                    break;
                                }

                                this.m_messages.Add(message);
                            }
                        }
                    }
                }
            }

            stream.Destruct();
        }
Exemple #2
0
 public void AddMessage(UdpMessage message)
 {
     this.m_messages.Add(message);
 }