public void RemoveWatcher(PreferenceBag.PrefWatcher wliToRemove) { PreferenceBag.GetWriterLock(this._RWLockWatchers); try { this._listWatchers.Remove(wliToRemove); } finally { PreferenceBag.FreeWriterLock(this._RWLockWatchers); } }
private void _clearWatchers() { PreferenceBag.GetWriterLock(this._RWLockWatchers); try { this._listWatchers.Clear(); } finally { PreferenceBag.FreeWriterLock(this._RWLockWatchers); } }
public PreferenceBag.PrefWatcher AddWatcher(string sPrefixFilter, EventHandler <PrefChangeEventArgs> pcehHandler) { PreferenceBag.PrefWatcher prefWatcher = new PreferenceBag.PrefWatcher(sPrefixFilter.ToLower(), pcehHandler); PreferenceBag.GetWriterLock(this._RWLockWatchers); try { this._listWatchers.Add(prefWatcher); } finally { PreferenceBag.FreeWriterLock(this._RWLockWatchers); } return(prefWatcher); }
public string this[string sPrefName] { get { string result; try { PreferenceBag.GetReaderLock(this._RWLockPrefs); result = this._dictPrefs[sPrefName]; } finally { PreferenceBag.FreeReaderLock(this._RWLockPrefs); } return(result); } set { if (!PreferenceBag.isValidName(sPrefName)) { throw new ArgumentException(string.Format("Preference name must contain 1 to 255 characters from the set A-z0-9-_ and may not contain the word Internal.\n\nCaller tried to set: \"{0}\"", sPrefName)); } if (value == null) { this.RemovePref(sPrefName); return; } bool flag = false; try { PreferenceBag.GetWriterLock(this._RWLockPrefs); if (value != this._dictPrefs[sPrefName]) { flag = true; this._dictPrefs[sPrefName] = value; } } finally { PreferenceBag.FreeWriterLock(this._RWLockPrefs); } if (flag) { PrefChangeEventArgs oNotifyArgs = new PrefChangeEventArgs(sPrefName, value); this.AsyncNotifyWatchers(oNotifyArgs); } } }
public void RemovePref(string sPrefName) { bool flag = false; try { PreferenceBag.GetWriterLock(this._RWLockPrefs); flag = this._dictPrefs.ContainsKey(sPrefName); this._dictPrefs.Remove(sPrefName); } finally { PreferenceBag.FreeWriterLock(this._RWLockPrefs); } if (flag) { PrefChangeEventArgs oNotifyArgs = new PrefChangeEventArgs(sPrefName, null); this.AsyncNotifyWatchers(oNotifyArgs); } }
private void ReadRegistry() { if (this._sRegistryPath == null) { return; } RegistryKey registryKey = Registry.CurrentUser.OpenSubKey(this._sRegistryPath + "\\" + this._sCurrentProfile, RegistryKeyPermissionCheck.ReadSubTree, RegistryRights.ExecuteKey); if (registryKey == null) { return; } string[] valueNames = registryKey.GetValueNames(); try { PreferenceBag.GetWriterLock(this._RWLockPrefs); string[] array = valueNames; for (int i = 0; i < array.Length; i++) { string text = array[i]; if (text.Length >= 1 && !text.OICContains("ephemeral")) { try { this._dictPrefs[text] = (string)registryKey.GetValue(text, string.Empty); } catch (Exception) { } } } } finally { PreferenceBag.FreeWriterLock(this._RWLockPrefs); registryKey.Close(); } }