public static void Set(RegistryValue key, string val) { using (RegistryKey rk = Registry.CurrentUser.CreateSubKey(c_RegistryRoot)) { rk.SetValue(key.ToString(), val); } }
public static string GetString(RegistryValue key, string defaultVal) { using (RegistryKey rk = Registry.CurrentUser.OpenSubKey(c_RegistryRoot, false)) { if (rk == null) return defaultVal; return (string)(rk.GetValue(key.ToString(), defaultVal)); } }
public static bool GetBoolean(RegistryValue key, bool defaultVal) { using (RegistryKey rk = Registry.CurrentUser.OpenSubKey(c_RegistryRoot, false)) { if (rk == null) return defaultVal; bool ret; if (bool.TryParse((string)(rk.GetValue(key.ToString(), defaultVal)), out ret)) return ret; else return defaultVal; } }