summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--binaryninjaapi.h1
-rw-r--r--binaryninjacore.h3
-rw-r--r--python/settings.py9
-rw-r--r--settings.cpp8
4 files changed, 17 insertions, 4 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index a7d66e9b..0a775ac8 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -4573,6 +4573,7 @@ namespace BinaryNinja
bool Set(const std::string& key, const char* value, Ref<BinaryView> view = nullptr, BNSettingsScope scope = SettingsAutoScope);
bool Set(const std::string& key, const std::string& value, Ref<BinaryView> view = nullptr, BNSettingsScope scope = SettingsAutoScope);
bool Set(const std::string& key, const std::vector<std::string>& value, Ref<BinaryView> view = nullptr, BNSettingsScope scope = SettingsAutoScope);
+ bool SetJson(const std::string& key, const std::string& value, Ref<BinaryView> view = nullptr, BNSettingsScope scope = SettingsAutoScope);
};
// explicit specializations
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 96184f3a..9c80cd9b 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -3970,7 +3970,7 @@ extern "C"
BINARYNINJACOREAPI uint64_t BNSettingsGetUInt64(BNSettings* settings, const char* key, BNBinaryView* view, BNSettingsScope* scope);
BINARYNINJACOREAPI char* BNSettingsGetString(BNSettings* settings, const char* key, BNBinaryView* view, BNSettingsScope* scope);
BINARYNINJACOREAPI const char** BNSettingsGetStringList(BNSettings* settings, const char* key, BNBinaryView* view, BNSettingsScope* scope, size_t* inoutSize);
- BINARYNINJACOREAPI char* BNSettingsGetJsonString(BNSettings* settings, const char* key, BNBinaryView* view, BNSettingsScope* scope);
+ BINARYNINJACOREAPI char* BNSettingsGetJson(BNSettings* settings, const char* key, BNBinaryView* view, BNSettingsScope* scope);
BINARYNINJACOREAPI bool BNSettingsSetBool(BNSettings* settings, BNBinaryView* view, BNSettingsScope scope, const char* key, bool value);
BINARYNINJACOREAPI bool BNSettingsSetDouble(BNSettings* settings, BNBinaryView* view, BNSettingsScope scope, const char* key, double value);
@@ -3978,6 +3978,7 @@ extern "C"
BINARYNINJACOREAPI bool BNSettingsSetUInt64(BNSettings* settings, BNBinaryView* view, BNSettingsScope scope, const char* key, uint64_t value);
BINARYNINJACOREAPI bool BNSettingsSetString(BNSettings* settings, BNBinaryView* view, BNSettingsScope scope, const char* key, const char* value);
BINARYNINJACOREAPI bool BNSettingsSetStringList(BNSettings* settings, BNBinaryView* view, BNSettingsScope scope, const char* key, const char** value, size_t size);
+ BINARYNINJACOREAPI bool BNSettingsSetJson(BNSettings* settings, BNBinaryView* view, BNSettingsScope scope, const char* key, const char* value);
//Metadata APIs
diff --git a/python/settings.py b/python/settings.py
index 66f84fe9..4521fa78 100644
--- a/python/settings.py
+++ b/python/settings.py
@@ -185,7 +185,7 @@ class Settings(object):
def get_json(self, key, view = None):
if view is not None:
view = view.handle
- return core.BNSettingsGetJsonString(self.handle, key, view, None)
+ return core.BNSettingsGetJson(self.handle, key, view, None)
def get_bool_with_scope(self, key, view = None, scope = SettingsScope.SettingsAutoScope):
if view is not None:
@@ -231,7 +231,7 @@ class Settings(object):
if view is not None:
view = view.handle
c_scope = core.SettingsScopeEnum(scope)
- result = core.BNSettingsGetJsonString(self.handle, key, view, ctypes.byref(c_scope))
+ result = core.BNSettingsGetJson(self.handle, key, view, ctypes.byref(c_scope))
return (result, SettingsScope(c_scope.value))
def set_bool(self, key, value, view = None, scope = SettingsScope.SettingsAutoScope):
@@ -263,3 +263,8 @@ class Settings(object):
for i in range(len(value)):
string_list[i] = value[i].encode('charmap')
return core.BNSettingsSetStringList(self.handle, view, scope, key, string_list, length)
+
+ def set_json(self, key, value, view = None, scope = SettingsScope.SettingsAutoScope):
+ if view is not None:
+ view = view.handle
+ return core.BNSettingsSetJson(self.handle, view, scope, key, value)
diff --git a/settings.cpp b/settings.cpp
index 46119905..62d928e1 100644
--- a/settings.cpp
+++ b/settings.cpp
@@ -249,7 +249,7 @@ template<> vector<string> Settings::Get<vector<string>>(const string& key, Ref<B
string Settings::GetJson(const string& key, Ref<BinaryView> view, BNSettingsScope* scope)
{
- char* tmpStr = BNSettingsGetJsonString(m_object, key.c_str(), view ? view->GetObject() : nullptr, scope);
+ char* tmpStr = BNSettingsGetJson(m_object, key.c_str(), view ? view->GetObject() : nullptr, scope);
string result(tmpStr);
BNFreeString(tmpStr);
return result;
@@ -311,3 +311,9 @@ bool Settings::Set(const string& key, const vector<string>& value, Ref<BinaryVie
BNFreeStringList(buffer, value.size());
return result;
}
+
+
+bool Settings::SetJson(const string& key, const string& value, Ref<BinaryView> view, BNSettingsScope scope)
+{
+ return BNSettingsSetJson(m_object, view ? view->GetObject() : nullptr, scope, key.c_str(), value.c_str());
+}