diff --git a/GUI/mainwindow.cpp b/GUI/mainwindow.cpp index 3833839..396b655 100644 --- a/GUI/mainwindow.cpp +++ b/GUI/mainwindow.cpp @@ -107,7 +107,7 @@ MainWindow::MainWindow(QWidget *parent) : std::unique_ptr> argv(CommandLineToArgvW(GetCommandLineW(), &argc)); for (int i = 0; i < argc; ++i) if (std::wstring arg = argv[i]; arg[0] == L'/' || arg[0] == L'-') - if (arg[1] == L'p') + if (arg[1] == L'p' || arg[1] == L'P') if (DWORD processId = _wtoi(arg.substr(2).c_str())) Host::InjectProcess(processId); else for (int i = 0; i < processIds.size(); ++i) if (processNames[i].find(L"\\" + arg.substr(2)) != std::wstring::npos) Host::InjectProcess(processIds[i]); diff --git a/extensions/bingtranslate.cpp b/extensions/bingtranslate.cpp index 151425a..3770b21 100644 --- a/extensions/bingtranslate.cpp +++ b/extensions/bingtranslate.cpp @@ -58,21 +58,14 @@ Synchronized translateTo = L"en"; std::pair Translate(const std::wstring& text) { std::wstring translateFrom; - if (HttpRequest httpRequest{ - L"Mozilla/5.0 Textractor", - L"www.bing.com", - L"POST", - FormatString(L"/tdetect?text=%s", Escape(text)).c_str(), - WINHTTP_FLAG_ESCAPE_DISABLE | WINHTTP_FLAG_SECURE, - }) translateFrom = httpRequest.response; + if (HttpRequest httpRequest{ L"Mozilla/5.0 Textractor", L"www.bing.com", L"POST", FormatString(L"/tdetect?text=%s", Escape(text)).c_str() }) translateFrom = httpRequest.response; else return { false, FormatString(L"%s (code=%u)", TRANSLATION_ERROR, httpRequest.errorCode) }; if (HttpRequest httpRequest{ L"Mozilla/5.0 Textractor", L"www.bing.com", L"POST", - FormatString(L"/ttranslate?from=%s&to=%s&text=%s", translateFrom, translateTo->c_str(), Escape(text)).c_str(), - WINHTTP_FLAG_ESCAPE_DISABLE | WINHTTP_FLAG_SECURE, + FormatString(L"/ttranslate?from=%s&to=%s&text=%s", translateFrom, translateTo->c_str(), Escape(text)).c_str() }) // Response formatted as JSON: translation starts with :" and ends with "} if (std::wsmatch results; std::regex_search(httpRequest.response, results, std::wregex(L":\"(.+)\"\\}"))) return { true, results[1] };