Exemple #1
0
        public static StreamCreatePacket ReadBuffer(short packetType, NetworkStream buffer)
        {
            var streamChannelId = BufferHelper.ReadInt(buffer);
            var payload         = PayloadPacket.readPayload(buffer);

            return(new StreamCreatePacket(streamChannelId, payload));
        }
        public static ControlHandshakePacket ReadBuffer(short packetType, NetworkStream buffer)
        {
            var messageId   = BufferHelper.ReadInt(buffer);
            var payload     = PayloadPacket.readPayload(buffer);
            var helloPacket = new ControlHandshakePacket(payload);

            helloPacket.RequestId = messageId;
            return(helloPacket);
        }
        public static ResponsePacket ReadBuffer(short packetType, NetworkStream buffer)
        {
            var messageId      = BufferHelper.ReadInt(buffer);
            var payload        = PayloadPacket.readPayload(buffer);
            var responsePacket = new ResponsePacket(payload);

            responsePacket.RequestId = messageId;
            return(responsePacket);
        }
        public static ClientClosePacket ReadBuffer(short packetType, NetworkStream buffer)
        {
            var payload = PayloadPacket.readPayload(buffer);

            if (payload == null)
            {
                return(null);
            }
            var requestPacket = new ClientClosePacket();

            requestPacket.Payload = payload;
            return(requestPacket);
        }