The SettingsManager can manage a set of values of varying type that are keyed by strings. It has a built-in mechanism to automatically save its contents to a file on the user's local machine. SettingsManager is thread-safe.
Pass the file name on the local computer to save the settings contents in the fileName parameter. Typically you would use the IHost interface (accessed by using WLHost.Instance) and its DataFolder property to determine the location of the save file. If you pass true in the encrypt parameter, the contents of the file will be encrypted.
The various overloaded Get methods return settings values keyed by the string key parameter. The following data types are supported:
The various overloaded Set methods let you set values keyed by the string key parameter. After setting a value, the SettingsManager will automatically save its contents to disk, at a rate controlled by the SaveThrottleSeconds property. It also contains a built-in static CleanUp routine that WL8 calls upon shutdown, ensuring that any pending saves are written to disk. The following data types are supported:
The name of the file on the local computer where the SettingsManager saves its contents. This is initially established in the constructor.
Provides access to the Dictionary that contains the SettingsManager entries.
Determine whether or not SettingsManager encrypts its contents when saving to disk. This property can also be set in a constructor parameter.
Determine the value, in seconds, that the SettingsManager will wait between saving its contents to disk. The default value is 1. The SettingsManager will save only when required, as it senses changed data, but this throttle ensures that it does not bog down the system with many repeated saves in situation where many settings values are set one after another.