Regex Replacer Extension

This commit is contained in:
Blu3train 2021-10-19 00:07:57 +02:00 committed by Akash Mozumdar
parent e6ee5ecf3d
commit 8e0e17c59b

View File

@ -35,12 +35,10 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved
bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
{ {
//if (!sentenceInfo["current select"] || sentenceInfo["text number"] == 0 || sentence == L"") return false;
if (!sentenceInfo["current select"] || sentenceInfo["text number"] == 0) return false; if (!sentenceInfo["current select"] || sentenceInfo["text number"] == 0) return false;
std::ifstream stream(REGEX_REPLACEMENTS_SAVE_FILE, std::ios::binary); std::ifstream stream(REGEX_REPLACEMENTS_SAVE_FILE, std::ios::binary);
BlockMarkupIterator savedFilters(stream, Array<std::wstring_view>{ L"|REGEX|", L"|BECOMES|" }); BlockMarkupIterator savedFilters(stream, Array<std::wstring_view>{ L"|REGEX|", L"|BECOMES|" });
//std::vector<std::wstring> regexes;
concurrency::reader_writer_lock::scoped_lock_read readLock(m); concurrency::reader_writer_lock::scoped_lock_read readLock(m);
while (auto read = savedFilters.Next()) { while (auto read = savedFilters.Next()) {
const auto& [regex, replacement] = read.value(); const auto& [regex, replacement] = read.value();