Exemplo n.º 1
0
        /// <summary>
        /// Processes a received packet.
        /// </summary>
        /// <param name="packet">The packet.</param>
        void ProcessPacket(byte[] packet, Socket client, ClientSocketState userToken)
        {
            var packetObj = PacketCodec.DecodePacket(packet);
            var type      = Type.GetType(Encoding.UTF8.GetString(packetObj.Words[0]));

            if (messageHandlers.ContainsKey(type))
            {
                messageHandlers[type].Process(new ProcessingClient(packetObj, client, this));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Processes a received packet.
        /// </summary>
        /// <param name="packet">The packet.</param>
        void ProcessPacket(byte[] packet, Socket client, ClientSocketState userToken)
        {
            var packetObj = PacketCodec.DecodePacket(packet);

#if !SILVERLIGHT
            var type = Type.GetType(Encoding.UTF8.GetString(packetObj.Words[0]));
#else
            var bytes = packetObj.Words[0];
            var type  = Type.GetType(Encoding.UTF8.GetString(bytes, 0, bytes.Length));
#endif

            if (messageHandlers.ContainsKey(type))
            {
                messageHandlers[type].Process(new ProcessingClient(packetObj, client, this));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Processes a received packet.
        /// </summary>
        /// <param name="packet">The packet.</param>
        void ProcessPacket(byte[] packet, ClientSocketState userToken)
        {
            var packetObj = PacketCodec.DecodePacket(packet);

            if (_registeredCallbacks.ContainsKey(packetObj.Sequence))
            {
                var callback = _registeredCallbacks[packetObj.Sequence];
                _registeredCallbacks.Remove(packetObj.Sequence);
                if (packetObj.Words.Length < 3)
                {
                    callback(this, null);
                }
                else
                {
                    callback(this, packetObj.Words[2]);
                }
            }
        }