PluginSettings Class |
Namespace: VirtualRadar.Interface.Settings
The PluginSettings type exposes the following members.
Name | Description | |
---|---|---|
PluginSettings |
Creates a new object.
|
Name | Description | |
---|---|---|
Values |
Gets a collection of property names and their values. Plugins should ensure the keys for the values
are unique across all plugins.
|
Name | Description | |
---|---|---|
Equals | (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ReadBool(IPlugin, String) |
Returns a nullable bool from Values.
| |
ReadBool(IPlugin, String, Boolean) |
Returns a bool from Values.
| |
ReadDateTime(IPlugin, String) |
Returns a nullable DateTime from Values. The DateTimeKind is local.
| |
ReadDateTime(IPlugin, String, DateTime) |
Returns a DateTime from Values. The DateTimeKind is local.
| |
ReadDouble(IPlugin, String) |
Returns a nullable double from Values.
| |
ReadDouble(IPlugin, String, Double) |
Returns a double from Values.
| |
ReadInt(IPlugin, String) |
Returns a nullable int from Values.
| |
ReadInt(IPlugin, String, Int32) |
Returns an integer from Values.
| |
ReadLong(IPlugin, String) |
Returns a nullable long from Values.
| |
ReadLong(IPlugin, String, Int64) |
Returns a long from Values.
| |
ReadString |
Returns a string from Values.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
Write(IPlugin, String, Boolean) |
Writes a bool into Values.
| |
Write(IPlugin, String, DateTime) |
Writes a DateTime into Values.
| |
Write(IPlugin, String, Double) |
Writes a double into Values.
| |
Write(IPlugin, String, Int32) |
Writes an int into Values.
| |
Write(IPlugin, String, Int64) |
Writes a long into Values.
| |
WriteT(IPlugin, String, T) |
Writes a value into Values.
|
It is important to note that this object will contain every setting for every plugin, not just the plugin that loaded it. When writing settings out you should read the old settings first and amend them rather than create new settings and save them, otherwise you will obliterate the settings for all of the other plugins.
The settings are stored as strings in the Values collection. The collection is indexed by a key which must be unique. If you use the supplied Read and Write methods then the Id property is joined to the key supplied to the method to form a full key that should be unique to your plugin. The Read and Write methods also ensure that when ValueTypes are converted to and from strings they use the invariant culture, e.g. the same string is written for the floating point value 1.234 regardless of the region setting that Windows is configured for.
IPluginSettingsStorage storage = Factory.Singleton.Resolve<IPluginSettingsStorage>().Singleton; PluginSettings settings = storage.Load(); bool mySetting = ReadBool(this, "Key", true);