Exemplo n.º 1
0
        public static string IsValidStatic(ValidatorBase validator,
                                           ref string matchedPattern,
                                           ref Dictionary <string, string> groups,
                                           ref string failureLevel,
                                           ref string fingerprint,
                                           ref string message)
        {
            string state =
                validator.IsValidStaticHelper(ref matchedPattern,
                                              ref groups,
                                              ref failureLevel,
                                              ref fingerprint,
                                              ref message);

            if (state != nameof(ValidationState.NoMatch))
            {
                string scanTarget = groups["scanTargetFullPath"];
                string key        = scanTarget + "#" + fingerprint;

                if (validator.PerFileFingerprintCache.Contains(key))
                {
                    return(nameof(ValidationState.NoMatch));
                }

                validator.PerFileFingerprintCache.Add(key);
            }

            return(state);
        }
Exemplo n.º 2
0
        public static string IsValidDynamic(ValidatorBase validator,
                                            ref string fingerprint,
                                            ref string message)
        {
            if (validator.FingerprintToResultCache.TryGetValue(fingerprint, out Tuple <string, string> result))
            {
                message = result.Item2;
                return(result.Item1);
            }

            string validationState =
                validator.IsValidDynamicHelper(ref fingerprint,
                                               ref message);

            if (fingerprint != null)
            {
                validator.FingerprintToResultCache[fingerprint] =
                    new Tuple <string, string>(validationState, message);
            }

            return(validationState);
        }