public static Lookup ( |
||
rkey | ||
createNonExisting | bool | |
Результат |
public void DeleteKey(RegistryKey rkey, string keyname, bool throw_if_missing) { KeyHandler self = KeyHandler.Lookup(rkey, true); if (self == null) { // key is marked for deletion if (!throw_if_missing) { return; } throw new ArgumentException("the given value does not exist"); } string dir = Path.Combine(self.Dir, ToUnix(keyname)); if (Directory.Exists(dir)) { Directory.Delete(dir, true); KeyHandler.Drop(dir); } else if (throw_if_missing) { throw new ArgumentException("the given value does not exist"); } }
public void SetValue(RegistryKey rkey, string name, object value, RegistryValueKind valueKind) { KeyHandler keyHandler = KeyHandler.Lookup(rkey, true); if (keyHandler == null) { throw RegistryKey.CreateMarkedForDeletionException(); } keyHandler.SetValue(name, value, valueKind); }
public int ValueCount(RegistryKey rkey) { KeyHandler keyHandler = KeyHandler.Lookup(rkey, true); if (keyHandler == null) { throw RegistryKey.CreateMarkedForDeletionException(); } return(keyHandler.ValueCount); }
public int SubKeyCount(RegistryKey rkey) { KeyHandler keyHandler = KeyHandler.Lookup(rkey, true); if (keyHandler == null) { throw RegistryKey.CreateMarkedForDeletionException(); } return(Directory.GetDirectories(keyHandler.Dir).Length); }
public void SetValue(RegistryKey rkey, string name, object value) { KeyHandler self = KeyHandler.Lookup(rkey, true); if (self == null) { throw RegistryKey.CreateMarkedForDeletionException(); } self.SetValue(name, value); }
private RegistryKey CreateSubKey(RegistryKey rkey, string keyname, bool writable) { KeyHandler keyHandler = KeyHandler.Lookup(rkey, true); if (keyHandler == null) { throw RegistryKey.CreateMarkedForDeletionException(); } return(keyHandler.Ensure(rkey, UnixRegistryApi.ToUnix(keyname), writable)); }
public void Flush(RegistryKey rkey) { KeyHandler keyHandler = KeyHandler.Lookup(rkey, false); if (keyHandler == null) { return; } keyHandler.Flush(); }
public int SubKeyCount(RegistryKey rkey) { KeyHandler self = KeyHandler.Lookup(rkey, true); if (self == null) { throw RegistryKey.CreateMarkedForDeletionException(); } return(self.GetSubKeyCount()); }
public string[] GetValueNames(RegistryKey rkey) { KeyHandler keyHandler = KeyHandler.Lookup(rkey, true); if (keyHandler == null) { throw RegistryKey.CreateMarkedForDeletionException(); } return(keyHandler.GetValueNames()); }
public void Flush(RegistryKey rkey) { KeyHandler self = KeyHandler.Lookup(rkey, false); if (self == null) { // we do not need to flush changes as key is marked for deletion return; } self.Flush(); }
public RegistryValueKind GetValueKind(RegistryKey rkey, string name) { KeyHandler self = KeyHandler.Lookup(rkey, true); if (self != null) { return(self.GetValueKind(name)); } // key was removed since it was opened or it does not exist. return(RegistryValueKind.Unknown); }
public string[] GetSubKeyNames(RegistryKey rkey) { KeyHandler keyHandler = KeyHandler.Lookup(rkey, true); DirectoryInfo directoryInfo = new DirectoryInfo(keyHandler.Dir); DirectoryInfo[] directories = directoryInfo.GetDirectories(); string[] array = new string[directories.Length]; for (int i = 0; i < directories.Length; i++) { DirectoryInfo directoryInfo2 = directories[i]; array[i] = directoryInfo2.Name; } return(array); }
public string [] GetSubKeyNames(RegistryKey rkey) { KeyHandler self = KeyHandler.Lookup(rkey, true); DirectoryInfo selfDir = new DirectoryInfo(self.Dir); DirectoryInfo[] subDirs = selfDir.GetDirectories(); string[] subKeyNames = new string[subDirs.Length]; for (int i = 0; i < subDirs.Length; i++) { DirectoryInfo subDir = subDirs[i]; subKeyNames[i] = subDir.Name; } return(subKeyNames); }
public object GetValue(RegistryKey rkey, string name, object default_value, RegistryValueOptions options) { KeyHandler keyHandler = KeyHandler.Lookup(rkey, true); if (keyHandler == null) { return(default_value); } if (keyHandler.ValueExists(name)) { return(keyHandler.GetValue(name, options)); } return(default_value); }
public void DeleteValue(RegistryKey rkey, string name, bool throw_if_missing) { KeyHandler keyHandler = KeyHandler.Lookup(rkey, true); if (keyHandler == null) { return; } if (throw_if_missing && !keyHandler.ValueExists(name)) { throw new ArgumentException("the given value does not exist"); } keyHandler.RemoveValue(name); }
private RegistryKey CreateSubKey(RegistryKey rkey, string keyname, bool writable, bool is_volatile) { KeyHandler self = KeyHandler.Lookup(rkey, true); if (self == null) { throw RegistryKey.CreateMarkedForDeletionException(); } if (KeyHandler.VolatileKeyExists(self.Dir) && !is_volatile) { throw new IOException("Cannot create a non volatile subkey under a volatile key."); } return(self.Ensure(rkey, ToUnix(keyname), writable, is_volatile)); }
public object GetValue(RegistryKey rkey, string name, object default_value, RegistryValueOptions options) { KeyHandler self = KeyHandler.Lookup(rkey, true); if (self == null) { // key was removed since it was opened return(default_value); } if (self.ValueExists(name)) { return(self.GetValue(name, options)); } return(default_value); }
public RegistryKey OpenSubKey(RegistryKey rkey, string keyname, bool writable) { KeyHandler keyHandler = KeyHandler.Lookup(rkey, true); if (keyHandler == null) { return(null); } RegistryKey registryKey = keyHandler.Probe(rkey, UnixRegistryApi.ToUnix(keyname), writable); if (registryKey == null && UnixRegistryApi.IsWellKnownKey(rkey.Name, keyname)) { registryKey = this.CreateSubKey(rkey, keyname, writable); } return(registryKey); }
public void DeleteValue(RegistryKey rkey, string name, bool throw_if_missing) { KeyHandler self = KeyHandler.Lookup(rkey, true); if (self == null) { // if key is marked for deletion, report success regardless of // throw_if_missing return; } if (throw_if_missing && !self.ValueExists(name)) { throw new ArgumentException("the given value does not exist"); } self.RemoveValue(name); }
public RegistryKey OpenSubKey(RegistryKey rkey, string keyname, bool writable) { KeyHandler self = KeyHandler.Lookup(rkey, true); if (self == null) { // return null if parent is marked for deletion return(null); } RegistryKey result = self.Probe(rkey, ToUnix(keyname), writable); if (result == null && IsWellKnownKey(rkey.Name, keyname)) { // create the subkey even if its parent was opened read-only result = CreateSubKey(rkey, keyname, writable); } return(result); }
public void DeleteKey(RegistryKey rkey, string keyname, bool throw_if_missing) { KeyHandler keyHandler = KeyHandler.Lookup(rkey, true); if (keyHandler != null) { string text = Path.Combine(keyHandler.Dir, UnixRegistryApi.ToUnix(keyname)); if (Directory.Exists(text)) { Directory.Delete(text, true); KeyHandler.Drop(text); } else if (throw_if_missing) { throw new ArgumentException("the given value does not exist"); } return; } if (!throw_if_missing) { return; } throw new ArgumentException("the given value does not exist"); }
public string [] GetSubKeyNames(RegistryKey rkey) { KeyHandler self = KeyHandler.Lookup(rkey, true); return(self.GetSubKeyNames()); }