static public void OpenRegistryEditor(REG_KEYS address) { try { SetValue(REG_KEYS.LASTKEY, "LastKey", KeyAddress[address]); Process.Start("regedit"); } catch { } }
static public void SetValue(REG_KEYS key, string valueName, string value) { if (!Enum.IsDefined(typeof(REG_KEYS), key)) { throw new ArgumentException("Undefined enum value", nameof(key)); } Registry.SetValue( KeyAddress[key], valueName, value); }
static public void DeleteValue(REG_KEYS key, string valueName) { if (!Enum.IsDefined(typeof(REG_KEYS), key)) { throw new ArgumentException("Undefined enum value", nameof(key)); } var regkey = Registry.CurrentUser.OpenSubKey(KeyAddress[key].Replace(Registry.CurrentUser.Name + "\\", ""), true); if (regkey != null) { regkey.DeleteValue(valueName, false); regkey.Close(); } }