1
0
mirror of synced 2025-02-06 14:14:22 +01:00

impr: Show hint if advanced data information section doesn't yield any result

This commit is contained in:
WerWolv 2024-03-01 16:51:02 +01:00
parent 735d896260
commit 78f8e5055e
3 changed files with 29 additions and 18 deletions

View File

@ -5,6 +5,7 @@
"language": "German", "language": "German",
"translations": { "translations": {
"hex.yara.information_section.advanced_data_info": "Erweiterte Dateninformationen", "hex.yara.information_section.advanced_data_info": "Erweiterte Dateninformationen",
"hex.yara.information_section.advanced_data_info.no_information": "Kein erweiterten Informationen gefunden",
"hex.yara_rules.view.yara.error": "Yara Kompilerfehler: {0}", "hex.yara_rules.view.yara.error": "Yara Kompilerfehler: {0}",
"hex.yara_rules.view.yara.header.matches": "Treffer", "hex.yara_rules.view.yara.header.matches": "Treffer",
"hex.yara_rules.view.yara.header.rules": "Regeln", "hex.yara_rules.view.yara.header.rules": "Regeln",

View File

@ -5,6 +5,7 @@
"fallback": true, "fallback": true,
"translations": { "translations": {
"hex.yara.information_section.advanced_data_info": "Advanced Data Information", "hex.yara.information_section.advanced_data_info": "Advanced Data Information",
"hex.yara.information_section.advanced_data_info.no_information": "No further information found",
"hex.yara_rules.view.yara.error": "Yara Compiler error: {0}", "hex.yara_rules.view.yara.error": "Yara Compiler error: {0}",
"hex.yara_rules.view.yara.header.matches": "Matches", "hex.yara_rules.view.yara.header.matches": "Matches",
"hex.yara_rules.view.yara.header.rules": "Rules", "hex.yara_rules.view.yara.header.rules": "Rules",

View File

@ -1,6 +1,4 @@
#include <hex/api/content_registry.hpp> #include <hex/api/content_registry.hpp>
#include <hex/helpers/magic.hpp>
#include <hex/providers/provider.hpp>
#include <imgui.h> #include <imgui.h>
#include <hex/api/task_manager.hpp> #include <hex/api/task_manager.hpp>
@ -59,6 +57,12 @@ namespace hex::plugin::yara {
} }
void drawContent() override { void drawContent() override {
const auto empty = std::ranges::any_of(m_categories, [](const auto &entry) {
const auto &[categoryName, category] = entry;
return !category.matchedRules.empty();
});
if (!empty) {
if (ImGui::BeginTable("information", 2, ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_NoKeepColumnsVisible)) { if (ImGui::BeginTable("information", 2, ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_NoKeepColumnsVisible)) {
ImGui::TableSetupColumn("Left", ImGuiTableColumnFlags_WidthStretch, 0.5F); ImGui::TableSetupColumn("Left", ImGuiTableColumnFlags_WidthStretch, 0.5F);
ImGui::TableSetupColumn("Right", ImGuiTableColumnFlags_WidthStretch, 0.5F); ImGui::TableSetupColumn("Right", ImGuiTableColumnFlags_WidthStretch, 0.5F);
@ -82,6 +86,11 @@ namespace hex::plugin::yara {
ImGui::EndTable(); ImGui::EndTable();
} }
} else {
ImGui::NewLine();
ImGuiExt::TextFormattedCenteredHorizontal("{}", "hex.yara.information_section.advanced_data_info.no_information"_lang);
ImGui::NewLine();
}
} }
private: private: