Esempio n. 1
0
        public static CommClose Decode(G2ReceivedPacket packet)
        {
            CommClose close = new CommClose();

            G2Header child = new G2Header(packet.Root.Data);

            while( G2Protocol.ReadNextChild(packet.Root, child) == G2ReadResult.PACKET_GOOD )
            {
                if (child.Name == Packet_Message)
                    if( G2Protocol.ReadPayload(child) )
                        close.Reason = UTF8Encoding.UTF8.GetString(child.Data, child.PayloadPos, child.PayloadSize);
            }

            return close;
        }
Esempio n. 2
0
        public static CommClose Decode(G2ReceivedPacket packet)
        {
            CommClose close = new CommClose();

            G2Header child = new G2Header(packet.Root.Data);

            while (G2Protocol.ReadNextChild(packet.Root, child) == G2ReadResult.PACKET_GOOD)
            {
                if (child.Name == Packet_Message)
                {
                    if (G2Protocol.ReadPayload(child))
                    {
                        close.Reason = UTF8Encoding.UTF8.GetString(child.Data, child.PayloadPos, child.PayloadSize);
                    }
                }
            }

            return(close);
        }