Overview
For each plugin, Logi Plugin Service stores a collection of setting names and values. Here are some characteristics of plugin settings:
- Both setting names and values are of
String
type. - The setting names are case-insensitive.
- Plugin settings are persistent and are stored encrypted.
- Any setting can be marked to be backed up in the cloud for the logged-in Logi user.
Usage
The following methods are available in the Plugin
class.
Read setting
Returns a plugin setting.
Returns true
if the setting exists and false
otherwise.
If the setting does not exist, then settingValue
is set to null
.
Write setting
Saves a plugin setting.
Set backupOnline
to true
to backup this setting in the cloud and false
to keep it only locally.
Delete setting
Deletes a plugin setting.
List all settings
Returns a list of plugin setting names.
Example
private String GetUserId()
{
const String SettingName = "UserId";
// first try to get existing user ID
if (this.TryGetPluginSetting(SettingName, out var existingUserId))
{
return existingUserId;
}
// if it does not exist, generate a new one and save it
var newUserId = Guid.NewGuid().ToString("N");
this.SetPluginSetting(SettingName, newUserId, false);
return newUserId;
}