![]() |
BogaNet 1.4.0
|
Preferences for the application. More...
Public Member Functions | |
virtual bool | Load (string filepath="") |
Load the preference file. | |
virtual async Task< bool > | LoadAsync (string filepath="") |
Load the preference file asynchronously. | |
virtual bool | Save (string filepath="") |
Save the preference file. | |
virtual async Task< bool > | SaveAsync (string filepath="") |
Save the preference file asynchronously. | |
virtual bool | Delete (string filepath="") |
Delete all preferences, including the file. | |
virtual bool | Remove (string key) |
Removes a key/value from the preferences. | |
virtual bool | ContainsKey (string key) |
Checks if a given key exists in the preferences. | |
virtual string | GetString (string key, bool obfuscated=false) |
Get a string for a key. | |
virtual bool | TryGetString (string key, out string result, bool obfuscated=false) |
Tries to get a string for a key. | |
virtual T | GetObject< T > (string key, bool obfuscated=false) |
Get an object for a key. | |
virtual bool | TryGetObject< T > (string key, out T result, bool obfuscated=false) |
Tries to get an object for a key. | |
virtual T | GetNumber< T > (string key, bool obfuscated=false) |
Get a number for a key. | |
virtual bool | TryGetNumber< T > (string key, out T result, bool obfuscated=false) |
Tries to get a number for a key. | |
virtual bool | GetBool (string key, bool obfuscated=false) |
Get a bool for a key. | |
virtual bool | TryGetBool (string key, out bool result, bool obfuscated=false) |
Tries to get a bool for a key. | |
virtual DateTime | GetDate (string key, bool obfuscated=false, TimeZoneInfo? usedTZ=null) |
Get a DateTime for a key. | |
virtual bool | TryGetDate (string key, out DateTime result, bool obfuscated=false, TimeZoneInfo? usedTZ=null) |
Tries to get a DateTime for a key. | |
virtual void | Set (string key, string value, bool obfuscated=false) |
Set a string for a key. | |
virtual void | Set (string key, object value, bool obfuscated=false) |
Set an object for a key. | |
virtual void | Set< T > (string key, T value, bool obfuscated=false) |
Set a number for a key. | |
virtual void | Set (string key, bool value, bool obfuscated=false) |
Set a bool for a key. | |
virtual void | Set (string key, DateTime value, bool obfuscated=false) |
Set a DateTime for a key. | |
![]() | |
delegate void | FileLoaded (string file) |
Delegate for the load status of the file. | |
delegate void | FileSaved (string file) |
Delegate for the save status of the file. | |
Protected Member Functions | |
Preferences () | |
Properties | |
virtual ByteObf | IV [set] |
IV for the obfuscated data. | |
virtual IPreferencesContainer | Container = new PreferencesContainer() [get, set] |
virtual bool | AutoSaveOnExit = true [get, set] |
Store the data automatically at application exit. | |
virtual bool | IsLoaded [get] |
Are the preferences loaded? | |
bool | IsSaved [get] |
Are the current preferences saved? | |
virtual List< string > | Keys [get] |
Current keys of the preferences. | |
virtual int | Count [get] |
Current count of keys from the preferences. | |
![]() | |
static T | Instance [get] |
![]() | |
![]() |
Events | |
IFilePreferences.? FileLoaded | OnFileLoaded |
IFilePreferences.? FileSaved | OnFileSaved |
![]() | |
FileLoaded | OnFileLoaded |
Event triggered whenever the file is loaded. | |
FileSaved | OnFileSaved |
Event triggered whenever the file is saved. | |
Preferences for the application.
|
protected |
|
virtual |
Checks if a given key exists in the preferences.
key | Key to check |
ArgumentNullException |
Implements BogaNet.Prefs.IPreferences.
|
virtual |
Delete all preferences, including the file.
filepath | Preference file to delete |
returns>True if the operation was successful
Exception |
Implements BogaNet.Prefs.IFilePreferences.
|
virtual |
Get a bool for a key.
key | Key for the bol. |
obfuscated | Obfuscate value in the preferences (optional, default: false) |
ArgumentNullException |
Implements BogaNet.Prefs.IPreferences.
|
virtual |
Get a DateTime for a key.
key | Key for the DateTime. |
obfuscated | Obfuscate value in the preferences (optional, default: false) |
usedTZ | Time zone of the date (optional, default: local) |
ArgumentNullException |
Implements BogaNet.Prefs.IPreferences.
|
virtual |
Get a number for a key.
key | Key for the number |
obfuscated | Obfuscate value in the preferences (optional, default: false) |
ArgumentNullException |
Implements BogaNet.Prefs.IPreferences.
T | : | INumber<T> |
|
virtual |
Get an object for a key.
key | Key for the object |
obfuscated | Obfuscate value in the preferences (optional, default: false) |
ArgumentNullException |
Implements BogaNet.Prefs.IPreferences.
|
virtual |
Get a string for a key.
key | Key for the string |
obfuscated | Obfuscate value in the preferences (optional, default: false) |
ArgumentNullException |
Implements BogaNet.Prefs.IPreferences.
|
virtual |
Load the preference file.
filepath | Preference file to load |
returns>True if the operation was successful
Exception |
Implements BogaNet.Prefs.IFilePreferences.
|
virtual |
Load the preference file asynchronously.
filepath | Preference file to load |
returns>True if the operation was successful
Exception |
Implements BogaNet.Prefs.IFilePreferences.
|
virtual |
Removes a key/value from the preferences.
key | Key (and value) to delete |
ArgumentNullException |
Implements BogaNet.Prefs.IPreferences.
|
virtual |
Save the preference file.
filepath | Preference file to save |
returns>True if the operation was successful
Exception |
Implements BogaNet.Prefs.IFilePreferences.
|
virtual |
Save the preference file asynchronously.
filepath | Preference file to save |
returns>True if the operation was successful
Exception |
Implements BogaNet.Prefs.IFilePreferences.
|
virtual |
Set a bool for a key.
key | Key for the bool |
value | Bool for the preferences |
obfuscated | Obfuscate value in the preferences (optional, default: false) |
ArgumentNullException |
Implements BogaNet.Prefs.IPreferences.
|
virtual |
Set a DateTime for a key.
key | Key for the DateTime |
value | DateTime for the preferences |
obfuscated | Obfuscate value in the preferences (optional, default: false) |
ArgumentNullException |
Implements BogaNet.Prefs.IPreferences.
|
virtual |
Set an object for a key.
key | Key for the object |
value | Object for the preferences |
obfuscated | Obfuscate value in the preferences (optional, default: false) |
ArgumentNullException |
Implements BogaNet.Prefs.IPreferences.
|
virtual |
Set a string for a key.
key | Key for the string |
value | String for the preferences |
obfuscated | Obfuscate value in the preferences (optional, default: false) |
ArgumentNullException |
Implements BogaNet.Prefs.IPreferences.
|
virtual |
Set a number for a key.
key | Key for the number |
value | Number for the preferences |
obfuscated | Obfuscate value in the preferences (optional, default: false) |
ArgumentNullException |
Implements BogaNet.Prefs.IPreferences.
T | : | INumber<T> |
|
virtual |
Tries to get a bool for a key.
key | Key for the bol. |
result | out parameter for the result |
obfuscated | Obfuscate value in the preferences (optional, default: false) |
ArgumentNullException |
Implements BogaNet.Prefs.IPreferences.
|
virtual |
Tries to get a DateTime for a key.
key | Key for the DateTime. |
result | out parameter for the result |
obfuscated | Obfuscate value in the preferences (optional, default: false) |
usedTZ | Time zone of the date (optional, default: local) |
ArgumentNullException |
Implements BogaNet.Prefs.IPreferences.
|
virtual |
Tries to get a number for a key.
key | Key for the number |
result | out parameter for the result |
obfuscated | Obfuscate value in the preferences (optional, default: false) |
ArgumentNullException |
Implements BogaNet.Prefs.IPreferences.
T | : | INumber<T> |
|
virtual |
Tries to get an object for a key.
key | Key for the object |
result | out parameter for the result |
obfuscated | Obfuscate value in the preferences (optional, default: false) |
ArgumentNullException |
Implements BogaNet.Prefs.IPreferences.
|
virtual |
Tries to get a string for a key.
key | Key for the string |
result | out parameter for the result |
obfuscated | Obfuscate value in the preferences (optional, default: false) |
ArgumentNullException |
Implements BogaNet.Prefs.IPreferences.
|
getset |
Store the data automatically at application exit.
Implements BogaNet.Prefs.IFilePreferences.
|
getset |
|
get |
Current count of keys from the preferences.
Implements BogaNet.Prefs.IPreferences.
|
get |
Are the preferences loaded?
Implements BogaNet.Prefs.IPreferences.
|
get |
Are the current preferences saved?
Implements BogaNet.Prefs.IPreferences.
|
set |
IV for the obfuscated data.
Implements BogaNet.Prefs.IPreferences.
|
get |
Current keys of the preferences.
Implements BogaNet.Prefs.IPreferences.
IFilePreferences.? FileLoaded BogaNet.Prefs.Preferences.OnFileLoaded |
IFilePreferences.? FileSaved BogaNet.Prefs.Preferences.OnFileSaved |