Adds a bit more logging.

This commit is contained in:
Deukhoofd 2021-07-23 12:09:11 +02:00
parent b0817fcad2
commit a56ccf68ec
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 12 additions and 5 deletions

View File

@ -78,37 +78,44 @@ void LocalizationData::WriteToFile(const std::filesystem::path& path) {
tempFilesPositions[file.first] = p1;
}
outFile << "ENDDATA" << std::endl;
size_t numberGlobal = 0;
// actual localization
for (const auto& file : _globalFiles) {
auto pos = outFile.tellp();
for (const auto& kv : file.second.GetMap()) {
outFile << kv.first << "|" << kv.second << std::endl;
numberGlobal++;
}
auto end = outFile.tellp();
auto length = end - pos;
auto data = globalFilesPositions[file.first];
outFile.seekp(data);
outFile << std::setfill ('0') << std::setw(4) << std::hex << pos;
outFile << std::setfill('0') << std::setw(4) << std::hex << pos;
outFile << "~";
outFile << std::setfill ('0') << std::setw(4) << std::hex << length;
outFile << std::setfill('0') << std::setw(4) << std::hex << length;
outFile.seekp(end);
}
size_t numberTemp = 0;
for (const auto& file : _tempFiles) {
auto pos = outFile.tellp();
for (const auto& kv : file.second.GetMap()) {
outFile << kv.first << "|" << kv.second << std::endl;
numberTemp++;
}
auto end = outFile.tellp();
auto length = end - pos;
auto data = tempFilesPositions[file.first];
outFile.seekp(data);
outFile << std::setfill ('0') << std::setw(4) << std::hex << pos;
outFile << std::setfill('0') << std::setw(4) << std::hex << pos;
outFile << "~";
outFile << std::setfill ('0') << std::setw(4) << std::hex << length;
outFile << std::setfill('0') << std::setw(4) << std::hex << length;
outFile.seekp(end);
}
outFile.close();
std::cout << "Wrote language file to " << path << std::endl;
std::cout << "Wrote language file to " << path << ". Wrote " << numberGlobal << " global keys and " << numberTemp
<< " temp keys." << std::endl;
}