public bool Validate(IPacketMap packet)
        {
            if (CheckCanel(packet))
            {
                return(true);
            }

            if (!(packet is T))
            {
                return(false);
            }

            if (Validator != null && !Validator((T)packet))
            {
                return(false);
            }

            OnFound.SetResult((T)packet);
            return(true);
        }
예제 #2
0
        public bool Validate(IPacketMap packet)
        {
            if (!(packet is T))
            {
                return(false);
            }

            if (!PacketCommand.Equals(packet.Command, StringComparison.CurrentCultureIgnoreCase))
            {
                return(false);
            }

            if (Validator != null && !Validator((T)packet))
            {
                return(false);
            }

            OnFound.SetResult((T)packet);

            return(true);
        }