Esempio n. 1
0
        private bool isGlob(optType opt)
        {
            switch (opt)
            {
            case optType.DefaultUser: return(true);

            default: return(false);
            }
        }
Esempio n. 2
0
 public int GetIntOption(optType opt)
 {
     try
     {
         return((int)_userReg.GetValue(opt.ToString(), 0));
     }
     catch
     {
         return(0);
     }
 }
Esempio n. 3
0
 private void setOptions(optType opt, object val, RegistryValueKind rvk)
 {
     if (isGlob(opt))
     {
         _globReg.SetValue(opt.ToString(), val, rvk);
     }
     else if (_curUser != null)
     {
         _userReg.SetValue(opt.ToString(), val, rvk);//todo проверить установку опций
     }
 }
Esempio n. 4
0
        public string GetStringOption(optType opt)
        {
            if (isGlob(opt))
            {
                return((string)_globReg.GetValue(opt.ToString(), getDefOptVal(opt)));
            }
            else if (_curUser != null)
            {
                return((string)_userReg.GetValue(opt.ToString(), getDefOptVal(opt)));
            }

            throw new Exception("Пользователь не установлен");
        }
Esempio n. 5
0
        private string getDefOptVal(optType opt)
        {
            switch (opt)
            {
            case optType.WindowState:
                return("2");

            case optType.WindowPosition:
            case optType.WindowSize:
                return("0;0");

            default: return("");
            }
        }
Esempio n. 6
0
        public bool GetBoolOption(optType opt)
        {
            string val = GetStringOption(opt);

            return(val != "0" || val.ToLower() == "true");
        }
Esempio n. 7
0
        public string GetFormOpt(optType type, string form)
        {
            RegistryKey rk = _userReg.CreateSubKey("Windows");

            return((string)rk.GetValue(form + "_" + type.ToString(), getDefOptVal(type)));
        }
Esempio n. 8
0
        public void SetFormOpt(optType type, string form, string param)
        {
            RegistryKey rk = _userReg.CreateSubKey("Windows");

            rk.SetValue(form + "_" + type.ToString(), param);
        }
Esempio n. 9
0
 public void SetOption(optType opt, bool value)
 {
     setOptions(opt, value?"1":"0", RegistryValueKind.String);
 }
Esempio n. 10
0
 public void SetOption(optType opt, int value)
 {
     setOptions(opt, value, RegistryValueKind.DWord);
 }
Esempio n. 11
0
 public void SetOption(optType opt, string value)
 {
     setOptions(opt, value, RegistryValueKind.String);
 }