forked from Public-Mirror/Textractor
extract remaining text
This commit is contained in:
parent
5523644ef9
commit
240f5f235b
@ -1,4 +1,5 @@
|
|||||||
#include "extension.h"
|
#include "extension.h"
|
||||||
|
#include "text.h"
|
||||||
#include <winhttp.h>
|
#include <winhttp.h>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
@ -64,8 +65,8 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved
|
|||||||
{
|
{
|
||||||
translateTo = QInputDialog::getItem(
|
translateTo = QInputDialog::getItem(
|
||||||
nullptr,
|
nullptr,
|
||||||
"Select Language",
|
SELECT_LANGUAGE,
|
||||||
"What language should Bing translate to?",
|
BING_PROMPT,
|
||||||
languages,
|
languages,
|
||||||
0, false, nullptr,
|
0, false, nullptr,
|
||||||
Qt::WindowCloseButtonHint
|
Qt::WindowCloseButtonHint
|
||||||
@ -139,7 +140,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
|
|||||||
requestTimes.erase(std::remove_if(requestTimes.begin(), requestTimes.end(), [&](DWORD requestTime) { return GetTickCount() - requestTime > 60 * 1000; }), requestTimes.end());
|
requestTimes.erase(std::remove_if(requestTimes.begin(), requestTimes.end(), [&](DWORD requestTime) { return GetTickCount() - requestTime > 60 * 1000; }), requestTimes.end());
|
||||||
if (!sentenceInfo["current select"] && requestTimes.size() > 30)
|
if (!sentenceInfo["current select"] && requestTimes.size() > 30)
|
||||||
{
|
{
|
||||||
sentence += L"\r\nToo many translation requests: refuse to make more";
|
sentence += TOO_MANY_TRANS_REQUESTS;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -148,7 +149,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
|
|||||||
Translate(sentence, translateFrom, translateTo);
|
Translate(sentence, translateFrom, translateTo);
|
||||||
translation = Translate(sentence, translateFrom, translateTo);
|
translation = Translate(sentence, translateFrom, translateTo);
|
||||||
for (auto& c : translation) if (c == L'\\') c = 0x200b;
|
for (auto& c : translation) if (c == L'\\') c = 0x200b;
|
||||||
if (translation.empty()) translation = L"Error while translating.";
|
if (translation.empty()) translation = TRANSLATION_ERROR;
|
||||||
sentence += L"\r\n" + translation;
|
sentence += L"\r\n" + translation;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
@ -1,4 +1,5 @@
|
|||||||
#include "extension.h"
|
#include "extension.h"
|
||||||
|
#include "text.h"
|
||||||
#include <winhttp.h>
|
#include <winhttp.h>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
@ -80,8 +81,8 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved
|
|||||||
{
|
{
|
||||||
translateTo = QInputDialog::getItem(
|
translateTo = QInputDialog::getItem(
|
||||||
nullptr,
|
nullptr,
|
||||||
"Select Language",
|
SELECT_LANGUAGE,
|
||||||
"What language should Google translate to?",
|
GOOGLE_PROMPT,
|
||||||
languages,
|
languages,
|
||||||
0, false, nullptr,
|
0, false, nullptr,
|
||||||
Qt::WindowCloseButtonHint
|
Qt::WindowCloseButtonHint
|
||||||
@ -143,7 +144,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
|
|||||||
requestTimes.erase(std::remove_if(requestTimes.begin(), requestTimes.end(), [&](DWORD requestTime) { return GetTickCount() - requestTime > 60 * 1000; }), requestTimes.end());
|
requestTimes.erase(std::remove_if(requestTimes.begin(), requestTimes.end(), [&](DWORD requestTime) { return GetTickCount() - requestTime > 60 * 1000; }), requestTimes.end());
|
||||||
if (!sentenceInfo["current select"] && requestTimes.size() > 30)
|
if (!sentenceInfo["current select"] && requestTimes.size() > 30)
|
||||||
{
|
{
|
||||||
sentence += L"\r\nToo many translation requests: refuse to make more";
|
sentence += TOO_MANY_TRANS_REQUESTS;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,7 +204,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (translation.empty()) translation = L"Error while translating (TKK=" + std::to_wstring(TKK) + L")";
|
if (translation.empty()) translation = TRANSLATION_ERROR + (L" (TKK=" + std::to_wstring(TKK) + L")");
|
||||||
sentence += L"\r\n" + translation;
|
sentence += L"\r\n" + translation;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
@ -1,4 +1,5 @@
|
|||||||
#include "extension.h"
|
#include "extension.h"
|
||||||
|
#include "text.h"
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QLayout>
|
#include <QLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
@ -22,12 +23,12 @@ struct : QMainWindow {
|
|||||||
{
|
{
|
||||||
std::lock_guard l(m);
|
std::lock_guard l(m);
|
||||||
try { regex = newRegex.toStdWString(); }
|
try { regex = newRegex.toStdWString(); }
|
||||||
catch (...) { return output->setText("Invalid regex"); }
|
catch (...) { return output->setText(INVALID_REGEX); }
|
||||||
output->setText("Currently filtering: " + newRegex);
|
output->setText(CURRENT_FILTER + newRegex);
|
||||||
});
|
});
|
||||||
QMainWindow::resize(350, 60);
|
QMainWindow::resize(350, 60);
|
||||||
QMainWindow::setCentralWidget(centralWidget);
|
QMainWindow::setCentralWidget(centralWidget);
|
||||||
QMainWindow::setWindowTitle("Regex Filter");
|
QMainWindow::setWindowTitle(REGEX_FILTER);
|
||||||
QMainWindow::show();
|
QMainWindow::show();
|
||||||
}
|
}
|
||||||
}*window = nullptr;
|
}*window = nullptr;
|
||||||
|
@ -55,6 +55,14 @@ constexpr auto TOO_MANY_HOOKS = u8"Textractor: too many hooks: can't insert";
|
|||||||
constexpr auto FUNC_MISSING = u8"Textractor: function not present";
|
constexpr auto FUNC_MISSING = u8"Textractor: function not present";
|
||||||
constexpr auto MODULE_MISSING = u8"Textractor: module not present";
|
constexpr auto MODULE_MISSING = u8"Textractor: module not present";
|
||||||
constexpr auto GARBAGE_MEMORY = u8"Textractor: memory constantly changing, useless to read";
|
constexpr auto GARBAGE_MEMORY = u8"Textractor: memory constantly changing, useless to read";
|
||||||
|
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 TRANSLATION_ERROR = L"Error while translating";
|
||||||
|
constexpr auto REGEX_FILTER = u8"Regex Filter";
|
||||||
|
constexpr auto INVALID_REGEX = u8"Invalid regex";
|
||||||
|
constexpr auto CURRENT_FILTER = u8"Currently filtering: ";
|
||||||
#endif // ENGLISH
|
#endif // ENGLISH
|
||||||
|
|
||||||
#ifdef TURKISH
|
#ifdef TURKISH
|
||||||
@ -66,7 +74,7 @@ constexpr auto SETTINGS = u8"Ayarlar";
|
|||||||
constexpr auto EXTENSIONS = u8"Uzantılar";
|
constexpr auto EXTENSIONS = u8"Uzantılar";
|
||||||
constexpr auto SELECT_PROCESS = u8"İşlem Seçin";
|
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 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"Hook kodunu girin\r\n"
|
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"/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"YA DA\r\n"
|
||||||
u8"Okuma kodunu girin\r\n"
|
u8"Okuma kodunu girin\r\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user