コード例 #1
0
 /// <summary>
 /// Returns all the matches that was found during the search regardless of categories or severity.
 ///
 /// Note: All matches returned are clones of the original matches.
 /// </summary>
 public List <IMatch> Matches()
 {
     lock (_lockInternalMatches)
     {
         return(InternalMatches.Select(match => (IMatch)match.Clone()).ToList());
     }
 }
コード例 #2
0
        /// <summary>
        /// Returns the number of matches found with the specified rule severity.
        /// </summary>
        /// <param name="severity">Defines a rules severity.</param>
        /// <returns></returns>
        public int MatchesFoundBySeverity(RuleSeverity severity)
        {
            lock (_lockInternalMatches)
            {
                if (InternalMatches.Count <= 0)
                {
                    return(0);
                }

                return(InternalMatches.Count(match => match.Severity == severity));
            }
        }
コード例 #3
0
        private int FindNumberOfMatchesFromFilterAndId(Filter filter, int id)
        {
            if (id <= 0)
            {
                throw new ArgumentException("Argument 'id' cannot be less than or equal to '0'.");
            }

            switch (filter)
            {
            case Filter.Rule: { return(InternalMatches.Count(match => match.RuleDeclarationRef.Id == id)); }

            default: return(0);
            }
        }
コード例 #4
0
        private int FindNumberOfMatchesFromFilterAndPath(Filter filter, string path)
        {
            if (string.IsNullOrWhiteSpace(path))
            {
                throw new ArgumentNullException("path");
            }

            switch (filter)
            {
            case Filter.RootDir:  { return(InternalMatches.Count(match => match.RootDirectoryPath == path)); }

            case Filter.Filename: { return(InternalMatches.Count(match => match.Filename == path)); }

            default: return(0);
            }
        }
コード例 #5
0
        public void AddMatch(IMatch match)
        {
            lock (_lockInternalMatches)
            {
                if (match == null)
                {
                    throw new ArgumentNullException("match");
                }

                if (match.Result != MatchStatus.Match)
                {
                    return;
                }

                InternalMatches.Add(match);
            }
        }