ClassPreferenceBag
The PreferenceBag is used to maintain a threadsafe Key/Value list of preferences, persisted in the registry, and with appropriate eventing when a value changes.
Definition
Namespace:Fiddler
Assembly:FiddlerCore.dll
Syntax:
public class PreferenceBag : IFiddlerPreferences, IEnumerable<KeyValuePair<string, string>>, IEnumerable
Inheritance: objectPreferenceBag
Implements:
Inherited Members
Properties
CurrentProfile
Returns a string naming the current profile
this[string]
Indexer into the Preference collection.
Methods
AddWatcher(string, EventHandler<PrefChangeEventArgs>)
Add a watcher for changes to the specified preference or preference branch.
Declaration
public PreferenceBag.PrefWatcher AddWatcher(string sPrefixFilter, EventHandler<PrefChangeEventArgs> pcehHandler)
Parameters
sPrefixFilter
Preference branch to monitor, or String.Empty to watch all
pcehHandler
EventHandler<PrefChangeEventArgs>
The EventHandler accepting PrefChangeEventArgs to notify
Returns
Returns the PrefWatcher object which has been added, store to pass to RemoveWatcher later.
Implements
GetBoolPref(string, bool)
Return a bool preference.
Declaration
public bool GetBoolPref(string sPrefName, bool bDefault)
Parameters
sPrefName
The Preference name
bDefault
The default value to return if the specified preference does not exist
Returns
The boolean value of the Preference, or the default value
Implements
GetEnumerator()
Declaration
public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
Returns
Implements
GetInt32Pref(string, int)
Return an Int32 Preference.
GetPrefArray()
Get a string array of the preference names
Declaration
public string[] GetPrefArray()
Returns
string[]
string[] of preference names
GetStringPref(string, string)
Gets a preference's value as a string
RemovePref(string)
Delete a Preference from the collection.
Declaration
public void RemovePref(string sPrefName)
Parameters
sPrefName
The name of the Preference to be removed.
Implements
RemoveWatcher(PrefWatcher)
Remove a previously attached Watcher
Declaration
public void RemoveWatcher(PreferenceBag.PrefWatcher wliToRemove)
Parameters
wliToRemove
The previously-specified Watcher
Implements
SetBoolPref(string, bool)
Update or create a Boolean preference.
SetInt32Pref(string, int)
Update or create a Int32 Preference
SetPrefs(IEnumerable<KeyValuePair<string, string>>)
Update or create multiple preferences.
Declaration
public void SetPrefs(IEnumerable<KeyValuePair<string, string>> prefs)
Parameters
prefs
IEnumerable<KeyValuePair<string, string>>
An enumeration of the preferences' names and values to store.
Implements
SetStringPref(string, string)
Update or create a string preference.
ToString()
Return a description of the contents of the preference bag
Declaration
public override string ToString()
Returns
Multi-line string
Overrides
ToString(bool)
Return a string-based serialization of the Preferences settings.