private void analyze(EType type, IEnumerable <String> mainItems, IEnumerable <String> currentItems) { var main = new CollectionToTest(mainItems); var compare = new CollectionToTest(currentItems); while (main.NotEnded() && compare.NotEnded()) { var mainItem = new FileToTest(type, main.GetCurrent(), mainPath); var compareItem = new FileToTest(type, compare.GetCurrent(), comparePath); if (!mainItem.ShouldVerify) { main.Next(); } if (!compareItem.ShouldVerify) { compare.Next(); } var shouldVerifyBoth = mainItem.ShouldVerify && compareItem.ShouldVerify; if (!shouldVerifyBoth) { continue; } var diff = (ECompare)mainItem.Name.CompareTo(compareItem.Name); switch (diff) { case ECompare.Greater: addRow(Resources.Interface_Row_NotExistsProblem, mainPath, comparePath, compareItem.Path, compareItem.Name); compare.Next(); break; case ECompare.Less: addRow(Resources.Interface_Row_NotExistsProblem, comparePath, mainPath, mainItem.Path, mainItem.Name); main.Next(); break; case ECompare.Equal: switch (type) { case EType.File: if (mainItem.IsNewerThan(compareItem)) { addRow(Resources.Interface_Row_ObseleteProblem, comparePath, mainPath, mainItem.Path, mainItem.Name); } else if (compareItem.IsNewerThan(mainItem)) { addRow(Resources.Interface_Row_ObseleteProblem, mainPath, comparePath, compareItem.Path, compareItem.Name); } break; case EType.Directory: compareDirectories(main.GetCurrent(), compare.GetCurrent()); break; } compare.Next(); main.Next(); break; } } while (main.NotEnded()) { var item = new FileToTest(type, main.GetCurrent(), mainPath); if (item.ShouldVerify) { addRow(Resources.Interface_Row_NotExistsProblem, comparePath, mainPath, item.Path, item.Name); } main.Next(); } while (compare.NotEnded()) { var item = new FileToTest(type, compare.GetCurrent(), comparePath); if (item.ShouldVerify) { addRow(Resources.Interface_Row_NotExistsProblem, mainPath, comparePath, item.Path, item.Name); } compare.Next(); } }
public Boolean IsNewerThan(FileToTest other) { return((date - other.date) > new TimeSpan(0, 0, 2)); }