![]() |
BogaNet 1.4.0
|
Container for the application preferences. 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 object | Get (string key, bool obfuscated=false) |
| Get an object for a key. | |
| virtual bool | TryGet (string key, out object result, bool obfuscated=false) |
| Tries to get an object for a key. | |
| virtual void | Set (string key, object value, bool obfuscated=false) |
| Set an object for a key. | |
| override string | ToString () |
Protected Attributes | |
| string | _file = "BNPrefs.json" |
| Dictionary< string, object > | _preferences = [] |
Properties | |
| virtual ByteObf | IV = 139 [set] |
| IV for the obfuscated data. | |
| virtual bool | IsLoaded [get, protected set] |
| Is the preferences-container loaded? | |
| virtual bool | IsSaved [get, protected set] |
| Is the current preferences-container saved? | |
| virtual List< string > | Keys [get] |
| Current keys of the preferences. | |
| virtual int | Count [get] |
| Current count of keys from the preferences. | |
Properties inherited from BogaNet.Prefs.IPreferencesContainer | |
Events | |
| IFilePreferences.? FileLoaded | OnFileLoaded |
| IFilePreferences.? FileSaved | OnFileSaved |
Container for the application preferences.
|
virtual |
Checks if a given key exists in the preferences.
| key | Key to check |
| ArgumentNullException |
Implements BogaNet.Prefs.IPreferencesContainer.
|
virtual |
Delete all preferences, including the file.
| filepath | Preference file to delete |
returns>True if the operation was successful
| Exception |
Implements BogaNet.Prefs.IPreferencesContainer.
Reimplemented in BogaNet.Prefs.BrowserPreferencesContainer.
|
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.IPreferencesContainer.
|
virtual |
Load the preference file.
| filepath | Preference file to load |
returns>True if the operation was successful
| Exception |
Implements BogaNet.Prefs.IPreferencesContainer.
Reimplemented in BogaNet.Prefs.BrowserPreferencesContainer.
|
virtual |
Load the preference file asynchronously.
| filepath | Preference file to load |
returns>True if the operation was successful
| Exception |
Implements BogaNet.Prefs.IPreferencesContainer.
Reimplemented in BogaNet.Prefs.BrowserPreferencesContainer.
|
virtual |
Removes a key/value from the preferences.
| key | Key (and value) to delete |
returns>True if the operation was successful
| ArgumentNullException |
Implements BogaNet.Prefs.IPreferencesContainer.
|
virtual |
Save the preference file.
| filepath | Preference file to save |
returns>True if the operation was successful
| Exception |
Implements BogaNet.Prefs.IPreferencesContainer.
Reimplemented in BogaNet.Prefs.BrowserPreferencesContainer.
|
virtual |
Save the preference file asynchronously.
| filepath | Preference file to save |
returns>True if the operation was successful
| Exception |
Implements BogaNet.Prefs.IPreferencesContainer.
Reimplemented in BogaNet.Prefs.BrowserPreferencesContainer.
|
virtual |
Set an object for a key.
| key | Key for the string |
| value | Object for the preferences |
| obfuscated | Obfuscate value in the preferences (optional, default: false) |
| ArgumentNullException |
Implements BogaNet.Prefs.IPreferencesContainer.
| override string BogaNet.Prefs.PreferencesContainer.ToString | ( | ) |
|
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.IPreferencesContainer.
|
protected |
|
protected |
|
get |
Current count of keys from the preferences.
Implements BogaNet.Prefs.IPreferencesContainer.
|
getprotected set |
Is the preferences-container loaded?
Implements BogaNet.Prefs.IPreferencesContainer.
|
getprotected set |
Is the current preferences-container saved?
Implements BogaNet.Prefs.IPreferencesContainer.
|
set |
IV for the obfuscated data.
Implements BogaNet.Prefs.IPreferencesContainer.
|
get |
Current keys of the preferences.
Implements BogaNet.Prefs.IPreferencesContainer.
| IFilePreferences.? FileLoaded BogaNet.Prefs.PreferencesContainer.OnFileLoaded |
| IFilePreferences.? FileSaved BogaNet.Prefs.PreferencesContainer.OnFileSaved |