Base class for persistent settings; a replacement for the UserSettings.UserSettingsBase system which has a couple of quirks and whose files are hard to find, read, and write by humans.
More...
|
static void | LoadDefaults () |
| Creates a new settings object without loading the saved settings from file and without saving the current settings from file. More...
|
|
static void | LoadDefaults () |
| Creates a new settings object without loading the saved settings from file and without saving the current settings from file. More...
|
|
|
virtual void | WriteYamlHeader (StreamWriter streamWriter) |
| Writes a header to the YAML file before all other data. To write comments, prefix lines with "#". More...
|
|
virtual void | WriteYamlHeader (StreamWriter streamWriter) |
| Writes a header to the YAML file before all other data. To write comments, prefix lines with "#". More...
|
|
|
static T | FromFileOrDefault< T > (string yamlFile) |
| Loads options from a file, or creates a default instance if the I/O operation failed. This is a protected method. Implementations of UserSettingsBase must provide simple-access methods defined in IUserSettings to make life easier for the outside world. More...
|
|
static T | FromFileOrDefault< T > (string yamlFile) |
| Loads options from a file, or creates a default instance if the I/O operation failed. This is a protected method. Implementations of UserSettingsBase must provide simple-access methods defined in IUserSettings to make life easier for the outside world. More...
|
|
|
static UserSettingsBase | Default [get, set] |
| Gets the singleton instance of the user settings. Applications that use this framework may want to replace the default singleton with an instance of their own (UserSettingsBase.Default = myInstance), in order to avoid having two separate settings files, one for the Bovender framework and one for the application itself. More...
|
|
string | User [get, set] |
|
string | Email [get, set] |
|
bool | CcUserOnExceptionReport [get, set] |
|
string | DownloadFolder [get, set] |
|
bool | WasFromFile [get, protected set] |
| Is true if the options store was initially loaded from a YAML file. More...
|
|
Exception | Exception [get, protected set] |
| Gets the last IOException, if any occurred. More...
|
|
Base class for persistent settings; a replacement for the UserSettings.UserSettingsBase system which has a couple of quirks and whose files are hard to find, read, and write by humans.
To make use of this options system, derive your own class from OptionsBase and add properties to it. These will be automatically saved to and loaded from a YAML file.
◆ UserSettingsBase() [1/2]
Bovender.UserSettings.UserSettingsBase.UserSettingsBase |
( |
| ) |
|
|
inline |
◆ UserSettingsBase() [2/2]
Bovender.UserSettings.UserSettingsBase.UserSettingsBase |
( |
| ) |
|
|
inline |
◆ FromFileOrDefault< T >() [1/2]
static T Bovender.UserSettings.UserSettingsBase.FromFileOrDefault< T > |
( |
string |
yamlFile | ) |
|
|
inlinestaticprotected |
Loads options from a file, or creates a default instance if the I/O operation failed. This is a protected method. Implementations of UserSettingsBase must provide simple-access methods defined in IUserSettings to make life easier for the outside world.
- Parameters
-
yamlFile | Path to a YAML file that holds the options. |
- Template Parameters
-
T | Type of the OptionsStore derivative to load. |
- Returns
- OptionsStore object, either with values loaded from file or with default values.
- Type Constraints
-
T | : | UserSettingsBase | |
T | : | new() | |
◆ FromFileOrDefault< T >() [2/2]
static T Bovender.UserSettings.UserSettingsBase.FromFileOrDefault< T > |
( |
string |
yamlFile | ) |
|
|
inlinestaticprotected |
Loads options from a file, or creates a default instance if the I/O operation failed. This is a protected method. Implementations of UserSettingsBase must provide simple-access methods defined in IUserSettings to make life easier for the outside world.
- Parameters
-
yamlFile | Path to a YAML file that holds the options. |
- Template Parameters
-
T | Type of the OptionsStore derivative to load. |
- Returns
- OptionsStore object, either with values loaded from file or with default values.
- Type Constraints
-
T | : | UserSettingsBase | |
T | : | new() | |
◆ GetSettingsFilePath() [1/2]
virtual string Bovender.UserSettings.UserSettingsBase.GetSettingsFilePath |
( |
| ) |
|
|
inlinevirtual |
◆ GetSettingsFilePath() [2/2]
virtual string Bovender.UserSettings.UserSettingsBase.GetSettingsFilePath |
( |
| ) |
|
|
inlinevirtual |
◆ LoadDefaults() [1/2]
static void Bovender.UserSettings.UserSettingsBase.LoadDefaults |
( |
| ) |
|
|
inlinestatic |
Creates a new settings object without loading the saved settings from file and without saving the current settings from file.
Derived classes should implement their own static variant of this method (which cannot be marked virtual because it is static), in order to generate an instance of the derived class, rather than an instance of UserSettingsBase.
◆ LoadDefaults() [2/2]
static void Bovender.UserSettings.UserSettingsBase.LoadDefaults |
( |
| ) |
|
|
inlinestatic |
Creates a new settings object without loading the saved settings from file and without saving the current settings from file.
Derived classes should implement their own static variant of this method (which cannot be marked virtual because it is static), in order to generate an instance of the derived class, rather than an instance of UserSettingsBase.
◆ Save() [1/2]
void Bovender.UserSettings.UserSettingsBase.Save |
( |
| ) |
|
|
inline |
Saves the user settings to a file.
◆ Save() [2/2]
void Bovender.UserSettings.UserSettingsBase.Save |
( |
| ) |
|
|
inline |
Saves the user settings to a file.
◆ WriteYamlHeader() [1/2]
virtual void Bovender.UserSettings.UserSettingsBase.WriteYamlHeader |
( |
StreamWriter |
streamWriter | ) |
|
|
inlineprotectedvirtual |
◆ WriteYamlHeader() [2/2]
virtual void Bovender.UserSettings.UserSettingsBase.WriteYamlHeader |
( |
StreamWriter |
streamWriter | ) |
|
|
inlineprotectedvirtual |
◆ CcUserOnExceptionReport
bool Bovender.UserSettings.UserSettingsBase.CcUserOnExceptionReport |
|
getset |
◆ Default
Gets the singleton instance of the user settings. Applications that use this framework may want to replace the default singleton with an instance of their own (UserSettingsBase.Default = myInstance), in order to avoid having two separate settings files, one for the Bovender framework and one for the application itself.
◆ DownloadFolder
string Bovender.UserSettings.UserSettingsBase.DownloadFolder |
|
getset |
◆ Email
string Bovender.UserSettings.UserSettingsBase.Email |
|
getset |
◆ Exception
Exception Bovender.UserSettings.UserSettingsBase.Exception |
|
getprotected set |
Gets the last IOException, if any occurred.
◆ User
string Bovender.UserSettings.UserSettingsBase.User |
|
getset |
◆ WasFromFile
bool Bovender.UserSettings.UserSettingsBase.WasFromFile |
|
getprotected set |
Is true if the options store was initially loaded from a YAML file.
The documentation for this class was generated from the following file: