1
0
mirror of synced 2025-01-29 19:17:28 +01:00

ux: Improved dropped file loading; Added magic db loading

This commit is contained in:
WerWolv 2021-09-30 12:29:03 +02:00
parent 194bc3e5be
commit d3e3de3fa2
7 changed files with 31 additions and 6 deletions

View File

@ -63,6 +63,7 @@ namespace hex::plugin::builtin {
{ "hex.common.decimal", "Dezimal" },
{ "hex.common.hexadecimal", "Hexadezimal" },
{ "hex.common.octal", "Oktal" },
{ "hex.common.info", "Information" },
{ "hex.common.error", "Fehler" },
{ "hex.common.fatal", "Fataler Fehler" },
{ "hex.common.address", "Adresse" },
@ -82,6 +83,9 @@ namespace hex::plugin::builtin {
{ "hex.common.open", "Öffnen" },
{ "hex.common.browse", "Druchsuchen..." },
{ "hex.message.yara_rule_added", "Yara Regel hinzugefügt!" },
{ "hex.message.magic_db_added", "Magic Datenbank hinzugefügt!" },
{ "hex.view.bookmarks.name", "Lesezeichen" },
{ "hex.view.bookmarks.default_title", "Lesezeichen [0x{0:X} - 0x{1:X}]" },
{ "hex.view.bookmarks.no_bookmarks", "Noch kein Lesezeichen erstellt. Füge eines hinzu mit Bearbeiten -> Lesezeichen erstellen" },

View File

@ -63,6 +63,7 @@ namespace hex::plugin::builtin {
{ "hex.common.decimal", "Decimal" },
{ "hex.common.hexadecimal", "Hexadecimal" },
{ "hex.common.octal", "Octal" },
{ "hex.common.info", "Information" },
{ "hex.common.error", "Error" },
{ "hex.common.fatal", "Fatal Error" },
{ "hex.common.address", "Address" },
@ -82,6 +83,9 @@ namespace hex::plugin::builtin {
{ "hex.common.open", "Open" },
{ "hex.common.browse", "Browse..." },
{ "hex.message.yara_rule_added", "Yara rule added!" },
{ "hex.message.magic_db_added", "Magic database added!" },
{ "hex.view.bookmarks.name", "Bookmarks" },
{ "hex.view.bookmarks.default_title", "Bookmark [0x{0:X} - 0x{1:X}]" },
{ "hex.view.bookmarks.no_bookmarks", "No bookmarks created yet. Add one with Edit -> Create Bookmark" },

View File

@ -62,6 +62,7 @@ namespace hex::plugin::builtin {
{ "hex.common.decimal", "Decimale" },
{ "hex.common.hexadecimal", "Esadecimale" },
{ "hex.common.octal", "Ottale" },
//{ "hex.common.info", "Information" },
{ "hex.common.error", "Errore" },
{ "hex.common.fatal", "Errore Fatale" },
{ "hex.common.address", "Indirizzo" },
@ -81,6 +82,9 @@ namespace hex::plugin::builtin {
//{ "hex.common.open", "Open" },
//{ "hex.common.browse", "Browse..." },
//{ "hex.message.yara_rule_added", "Yara rule added!" },
//{ "hex.message.magic_db_added", "Magic database added!" },
{ "hex.view.bookmarks.name", "Segnalibri" },
{ "hex.view.bookmarks.default_title", "Segnalibro [0x{0:X} - 0x{1:X}]" },
{ "hex.view.bookmarks.no_bookmarks", "Non è stato creato alcun segnalibro. Aggiungine uno andando su Modifica -> Crea Segnalibro" },

View File

@ -63,6 +63,7 @@ namespace hex::plugin::builtin {
{ "hex.common.decimal", "十进制" },
{ "hex.common.hexadecimal", "十六进制" },
{ "hex.common.octal", "八进制" },
//{ "hex.common.info", "Information" },
{ "hex.common.error", "错误" },
{ "hex.common.fatal", "致命错误" },
{ "hex.common.address", "地址" },
@ -82,6 +83,9 @@ namespace hex::plugin::builtin {
//{ "hex.common.open", "Open" },
//{ "hex.common.browse", "Browse..." },
//{ "hex.message.yara_rule_added", "Yara rule added!" },
//{ "hex.message.magic_db_added", "Magic database added!" },
{ "hex.view.bookmarks.name", "书签" },
{ "hex.view.bookmarks.default_title", "书签 [0x{0:X} - 0x{1:X}]" },
{ "hex.view.bookmarks.no_bookmarks", "空空如也。通过 编辑->添加书签" },

View File

@ -85,6 +85,8 @@ namespace hex {
ProjectFile::s_hasUnsavedChanged = false;
ProjectFile::s_currProjectFilePath = filePath;
EventManager::post<EventProjectFileLoad>();
return true;
}

View File

@ -197,7 +197,6 @@ namespace hex {
} else if (name == "Open Project") {
hex::openFileBrowser("hex.view.hexeditor.open_project"_lang, DialogMode::Open, { { "Project File", "hexproj" } }, [this](auto path) {
ProjectFile::load(path);
EventManager::post<EventProjectFileLoad>();
this->getWindowOpenState() = true;
});
}
@ -473,7 +472,6 @@ namespace hex {
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.open_project"_lang, "")) {
hex::openFileBrowser("hex.view.hexeditor.menu.file.open_project"_lang, DialogMode::Open, { { "Project File", "hexproj" } }, [this](auto path) {
ProjectFile::load(path);
EventManager::post<EventProjectFileLoad>();
});
}

View File

@ -440,7 +440,6 @@ namespace hex {
ImGui::SetCursorPosX(width / 9);
if (ImGui::Button("hex.safety_backup.restore"_lang, ImVec2(width / 3, 0))) {
ProjectFile::load(this->m_safetyBackupPath.string());
EventManager::post<EventProjectFileLoad>();
ProjectFile::markDirty();
ProjectFile::clearProjectFilePath();
@ -784,13 +783,23 @@ namespace hex {
if (file.isValid())
EventManager::post<RequestSetPatternLanguageCode>(file.readString());
} else if (path.extension() == ".hexproj") {
ProjectFile::load(path.string());
} else if (path.extension() == ".yar") {
for (auto &destPath : hex::getPath(ImHexPath::Yara)) {
std::error_code error;
std::filesystem::copy(path, destPath, error);
if (!error)
if (std::filesystem::copy_file(path, destPath / path.filename(), std::filesystem::copy_options::overwrite_existing, error)) {
View::showMessagePopup("hex.message.yara_rule_added"_lang);
break;
}
}
} else if (path.extension() == ".mgc") {
for (auto &destPath : hex::getPath(ImHexPath::Magic)) {
std::error_code error;
if (std::filesystem::copy_file(path, destPath / path.filename(), std::filesystem::copy_options::overwrite_existing, error)) {
View::showMessagePopup("hex.message.magic_db_added"_lang);
break;
}
}
} else {
EventManager::post<RequestOpenFile>(path.string());