Example #1
0
        public IReadOnlyCollection <ScanResult> GetResult()
        {
            HashSet <ScanResult> results = new HashSet <ScanResult>();

            foreach (IScanner scanner in _scanners)
            {
                IEnumerable <long> previousResultsHashes = results.SelectMany(res => res.LineHashes);

                var scannerResultsToAdd = scanner.GetResult()
                                          .Where(scan => scan.IsSuccess && !previousResultsHashes.Any(hash => scan.LineHashes.Contains(hash)));

                foreach (ScanResult scannerResult in scannerResultsToAdd)
                {
                    results.Add(scannerResult);
                }
            }

            ScanResult[] result = results.Any()
                ? results.ToArray()
                : new[] { ScanResult.Failure() };

            return(result);
        }
Example #2
0
 public IReadOnlyCollection <ScanResult> GetResult()
 {
     return(_results.Any()
         ? _results.ToArray()
         : new[] { ScanResult.Failure() });
 }