private void PacketReceived(IPacket packet)
        {
            if (packet["COMPRESSION"] == "1" && packet.Payload != null)
            {
                packet.Payload = compression.Decompress(packet.Payload);
            }

            var map = packetMapper.Map(packet);

            if (map == null) //Unhandled Packet
            {
                ((BroadcastUtility)On).BroadcastUnhandledPacket(packet);
                return;
            }


            //Notify any attached processes that a packet has been received.
            ((BroadcastUtility)On).BroadcastPacketReceived(packet.Clone());

            //Process any packet handlers on the packet
            handlerHub.ProcessPacket(this, map);

            //Process any watchs that are on the packet
            packetWatcher.Process(map);

            //Process any plugins
            pluginManager.Process(this, map);
        }
Exemple #2
0
        private async void PacketReceived(IPacket packet)
        {
            if (packet["COMPRESSION"] == "1" && packet.Payload != null)
            {
                packet.Payload = compression.Decompress(packet.Payload);
            }

            var map = packetMapper.Map(packet);

            if (map == null) //Unhandled Packet
            {
                ((BroadcastUtility)On).BroadcastUnhandledPacket(packet);
                return;
            }

            //Notify any attached processes that a packet has been received.
            ((BroadcastUtility)On).BroadcastPacketReceived(packet.Clone());

            //Process any packet handlers on the packet
            handlerHub.ProcessPacket(this, map);

            //Process any watchs that are on the packet
            packetWatcher.Process(map);

            if (!(map is MessagePacket))
            {
                return;
            }

            var om = (MessagePacket)map;

            var msg = await Message(om);

            await MessageReceived(msg);
        }