/// <summary>
        /// Checking of rule for codes.
        /// </summary>
        /// <param name="type">Type of checking.</param>
        /// <param name="isWhitelist">The rule of whitelist or blacklist.</param>
        /// <param name="codes">List of codes for checking.</param>
        /// <returns>true value if it correct for this rule.</returns>
        public bool checkRule(EWType type, bool isWhitelist, List <string> codes)
        {
            if (isWhitelist)
            {
                if ((codes.Count < 1 && (type == EWType.Warnings ? Warnings : Errors).Count > 0) ||
                    (codes.Count > 0 && codes.Intersect(type == EWType.Warnings ? Warnings : Errors).Count() > 0))
                {
                    return(true);
                }
                return(false);
            }

            if (codes.Count < 1)
            {
                return(false);
            }
            if ((type == EWType.Warnings ? Warnings : Errors).Except(codes).Count() > 0)
            {
                return(true);
            }
            return(false);
        }
Example #2
0
        /// <summary>
        /// Checking of rule for codes.
        /// </summary>
        /// <param name="type">Type of checking.</param>
        /// <param name="isWhitelist">The rule of whitelist or blacklist.</param>
        /// <param name="codes">List of codes for checking.</param>
        /// <returns>true value if it correct for this rule.</returns>
        public bool checkRule(EWType type, bool isWhitelist, List<string> codes)
        {
            if(isWhitelist) {
                if((codes.Count < 1 && (type == EWType.Warnings ? Warnings : Errors).Count > 0) ||
                    (codes.Count > 0 && codes.Intersect(type == EWType.Warnings ? Warnings : Errors).Count() > 0)) {
                    return true;
                }
                return false;
            }

            if(codes.Count < 1) {
                return false;
            }
            if((type == EWType.Warnings ? Warnings : Errors).Except(codes).Count() > 0) {
                return true;
            }
            return false;
        }