Click or drag to resize
PluginSettings Class
The class that holds the settings for the plugins. These are loaded and saved via IPluginSettingsStorage.
Inheritance Hierarchy
SystemObject
  VirtualRadar.Interface.SettingsPluginSettings

Namespace: VirtualRadar.Interface.Settings
Assembly: VirtualRadar.Interface (in VirtualRadar.Interface.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public class PluginSettings

The PluginSettings type exposes the following members.

Constructors
  NameDescription
Public methodPluginSettings
Creates a new object.
Top
Properties
  NameDescription
Public propertyValues
Gets a collection of property names and their values. Plugins should ensure the keys for the values are unique across all plugins.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodReadBool(IPlugin, String)
Returns a nullable bool from Values.
Public methodReadBool(IPlugin, String, Boolean)
Returns a bool from Values.
Public methodReadDateTime(IPlugin, String)
Returns a nullable DateTime from Values. The DateTimeKind is local.
Public methodReadDateTime(IPlugin, String, DateTime)
Returns a DateTime from Values. The DateTimeKind is local.
Public methodReadDouble(IPlugin, String)
Returns a nullable double from Values.
Public methodReadDouble(IPlugin, String, Double)
Returns a double from Values.
Public methodReadInt(IPlugin, String)
Returns a nullable int from Values.
Public methodReadInt(IPlugin, String, Int32)
Returns an integer from Values.
Public methodReadLong(IPlugin, String)
Returns a nullable long from Values.
Public methodReadLong(IPlugin, String, Int64)
Returns a long from Values.
Public methodReadString
Returns a string from Values.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodWrite(IPlugin, String, Boolean)
Writes a bool into Values.
Public methodWrite(IPlugin, String, DateTime)
Writes a DateTime into Values.
Public methodWrite(IPlugin, String, Double)
Writes a double into Values.
Public methodWrite(IPlugin, String, Int32)
Writes an int into Values.
Public methodWrite(IPlugin, String, Int64)
Writes a long into Values.
Public methodWriteT(IPlugin, String, T)
Writes a value into Values.
Top
Remarks

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.

Examples
To load a setting from within an IPlugin:
IPluginSettingsStorage storage = Factory.Singleton.Resolve<IPluginSettingsStorage>().Singleton;
PluginSettings settings = storage.Load();

bool mySetting = ReadBool(this, "Key", true);
To save a setting from within an IPlugin: IPluginSettingsStorage storage = Factory.Singleton.Resolve<IPluginSettingsStorage>().Singleton; PluginSettings settings = storage.Load(); settings.Write(this, "Key", false); storage.Save(settings);
See Also