private static void _executeTask(ILogger logger, CompareEntry compareEntry, List <IVFComparer> comparers) { logger.Info("Checking '{0}'", compareEntry.CommonName); foreach (var vfComparer in comparers) { vfComparer.Handle(compareEntry.PathA, compareEntry.PathB); } }
private List <IVFComparer> _correlateComparersForFile(CompareEntry file, List <IVFComparer> comparers) { var list = new List <IVFComparer>(); foreach (var comparer in comparers) { // Exit early if one of the files is null if (file.PathA == null || file.PathB == null) { if (file.PathA == null) { _logger.Error("Inconsistent result for {0}: No file in first location found, only at second location '{1}'. Skipping", file.CommonName, file.PathB); } else { _logger.Error("Inconsistent result for {0}: No file in second location found, only at first location '{1}'. Skipping", file.CommonName, file.PathA); } continue; } var matchesA = comparer.WantsToHandle(file.PathA); var matchesB = comparer.WantsToHandle(file.PathB); if (matchesA && matchesB) { // Both matched successfully list.Add(comparer); } else { // Additional check for // Possible: One is false => wrong gathering of files in a previous step if (matchesA || matchesB) { // Will be true if one of them is true, so wrong gathering _logger.Error("Inconsistent result: Comparer {0} will either match file '{1}' or '{2}' but not both", comparer.GetType().Name, file.PathA, file.PathB); } } } // If list is empty, no comparer is suitable for this file, report if (list.Any() == false) { _logger.Error("No comparer was found for files '{0}' and not '{1}'", file.PathA, file.PathB); } return(list); }