diff options
| -rw-r--r-- | docs/guide/type.md | 6 | ||||
| -rw-r--r-- | python/settings.py | 23 |
2 files changed, 29 insertions, 0 deletions
diff --git a/docs/guide/type.md b/docs/guide/type.md index b4df1ef4..d704cbd2 100644 --- a/docs/guide/type.md +++ b/docs/guide/type.md @@ -182,6 +182,12 @@ __convention __noreturn ``` +To use the `__convention` keyword, pass in the convention name as a parameter argument: + +``` +__convention("customconvention") +``` + #### Applying Structures and Types diff --git a/python/settings.py b/python/settings.py index 0bf0686f..8bb87f80 100644 --- a/python/settings.py +++ b/python/settings.py @@ -60,6 +60,29 @@ class Settings(object): Individual settings are identified by a key, which is a string in the form of **'<group>.<name>'**. Groups provide a simple way \ to categorize settings. Additionally, sub-categories can be expressed directly in the name part of the key with a similar dot notation. + + Here's a simple example using a Resource Scope to cause settings to be saved inside of a BNDB when saved: + + >>> bv2 = open_view("/tmp/ls") + >>> plugin_settings = Settings() + >>> description = "Tells Zhu Li to do the thing." + >>> title = "Do the thing" + >>> schema = f'{{"description" : "{description}", "title" : "{title}", "default" : true, "type" : "boolean"}}' + >>> plugin_settings.register_setting("ui.dothething", schema) + True + >>> plugin_settings.set_bool("ui.dothething", False, bv, SettingsScope.SettingsResourceScope) + True + >>> # Resource scope will save the setting in the BNDB itself + >>> bv2.create_database("/tmp/ls.bndb") + True + >>> bv = open_view("/tmp/ls") + >>> # If in a plugin we would need to make sure we re-regsitered the setting before querying + >>> plugin_settings.get_bool("ui.dothething", bv) + True + >>> bv = binaryninja.open_view("/tmp/ls.bndb") + >>> plugin_settings.get_bool("ui.dothething", bv) + False + """ handle = core.BNCreateSettings("default") |
