private static void CompareFiles(TextFilesComparator textFilesComparator) { string fileFirst = InputCollector.FirstFileName; string fileSecond = InputCollector.SecondFileName; if (string.IsNullOrEmpty(fileFirst) || string.IsNullOrEmpty(fileSecond)) { ConsoleOutput.ShowMenuDialog("\nPlease select at least two files to start comparing\n"); MakeMenuVisible(); return; } var fileFirstData = FileReader.GetFileContentAsText(fileFirst); var fileSecondData = FileReader.GetFileContentAsText(fileSecond); var fileFirstList = FileReader.GetFileTextAsLinesToList(fileFirst); var fileSecondList = FileReader.GetFileTextAsLinesToList(fileSecond); textFilesComparator.ComparisonFinished += ConsoleOutput.OnComparisonFinished; textFilesComparator.ComparisonFinished += FileWriter.OnComparisonFinished; textFilesComparator.DiscrepanciesFound += FileWriter.OnDiscrepanciesFound; textFilesComparator.CompareFilesAsStrings(fileFirstData, fileSecondData); textFilesComparator.PutDiscrepanciesToList(fileFirstList, fileSecondList); IsDataCompared = true; MakeMenuVisible(); }
private static void ShowDiscrepancies(TextFilesComparator textFilesComparator) { if (!IsDataCompared) { ConsoleOutput.ShowMenuDialog("\nData was not compared\n"); MakeMenuVisible(); return; } var fileFirstList = FileReader.GetFileTextAsLinesToList(InputCollector.FirstFileName); var fileSecondList = FileReader.GetFileTextAsLinesToList(InputCollector.SecondFileName); var diff = textFilesComparator.PutDiscrepanciesToList(fileFirstList, fileSecondList); diff.ShowToConsoleStringsList(); MakeMenuVisible(); }