Beispiel #1
0
        public string GetLicenseKey()
        {
            try
            {
                RegistryKey reg = Registry.CurrentUser.OpenSubKey("SOFTWARE\\CompLife\\MonitorCLClient", false);

                if (reg != null)
                {
                    if (reg.GetValue("LicenseKey") != null)
                    {
                        return(reg.GetValue("LicenseKey").ToString());
                    }
                    else
                    {
                        return(null);
                    }
                }
                {
                    return(null);
                }
            }
            catch (Exception err)
            {
                Debug.WriteLine(err.Message);
                LogList.Add(err.Message);
                return(null);
            }
        }
Beispiel #2
0
        public void SetActiveKey(string key)
        {
            try
            {
                RegistryKey reg = Registry.LocalMachine.OpenSubKey
                                      ("SOFTWARE\\CompLife\\MonitorCLClient", true);

                reg.SetValue("LicenseKey", key);
            }
            catch (Exception err)
            {
                Debug.WriteLine(err.Message);
                LogList.Add(err.Message);
            }
        }
Beispiel #3
0
 public void SetAutoRun(string path, bool value)
 {
     try
     {
         RegistryKey reg = Registry.LocalMachine.OpenSubKey
                               ("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", value);
         if (value)
         {
             if (reg.GetValue(new FileInfo(path).Name).ToString() != path)
             {
                 reg.SetValue(new FileInfo(path).Name, path);
             }
         }
         else
         {
             reg.DeleteValue(new FileInfo(path).Name);
         }
     }
     catch (Exception err)
     {
         LogList.Add(err.Message);
     }
 }