コード例 #1
0
        private void UpdateResults(
            HashSet <ScanResult> resultsToUpdate,
            IReadOnlyCollection <ScanResult> scanResults,
            long[] lineHashes)
        {
            foreach (long hash in lineHashes)
            {
                resultsToUpdate.RemoveWhere(result => result.LineHashes.Contains(hash));
            }

            foreach (ScanResult result in scanResults)
            {
                resultsToUpdate.Add(ScanResult.Success(result.Value, lineHashes));
            }
        }
コード例 #2
0
        public void Scan()
        {
            IEnumerable <string> matches = _config.TextSearchPatterns
                                           .Select(pattern => new Regex(pattern).Match(_line.Text))
                                           .Where(match => match.Success)
                                           .Select(match => match.Value);

            matches = matches
                      .Where(match => !_config.TextSearchPatternsExclude
                             .Any(excludePattern => new Regex(excludePattern).IsMatch(match)));

            foreach (long hash in _line.Hashes)
            {
                _results.RemoveWhere(result => result.LineHashes.Contains(hash));
            }

            foreach (string match in matches)
            {
                _results.Add(ScanResult.Success(match, _line.Hashes));
            }
        }