| 41 | return FormatString("%s Cache (%S).txt", TRANSLATION_PROVIDER, tlp->translateTo); |
| 42 | } |
| 43 | void SaveCache() |
| 44 | { |
| 45 | std::wstring allTranslations(L"\xfeff"); |
| 46 | for (const auto& [sentence, translation] : translationCache.Acquire().contents) |
| 47 | allTranslations.append(L"|SENTENCE|").append(sentence).append(L"|TRANSLATION|").append(translation).append(L"|END|\r\n"); |
| 48 | std::ofstream(CacheFile(), std::ios::binary | std::ios::trunc).write((const char*)allTranslations.c_str(), allTranslations.size() * sizeof(wchar_t)); |
| 49 | savedSize = translationCache->size(); |
| 50 | } |
| 51 | void LoadCache() |
| 52 | { |
| 53 | translationCache->clear(); |
no test coverage detected