diff options
| -rw-r--r-- | binaryninjaapi.h | 2 | ||||
| -rw-r--r-- | binaryninjacore.h | 2 | ||||
| -rw-r--r-- | settings.cpp | 15 |
3 files changed, 19 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index f907db01..80fbfe75 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -4253,6 +4253,8 @@ namespace BinaryNinja bool UpdateProperty(const std::string& id, const std::string& property, const std::vector<std::string>& value); std::string GetSchema(); + bool DeserializeSettings(const std::string& contents, Ref<BinaryView> view = nullptr, BNSettingsScope scope = SettingsAutoScope); + std::string SerializeSettings(Ref<BinaryView> view = nullptr, BNSettingsScope scope = SettingsAutoScope); bool Reset(const std::string& id, Ref<BinaryView> view = nullptr, BNSettingsScope scope = SettingsAutoScope); bool ResetAll(Ref<BinaryView> view = nullptr, BNSettingsScope scope = SettingsAutoScope); diff --git a/binaryninjacore.h b/binaryninjacore.h index 14e8fb4f..beb7e9b3 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -3689,6 +3689,8 @@ extern "C" BINARYNINJACOREAPI bool BNSettingsUpdateStringListProperty(const char* registry, const char* id, const char* property, const char** value, size_t size); BINARYNINJACOREAPI char* BNSettingsGetSchema(const char* registry); + BINARYNINJACOREAPI bool BNDeserializeSettings(const char* registry, const char* contents, BNBinaryView* view, BNSettingsScope scope); + BINARYNINJACOREAPI char* BNSerializeSettings(const char* registry, BNBinaryView* view, BNSettingsScope scope); BINARYNINJACOREAPI bool BNSettingsReset(const char* registry, const char* id, BNBinaryView* view, BNSettingsScope scope); BINARYNINJACOREAPI bool BNSettingsResetAll(const char* registry, BNBinaryView* view, BNSettingsScope scope); diff --git a/settings.cpp b/settings.cpp index 62425f5b..df95a56c 100644 --- a/settings.cpp +++ b/settings.cpp @@ -90,6 +90,21 @@ string Settings::GetSchema() } +bool Settings::DeserializeSettings(const string& contents, Ref<BinaryView> view, BNSettingsScope scope) +{ + return BNDeserializeSettings(m_registry.c_str(), contents.c_str(), view ? view->GetObject() : nullptr, scope); +} + + +string Settings::SerializeSettings(Ref<BinaryView> view, BNSettingsScope scope) +{ + char* settingsStr = BNSerializeSettings(m_registry.c_str(), view ? view->GetObject() : nullptr, scope); + string settings(settingsStr); + BNFreeString(settingsStr); + return settings; +} + + bool Settings::Reset(const string& id, Ref<BinaryView> view, BNSettingsScope scope) { return BNSettingsReset(m_registry.c_str(), id.c_str(), view ? view->GetObject() : nullptr, scope); |
