Пример #1
0
        public static void SaveSetting(string key, string value)
        {
            //RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\" + "E3" + Glob.GetAssemblyShortName());
            //key.SetValue("handimage", handImage);

            var regkey = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\" + "E3" + Glob.GetAssemblyShortName());

            regkey?.SetValue(key, value);
        }
Пример #2
0
        public static int GetSetting(string key, int value)
        {
            var regKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\" + "E3" + Glob.GetAssemblyShortName());

            if (regKey == null)
            {
                return(value);
            }

            var saved = regKey.GetValue(key, value).ToString();

            return(int.TryParse(saved, out var ret)? ret : 0);
        }
Пример #3
0
        public static bool GetSetting(string key, bool value)
        {
            var regKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\" + "E3" + Glob.GetAssemblyShortName());

            if (regKey == null)
            {
                return(value);
            }

            var saved = regKey.GetValue(key, value).ToString();

            return(bool.TryParse(saved, out bool x)? x : false);
        }
Пример #4
0
        public static void SaveSetting(string key, bool value)
        {
            var regkey = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\" + "E3" + Glob.GetAssemblyShortName());

            regkey?.SetValue(key, value);
        }