Example #1
0
        public string this[string name]
        {
            get
            {
                object val;

                if (this.regUtil == null)
                    return null;

                val = this.regUtil[name];

                if (val == null)
                    return null;

                return val.ToString();
            }
            set
            {
                if (this.regUtil == null)
                {
                    //Reg key does not exists. Create new one.
                    this.regUtil = RegUtil.Create(RegRoot.LocalMachine, "Software\\fastMagnet",true);

                    if (this.regUtil == null)
                        throw new Exception("Ayar registry kaydı oluşturulamadı");

                }

                this.regUtil[name] = value;
            }
        }
Example #2
0
 public void Dispose()
 {
     if (this.regUtil != null)
     {
         this.regUtil.Close();
         this.regUtil = null;
     }
 }
Example #3
0
        public static RegUtil Create(RegRoot root, string subKey, bool stayOpen)
        {
            RegistryKey regKey;
            RegUtil regUtil;

            try
            {
                regKey = GetKey(root).CreateSubKey(subKey, RegistryKeyPermissionCheck.ReadWriteSubTree);
            }
            catch
            {
                return null;
            }

            if (regKey != null)
            {
                regUtil = new RegUtil();
                regUtil.key = regKey;

                if (!stayOpen)
                    regUtil.Close();

                return regUtil;
            }

            return null;
        }
Example #4
0
        public static RegUtil Open(RegRoot root, string subKey, bool writable=true, bool createIfNotExists=false)
        {
            RegUtil util;

            if (!Exists(root, subKey))
            {
                if (!createIfNotExists)
                    return null;

                return Create(root, subKey,true);
            }

            util = new RegUtil();
            util.key = GetKey(root).OpenSubKey(subKey, writable);

            return util;
        }
Example #5
0
 public Settings()
 {
     this.regUtil = RegUtil.Open(RegRoot.LocalMachine, "Software\\fastMagnet");
 }