Skip to content

Commit bdf8bbb

Browse files
committed
Uppdating messages and adding message telling the result is being saved to disk.
1 parent 6ca4ce9 commit bdf8bbb

5 files changed

Lines changed: 32 additions & 8 deletions

File tree

ReadMagicCard/ApplicationMessages.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,21 @@ void ApplicationMessages::printWorkingFolderMessage(wstring mtgFolderPath) {
3030
}
3131
}
3232

33-
void ApplicationMessages::printResultMessage(int numberOfErrors, wstring pathToResultFile) {
33+
void ApplicationMessages::printSavingResultsToDiskMessage() {
34+
35+
if (!runSilent) {
36+
wcout << L"Saving the results to disk . . ." << endl;
37+
}
38+
}
39+
40+
void ApplicationMessages::printResultsHasBeenSavedToDiskMessage(wstring pathToResultFolder) {
41+
42+
if (!runSilent) {
43+
wcout << L"The results has been written to a folder on disk:" << endl << pathToResultFolder << endl << endl;
44+
}
45+
}
46+
47+
void ApplicationMessages::printResultMessage(int numberOfErrors) {
3448

3549
if (!runSilent) {
3650
wstring message;
@@ -45,10 +59,8 @@ void ApplicationMessages::printResultMessage(int numberOfErrors, wstring pathToR
4559
wstring errorWord = (numberOfErrors == 1) ? L"error" : L"errors";
4660
message = L"Oh no! There was " + amountOfErrorsStr + L" " + errorWord + L" when reading the cards! :-(";
4761
}
48-
wcout << endl << message << endl;
62+
wcout << message << endl;
4963
systemMethods->ResetCommandLineTextColour();
50-
51-
wcout << endl << L"The results has been written to a result file:" << endl << pathToResultFile << endl;
5264
}
5365
}
5466

ReadMagicCard/ApplicationMessages.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@ class ApplicationMessages
1111
void printWelcomeMessage();
1212
//Prints a message telling the user where the program is looking for card image files.
1313
void printWorkingFolderMessage(std::wstring mtgFolderPath);
14+
//Prints a message telling the user that the result of the read is being saved to disk.
15+
void printSavingResultsToDiskMessage();
16+
//Prints a message telling the user that the result of the read has been saved to disk.
17+
void printResultsHasBeenSavedToDiskMessage(std::wstring pathToResultFolder);
1418
//Prints a message telling the user how the execution went.
15-
void printResultMessage(int numberOfErrors, std::wstring pathToResultFile);
19+
void printResultMessage(int numberOfErrors);
1620
//Prints a message telling the user that there are no files to read.
1721
void printNoImagesMessage();
1822
//Prints a message telling the user that there are to many files to successfully read them all.

ReadMagicCard/CardCollectionReader.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ vector<CardNameInfo> CardCollectionReader::ExtractCardNames() {
7979
cardNameExtraction(range, result, range.end, lengthOfLongestFilename);
8080
}
8181

82+
if (!runSilent) {
83+
wcout << endl;
84+
}
85+
8286
return result;
8387
}
8488

ReadMagicCard/CardReaderApplication.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,13 @@ vector<CardNameInfo> CardReaderApplication::readAllCards(SystemMethods* systemMe
122122
vector<CardNameInfo> result = readers->ExtractCardNames();
123123

124124
//Write the card names to a separate file.
125+
messages.printSavingResultsToDiskMessage();
125126
StoreCardProcessingData storer = StoreCardProcessingData(systemMethods);
126-
wstring pathToResultFile = storer.StoreFinalResult(result);
127+
wstring pathToResultFolder = storer.StoreFinalResult(result);
128+
messages.printResultsHasBeenSavedToDiskMessage(pathToResultFolder);
127129

128130
//Give a reassuring message... or not.
129-
messages.printResultMessage(readers->AmountOfErrors(), pathToResultFile);
131+
messages.printResultMessage(readers->AmountOfErrors());
130132

131133
//Since we don't need the readers anymore...
132134
delete readers;

ReadMagicCard/StoreCardProcessingData.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ wstring StoreCardProcessingData::StoreFinalResult(vector<CardNameInfo> result) {
4343
}
4444
}
4545
textToAdd = textToAdd.substr(0, textToAdd.size() - 1);
46+
FileHandling::AddRowToFile(systemMethods, textToAdd, L"CardTitles.txt", SubfolderName);
4647

47-
return FileHandling::AddRowToFile(systemMethods, textToAdd, L"CardTitles.txt", SubfolderName);
48+
wstring resultFolder = FileHandling::GetSubFolderPath(systemMethods, SubfolderName);
49+
return resultFolder;
4850
}
4951

5052
wstring StoreCardProcessingData::StoreOcrConfidence(wstring imageFileName, int numberOfCardReadTries, wstring ocrResult, int ocrConfidence) {

0 commit comments

Comments
 (0)