Пример #1
0
 public static void Set(RegistryValue key, string val)
 {
     using (RegistryKey rk = Registry.CurrentUser.CreateSubKey(c_RegistryRoot))
     {
         rk.SetValue(key.ToString(), val);
     }
 }
Пример #2
0
        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));
            }
        }
Пример #3
0
        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;
            }
        }