public void LoadReg() { AllGFX?.Clear(); int i = 0; var sk = RegistryAccess.OpenSubKey(sMainReg); var cfs = sk.GetSubKeyNames(); foreach (var cf in cfs) { try { int.Parse(cf); var cr = sk.OpenSubKey(cf, false); var a = cr.GetValue("KMD_EnableInternalLargePage", null) as int?; var b = cr.GetValue("EnableCrossFireAutoLink", null) as int?; var c = cr.GetValue("EnableUlps", null) as int?; var d = cr.GetValue("DriverDesc", null) as string; AllGFX.Add(new GFX(i, a, b, c, d)); i++; } catch (SecurityException) { MessageBox.Show("This tool needs admin rights!"); break; } catch (Exception) { continue; } } }
public void SaveReg() { int i = 0; var sk = RegistryAccess.OpenSubKey(sMainReg); var cfs = sk.GetSubKeyNames(); foreach (var cf in cfs) { try { int.Parse(cf); var cr = sk.OpenSubKey(cf, true); if (AllGFX[i].KMD_EnableInternalLargePage.HasValue) { cr.SetValue("KMD_EnableInternalLargePage", AllGFX[i].KMD_EnableInternalLargePage.ToString(), RegistryValueKind.DWord); } if (AllGFX[i].EnableCrossFireAutoLink.HasValue) { cr.SetValue("EnableCrossFireAutoLink", AllGFX[i].EnableCrossFireAutoLink.ToString(), RegistryValueKind.DWord); } if (AllGFX[i].EnableUlps.HasValue) { cr.SetValue("EnableUlps", AllGFX[i].EnableUlps.ToString(), RegistryValueKind.DWord); } i++; } catch (SecurityException) { MessageBox.Show("This tool needs admin rights!"); break; } catch (Exception) { continue; } } }
// Clean up debris left over from 4 protected static void CleanUp4() { RegistryAccess RA = new RegistryAccess(); RegistryKey RK = RA.OpenSubKey(Registry.LocalMachine, @"SOFTWARE\ASCOM", true, RegistryAccess.RegWow64Options.KEY_WOW64_32KEY); try { RK.DeleteSubKeyTree(@"Telescope Drivers\SS2K.Telescope"); LogMessage("CleanUp4", @"Deleted Registry: Telescope Drivers\SS2K.Telescope"); } catch { } try { RK.DeleteSubKeyTree(@"Focuser Drivers\PCFocus.Focuser"); LogMessage("CleanUp4", @"Deleted Registry: Focuser Drivers\PCFocus.Focuser"); } catch { } RK.Close(); RA.Dispose(); }