Exemplo n.º 1
0
        private bool RaisePacketHandler(Type packetType, ClientType client, IPacket data)
        {
            PacketCallback<ClientType> callback = null;
            lock (_callbackLock)
            {
                if (_packetCallbacks.ContainsKey(packetType))
                    callback = _packetCallbacks[packetType];
            }

            if (callback == null)
            {
                return false;
            }

            callback?.Raise(client, data);
            return true;
        }
Exemplo n.º 2
0
        private bool RaisePacketHandler(Type packetType, ClientType client, IPacket data)
        {
            PacketCallback <ClientType> callback = null;

            lock (CallbackLock) {
                if (PacketCallbacks.ContainsKey(packetType))
                {
                    callback = PacketCallbacks[packetType];
                }
            }
            if (callback == null)
            {
                return(false);
            }
            else
            {
                callback?.Raise(client, data);
                return(true);
            }
        }