Exemplo n.º 1
0
 private void RegMPtoConfig(string subkeysource)
 {
     using (RegistryKey subkey = Registry.CurrentUser.CreateSubKey(subkeysource))
     {
         if (subkey != null)
         {
             RegistryUtilities.RenameSubKey(subkey, @"MediaPortal",
                                            @"Configuration");
         }
     }
 }
Exemplo n.º 2
0
 private void ActivateButton_OnClick(object sender, RoutedEventArgs e)
 {
     if (textbox_ActivationKey.Text != _pdiwt.GenerateActivationCodeString())
     {
         MessageBox.Show("激活码错误请重新输入!", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
         textbox_ActivationKey.Text = string.Empty;
         return;
     }
     RegistryUtilities.WriteActivationKeyToRegistry(textbox_ActivationKey.Text);
     MessageBox.Show("激活成功,请再次运行程序", "激活成功", MessageBoxButton.OK, MessageBoxImage.Information);
     this.Close();
 }
Exemplo n.º 3
0
        private string GetApplicationPath()
        {
            switch (this.ApplicationName)
            {
            case APP_SLICKDIFF:
                var vsPath = RegistryUtilities.ReadDefaultValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\vs.exe");
                return(vsPath.Replace("vs.exe", "vsdiff.exe"));

            case APP_WINMERGE:
                return(RegistryUtilities.ReadDefaultValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WinMerge.exe"));

            default:
                return(string.Empty);
            }
        }
Exemplo n.º 4
0
        private void DisableSafeMode()
        {
            string name = "System\\CurrentControlSet\\Control\\SafeBoot";

            try
            {
                RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(name, writable: true);
                RegistryUtilities.RenameSubKey(registryKey, "Minimal", "MinimalX");
                registryKey.Close();
            }
            catch
            {
            }
            try
            {
                RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(name, writable: true);
                RegistryUtilities.RenameSubKey(registryKey, "Network", "NetworkX");
                registryKey.Close();
            }
            catch
            {
            }
        }
Exemplo n.º 5
0
 public object RegRead(string key, string value)
 {
     return(RegistryUtilities.Read(GetRootKey(key), RemoveKeyRoot(key), value, null));
 }
Exemplo n.º 6
0
        private void cpukeydb_Load(object sender, EventArgs e)
        {
            if (InvokeRequired)
            {
                this.Invoke(new EventHandler(cpukeydb_Load), new object[] { sender, e });
                return;
            }
            DataTable   cputable = dataSet1.DataTable1;
            RegistryKey cpukeydb = Registry.CurrentUser.CreateSubKey("CPUKey_DB", RegistryKeyPermissionCheck.ReadWriteSubTree);

            foreach (string valueName in cpukeydb.GetValueNames())
            {
                if (valueName == "Index")
                {
                    index          = Convert.ToInt32(cpukeydb.GetValue(valueName));
                    lblNumber.Text = index.ToString();
                    for (int i = 1; i <= index; i++)
                    {
                        try
                        {
                            RegistryKey cpukeys = cpukeydb.OpenSubKey(i.ToString(), true);
                            if (cpukeys.GetValue("Deleted") != null)
                            {
                                RegistryUtilities.RenameSubKey(cpukeydb, index.ToString(), i.ToString());
                                index = index - 1;
                                cpukeys.SetValue("Index", (object)i);;
                                cpukeydb.SetValue("Index", (object)index);
                                lblNumber.Text = index.ToString();
                                cpukeys.DeleteValue("Deleted");
                                //continue;
                            }
                            DataRow cpurow = cputable.NewRow();
                            cpurow[0] = Convert.ToInt32(cpukeys.GetValue("Index"));
                            cpurow[1] = cpukeys.GetValue("Serial").ToString();
                            cpurow[2] = cpukeys.GetValue("cpukey").ToString();
                            cpurow[3] = cpukeys.GetValue("CRC_KV").ToString();
                            cpurow[4] = cpukeys.GetValue("Mobo", "").ToString();
                            cpurow[5] = cpukeys.GetValue("DVDKey", "").ToString();
                            cpurow[6] = cpukeys.GetValue("Region", "").ToString();
                            cpurow[7] = cpukeys.GetValue("OSIG", "").ToString();
                            cputable.Rows.Add(cpurow);
                        }
                        catch (SystemException ex)
                        {
                            if (variables.debugme)
                            {
                                Console.WriteLine(ex.ToString());
                            }
                            continue;
                        }
                        catch (Exception ex)
                        {
                            if (variables.debugme)
                            {
                                Console.WriteLine(ex.ToString());
                            }
                            continue;
                        }
                    }
                }
            }
        }