From 54afbb24a5126c48dd7a41dbab95be004ff4cef4 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Thu, 10 Jan 2019 21:51:20 -0500 Subject: [PATCH] using raw string literals --- extensions/bingtranslate.cpp | 2 +- extensions/extranewlines.cpp | 2 +- extensions/googletranslate.cpp | 2 +- include/text.h | 93 +++++++++++++++++----------------- 4 files changed, 50 insertions(+), 49 deletions(-) diff --git a/extensions/bingtranslate.cpp b/extensions/bingtranslate.cpp index 2bef5c2..7b411b4 100644 --- a/extensions/bingtranslate.cpp +++ b/extensions/bingtranslate.cpp @@ -150,6 +150,6 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) translation = Translate(sentence, translateFrom, translateTo); for (auto& c : translation) if (c == L'\\') c = 0x200b; if (translation.empty()) translation = TRANSLATION_ERROR; - sentence += L"\r\n" + translation; + sentence += L"\n" + translation; return true; } diff --git a/extensions/extranewlines.cpp b/extensions/extranewlines.cpp index 9ee87df..6b796ec 100644 --- a/extensions/extranewlines.cpp +++ b/extensions/extranewlines.cpp @@ -3,6 +3,6 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) { if (sentenceInfo["hook address"] == -1) return false; - sentence += L"\r\n"; + sentence += L"\n"; return true; } diff --git a/extensions/googletranslate.cpp b/extensions/googletranslate.cpp index b755c3a..778d323 100644 --- a/extensions/googletranslate.cpp +++ b/extensions/googletranslate.cpp @@ -209,6 +209,6 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) } if (translation.empty()) translation = TRANSLATION_ERROR; - sentence += L"\r\n" + translation; + sentence += L"\n" + translation; return true; } diff --git a/include/text.h b/include/text.h index 363abfe..548ad8d 100644 --- a/include/text.h +++ b/include/text.h @@ -11,40 +11,40 @@ constexpr auto SAVE_HOOKS = u8"Save hook(s)"; constexpr auto SETTINGS = u8"Settings"; constexpr auto EXTENSIONS = u8"Extensions"; constexpr auto SELECT_PROCESS = u8"Select Process"; -constexpr auto ATTACH_INFO = u8"If you don't see the process you want to attach, try running with admin rights\r\n" -u8"You can also type in the process id"; -constexpr auto CODE_INFODUMP = u8"Search for text\r\n" -u8"S[codepage#]text\r\n" -u8"OR\r\n" -u8"Enter read code\r\n" -u8"R{S|Q|V}[codepage#][*deref_offset]@addr\r\n" -u8"OR\r\n" -u8"Enter hook code\r\n" -u8"H{A|B|W|S|Q|V}[N][codepage#]data_offset[*deref_offset1][:split_offset[*deref_offset2]]@addr[:module[:func]]\r\n" -u8"All numbers except codepage in hexadecimal\r\n" -u8"Default codepage is 932 (Shift-JIS) but this can be changed in settings\r\n" -u8"A/B: codepage char little/big endian\r\n" -u8"W: UTF-16 char\r\n" -u8"S/Q/V: codepage/UTF-16/UTF-8 string\r\n" -u8"Negatives for data_offset/sub_offset refer to registers\r\n" -u8"-4 for EAX, -8 for ECX, -C for EDX, -10 for EBX, -14 for ESP, -18 for EBP, -1C for ESI, -20 for EDI\r\n" -u8"* means dereference pointer+deref_offset"; +constexpr auto ATTACH_INFO = u8R"(If you don't see the process you want to attach, try running with admin rights +You can also type in the process id)"; +constexpr auto CODE_INFODUMP = u8R"(Search for text +S[codepage#]text +OR +Enter read code +R{S|Q|V}[codepage#][*deref_offset]@addr +OR +Enter hook code +H{A|B|W|S|Q|V}[N][codepage#]data_offset[*deref_offset1][:split_offset[*deref_offset2]]@addr[:module[:func]] +All numbers except codepage in hexadecimal +Default codepage is 932 (Shift-JIS) but this can be changed in settings +A/B: codepage char little/big endian +W: UTF-16 char +S/Q/V: codepage/UTF-16/UTF-8 string +Negatives for data/split offset refer to registers +-4 for EAX, -8 for ECX, -C for EDX, -10 for EBX, -14 for ESP, -18 for EBP, -1C for ESI, -20 for EDI +* means dereference pointer+deref_offset)"; constexpr auto SAVE_SETTINGS = u8"Save settings"; -constexpr auto EXTEN_WINDOW_INSTRUCTIONS = u8"Drag and drop extension (.dll) files here from your computer to add them\r\n" -u8"Drag and drop within the list to reorder\r\n" -u8"Press delete with an extension selected to remove it"; +constexpr auto EXTEN_WINDOW_INSTRUCTIONS = u8R"(Drag and drop extension (.dll) files here from your computer to add them +Drag and drop within the list to reorder +Press delete with an extension selected to remove it)"; constexpr auto WINDOW = u8"Window"; constexpr auto DEFAULT_CODEPAGE = u8"Default Codepage"; constexpr auto FLUSH_DELAY = u8"Flush Delay"; constexpr auto MAX_BUFFER_SIZE = u8"Max Buffer Size"; constexpr auto CONSOLE = L"Console"; constexpr auto CLIPBOARD = L"Clipboard"; -constexpr auto ABOUT = L"Textractor beta v" CURRENT_VERSION L" (project homepage: https://github.com/Artikash/Textractor)\r\n" -L"Made by me: Artikash (email: akashmozumdar@gmail.com)\r\n" -L"Please contact me with any problems, feature requests, or questions relating to Textractor\r\n" -L"You can do so via the project homepage (issues section) or via email\r\n" -L"Source code available under GPLv3 at project homepage\r\n" -L"I'm currently looking for a new job: please email me if you're hiring US software engineers"; +constexpr auto ABOUT = L"Textractor beta v" CURRENT_VERSION LR"( (project homepage: https://github.com/Artikash/Textractor) +Made by me: Artikash (email: akashmozumdar@gmail.com) +Please contact me with any problems, feature requests, or questions relating to Textractor +You can do so via the project homepage (issues section) or via email +Source code available under GPLv3 at project homepage +I'm currently looking for a new job: please email me if you're hiring US software engineers)"; constexpr auto UPDATE_AVAILABLE = L"Update available: download it from https://github.com/Artikash/Textractor/releases"; constexpr auto ALREADY_INJECTED = L"Textractor: already injected"; constexpr auto ARCHITECTURE_MISMATCH = L"Textractor: architecture mismatch: try 32 bit Textractor instead"; @@ -67,10 +67,11 @@ constexpr auto COULD_NOT_FIND = u8"Textractor: could not find text"; constexpr auto SELECT_LANGUAGE = u8"Select Language"; constexpr auto BING_PROMPT = u8"What language should Bing translate to?"; constexpr auto GOOGLE_PROMPT = u8"What language should Google translate to?"; -constexpr auto TOO_MANY_TRANS_REQUESTS = L"\r\nToo many translation requests: refuse to make more"; +constexpr auto TOO_MANY_TRANS_REQUESTS = LR"( +Too many translation requests: refuse to make more)"; constexpr auto TRANSLATION_ERROR = L"Error while translating"; -constexpr auto EXTRA_WINDOW_INFO = u8"Right click to change settings\r\n" -u8"Click and drag on window edges to move, or the bottom right corner to resize"; +constexpr auto EXTRA_WINDOW_INFO = u8R"(Right click to change settings +Click and drag on window edges to move, or the bottom right corner to resize)"; constexpr auto BG_COLOR = u8"Background Color"; constexpr auto TEXT_COLOR = u8"Text Color"; constexpr auto FONT_SIZE = u8"Font Size"; @@ -90,17 +91,17 @@ constexpr auto SETTINGS = u8"Ayarlar"; constexpr auto EXTENSIONS = u8"Uzantılar"; constexpr auto SELECT_PROCESS = u8"İşlem Seçin"; constexpr auto ATTACH_INFO = u8"Bağlanmak istediğiniz işlemi görmüyorsanız yönetici olarak çalıştırmayı deneyin"; -constexpr auto CODE_INFODUMP = u8"Kanca kodunu girin\r\n" -u8"/H{A|B|W|S|Q|V}[N][kod_sayfası#]göreli_veri_konumu[*göreli_referanstan_ayırma_konumu1][:göreli_ayırma_konumu[*göreli_referanstan_ayırma_konumu2]]@adres[:modül[:fonksiyon]]\r\n" -u8"YA DA\r\n" -u8"Okuma kodunu girin\r\n" -u8"/R{S|Q|V}[kod_sayfası#][*göreli_referanstan_ayırma_konumu|0]@adres\r\n" -u8"Kod sayfası hariç tüm sayılar onaltılı sayı sisteminde olmalı\r\n" -u8"A/B: Shift-JIS karakteri little/big endian\r\n" -u8"W: UTF-16 karakteri\r\n" -u8"S/Q/V: Shift-JIS/UTF-16/UTF-8 dizgisi\r\n" -u8"Negatif göreli_veri_konumları/alt_göreli_konumlar yazmaç\r\n" -u8"EAX için -4, ECX için -8, EDX için -C, EBX için -10, ESP için -14, EBP için -18, ESI için -1C, EDI için -20\r\n" +constexpr auto CODE_INFODUMP = u8"Kanca kodunu girin\n" +u8"/H{A|B|W|S|Q|V}[N][kod_sayfası#]göreli_veri_konumu[*göreli_referanstan_ayırma_konumu1][:göreli_ayırma_konumu[*göreli_referanstan_ayırma_konumu2]]@adres[:modül[:fonksiyon]]\n" +u8"YA DA\n" +u8"Okuma kodunu girin\n" +u8"/R{S|Q|V}[kod_sayfası#][*göreli_referanstan_ayırma_konumu|0]@adres\n" +u8"Kod sayfası hariç tüm sayılar onaltılı sayı sisteminde olmalı\n" +u8"A/B: Shift-JIS karakteri little/big endian\n" +u8"W: UTF-16 karakteri\n" +u8"S/Q/V: Shift-JIS/UTF-16/UTF-8 dizgisi\n" +u8"Negatif göreli_veri_konumları/alt_göreli_konumlar yazmaç\n" +u8"EAX için -4, ECX için -8, EDX için -C, EBX için -10, ESP için -14, EBP için -18, ESI için -1C, EDI için -20\n" u8"* işareti referanstan_ayırma_işaretçisi+göreli_referanstan_ayırma_konumu demek"; constexpr auto SELECT_EXTENSION = u8"Uzantı Seçin"; constexpr auto EXTENSION_FILES = u8"Uzantılar (*.dll)"; @@ -108,11 +109,11 @@ constexpr auto WINDOW = u8"Pencere"; constexpr auto DEFAULT_CODEPAGE = u8"Varsayılan Kod Sayfası"; constexpr auto FLUSH_DELAY = u8"Temizleme Gecikmesi"; constexpr auto MAX_BUFFER_SIZE = u8"Maksimum Arabellek Boyu"; -constexpr auto ABOUT = L"Textractor beta v" CURRENT_VERSION L" (proje ana sayfası: https://github.com/Artikash/Textractor)\r\n" -L"Benim tarafımdan yapıldı: Artikash (e-posta: akashmozumdar@gmail.com)\r\n" -L"Textractor ile ilgili tüm sorunlarınız, istekleriniz ve sorularınız için lütfen benimle iletişime geçin\r\n" -L"Benimle, proje ana sayfasından (“issues” kısmından) ya da e-posta aracılığıyla iletişime geçebilirsiniz\r\n" -L"Kaynak kodu GKLv3 koruması altında proje ana sayfasında mevcut\r\n" +constexpr auto ABOUT = L"Textractor beta v" CURRENT_VERSION L" (proje ana sayfası: https://github.com/Artikash/Textractor)\n" +L"Benim tarafımdan yapıldı: Artikash (e-posta: akashmozumdar@gmail.com)\n" +L"Textractor ile ilgili tüm sorunlarınız, istekleriniz ve sorularınız için lütfen benimle iletişime geçin\n" +L"Benimle, proje ana sayfasından (“issues” kısmından) ya da e-posta aracılığıyla iletişime geçebilirsiniz\n" +L"Kaynak kodu GKLv3 koruması altında proje ana sayfasında mevcut\n" L"Şu anda iş aramaktayım: Eğer ABD’li yazılım mühendislerini işe alıyorsanız lütfen bana e-posta atın"; constexpr auto UPDATE_AVAILABLE = L"Güncelleme mevcut: https://github.com/Artikash/Textractor/releases adresinden indirin"; constexpr auto ALREADY_INJECTED = L"Textractor: Zaten enjekte edili";