コード例 #1
0
        public byte[] GetBytes(Revision revision)
        {
            byte[] bytes = null;
            if (!this.Bytes.TryGetValue(revision, out bytes))
            {
                OutgoingPacket packet_ = null;
                if (BasicUtilies.GetRevisionPacketManager(revision).HandleOutgoing(this.Packet, out packet_))
                {
                    ServerMessage message = packet_.Handle(this.ValueHolder);
                    if (message == null || message is EmptyServerMessage)
                    {
                        bytes = null;
                    }
                    else
                    {
                        bytes = message.GetBytes();
                    }
                }
                else
                {
                    throw new Exception("Unable to find packet id: " + this.Packet + ", from: " + revision);
                }

                this.Bytes.Add(revision, bytes);
            }

            return(bytes);
        }