change name convention
This commit is contained in:
parent
3f35c5c230
commit
72221106ac
@ -11,15 +11,14 @@ std::map<int, QString> LoadExtensions()
|
|||||||
std::map<int, QString> extensionNames;
|
std::map<int, QString> extensionNames;
|
||||||
QStringList files = QDir().entryList();
|
QStringList files = QDir().entryList();
|
||||||
for (auto file : files)
|
for (auto file : files)
|
||||||
if (file.endsWith("_nexthooker_extension.dll"))
|
if (file.split("_").size() > 1 && file.split("_")[0].toInt() && file.endsWith(".dll"))
|
||||||
if (GetProcAddress(GetModuleHandleW(file.toStdWString().c_str()), "OnNewSentence") ||
|
if (GetProcAddress(GetModuleHandleW(file.toStdWString().c_str()), "OnNewSentence") ||
|
||||||
GetProcAddress(LoadLibraryW(file.toStdWString().c_str()), "OnNewSentence"))
|
GetProcAddress(LoadLibraryW(file.toStdWString().c_str()), "OnNewSentence"))
|
||||||
{
|
{
|
||||||
QString extensionNumber = file.split("_")[0];
|
int extensionNumber = file.split("_")[0].toInt();
|
||||||
newExtensions[extensionNumber.toInt()] = (ExtensionFunction)GetProcAddress(GetModuleHandleW(file.toStdWString().c_str()), "OnNewSentence");
|
newExtensions[extensionNumber] = (ExtensionFunction)GetProcAddress(GetModuleHandleW(file.toStdWString().c_str()), "OnNewSentence");
|
||||||
file.chop(sizeof("_nexthooker_extension.dll") - 1);
|
file.chop(sizeof("dll"));
|
||||||
file.remove(0, extensionNumber.length() + 1);
|
extensionNames[extensionNumber] = file.split("_")[1];
|
||||||
extensionNames[extensionNumber.toInt()] = file;
|
|
||||||
}
|
}
|
||||||
extenMutex.lock();
|
extenMutex.lock();
|
||||||
extensions = newExtensions;
|
extensions = newExtensions;
|
||||||
|
@ -58,12 +58,12 @@ void MainWindow::AddProcess(unsigned int processId)
|
|||||||
QString processName = GetFullModuleName(processId);
|
QString processName = GetFullModuleName(processId);
|
||||||
QString allData = file.readAll();
|
QString allData = file.readAll();
|
||||||
QStringList allProcesses = allData.split("\r", QString::SkipEmptyParts);
|
QStringList allProcesses = allData.split("\r", QString::SkipEmptyParts);
|
||||||
for (int i = allProcesses.length() - 1; i >= 0; --i)
|
for (int i = allProcesses.size() - 1; i >= 0; --i)
|
||||||
if (allProcesses.at(i).contains(processName))
|
if (allProcesses[i].contains(processName))
|
||||||
{
|
{
|
||||||
QStringList hooks = allProcesses.at(i).split(" , ");
|
QStringList hooks = allProcesses[i].split(" , ");
|
||||||
for (int j = 1; j < hooks.length(); ++j)
|
for (int j = 1; j < hooks.size(); ++j)
|
||||||
Host::InsertHook(processId, ParseCode(hooks.at(j)).value_or(HookParam()));
|
Host::InsertHook(processId, ParseCode(hooks[j]).value_or(HookParam()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -244,12 +244,9 @@ void MainWindow::on_ttCombo_activated(int index)
|
|||||||
void MainWindow::on_addExtenButton_clicked()
|
void MainWindow::on_addExtenButton_clicked()
|
||||||
{
|
{
|
||||||
QString extenFileName = QFileDialog::getOpenFileName(this, "Select Extension dll", "C:\\", "Extensions (*.dll)");
|
QString extenFileName = QFileDialog::getOpenFileName(this, "Select Extension dll", "C:\\", "Extensions (*.dll)");
|
||||||
if (!extenFileName.length()) return;
|
if (!extenFileName.size()) return;
|
||||||
QString extenName = extenFileName.split("/")[extenFileName.split("/").count() - 1];
|
QString extenName = extenFileName.split("/")[extenFileName.split("/").count() - 1];
|
||||||
extenName.chop(4);
|
QString copyTo = QString::number(extenCombo->itemText(extenCombo->count() - 1).split(":")[0].toInt() + 1) + "_" + extenName;
|
||||||
QString copyTo = QString::number(extenCombo->itemText(extenCombo->count() - 1).split(":")[0].toInt() + 1) + "_" +
|
|
||||||
extenName +
|
|
||||||
"_nexthooker_extension.dll";
|
|
||||||
QFile::copy(extenFileName, copyTo);
|
QFile::copy(extenFileName, copyTo);
|
||||||
ReloadExtensions();
|
ReloadExtensions();
|
||||||
}
|
}
|
||||||
@ -257,7 +254,7 @@ void MainWindow::on_addExtenButton_clicked()
|
|||||||
void MainWindow::on_rmvExtenButton_clicked()
|
void MainWindow::on_rmvExtenButton_clicked()
|
||||||
{
|
{
|
||||||
if (extenCombo->currentText().size() == 0) return;
|
if (extenCombo->currentText().size() == 0) return;
|
||||||
QString extenFileName = extenCombo->currentText().split(":")[0] + "_" + extenCombo->currentText().split(": ")[1] + "_nexthooker_extension.dll";
|
QString extenFileName = extenCombo->currentText().split(":")[0] + "_" + extenCombo->currentText().split(": ")[1] + ".dll";
|
||||||
FreeLibrary(GetModuleHandleW(extenFileName.toStdWString().c_str()));
|
FreeLibrary(GetModuleHandleW(extenFileName.toStdWString().c_str()));
|
||||||
QFile::remove(extenFileName);
|
QFile::remove(extenFileName);
|
||||||
ReloadExtensions();
|
ReloadExtensions();
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
cmake_policy(SET CMP0037 OLD)
|
cmake_policy(SET CMP0037 OLD)
|
||||||
|
|
||||||
add_library(1_Remove\ Repetition_nexthooker_extension SHARED removerepeat.cpp)
|
add_library(1_Remove\ Repetition SHARED removerepeat.cpp)
|
||||||
add_library(2_Copy\ to\ Clipboard_nexthooker_extension SHARED copyclipboard.cpp)
|
add_library(2_Copy\ to\ Clipboard SHARED copyclipboard.cpp)
|
||||||
add_library(3_Google\ Translate_nexthooker_extension SHARED googletranslate.cpp)
|
add_library(3_Google\ Translate SHARED googletranslate.cpp)
|
||||||
add_library(4_Extra\ Newlines_nexthooker_extension SHARED extranewlines.cpp)
|
add_library(4_Extra\ Newlines SHARED extranewlines.cpp)
|
||||||
|
|
||||||
target_link_libraries(3_Google\ Translate_nexthooker_extension winhttp.lib)
|
target_link_libraries(3_Google\ Translate winhttp.lib)
|
Loading…
Reference in New Issue
Block a user