private void Main_Load(object sender, EventArgs e) { if (LoaderConfig == null) { Settings s = new Settings(); s.ShowDialog(this); } else { LoadConfigInForm(); } AllStarted = true; RefreshServerList(true, true); LoaderEvents.LauncherLoadedStartEvent(); bool InstaledCPlusRedistributableX86 = false; bool InstaledCPlusRedistributableX64 = false; try { RegistryKey keyX64 = Registry.LocalMachine.OpenSubKey("Software").OpenSubKey("Microsoft").OpenSubKey("VisualStudio").OpenSubKey("14.0").OpenSubKey("VC").OpenSubKey("Runtimes").OpenSubKey("x64"); if (keyX64 != null) { Object o = keyX64.GetValue("Installed"); if (o.ToString() == "1") { InstaledCPlusRedistributableX64 = true; Core.LogWritter.Write("Detected C++ Redistributable X64."); } } RegistryKey keyX32 = Registry.LocalMachine.OpenSubKey("Software").OpenSubKey("Microsoft").OpenSubKey("VisualStudio").OpenSubKey("14.0").OpenSubKey("VC").OpenSubKey("Runtimes").OpenSubKey("x86"); if (keyX32 != null) { Object o = keyX32.GetValue("Installed"); if (o.ToString() == "1") { InstaledCPlusRedistributableX86 = true; Core.LogWritter.Write("Detected C++ Redistributable X86."); } } } catch (Exception) { } // Install the C++ redistributable 2015-2019 if need if (!InstaledCPlusRedistributableX64 && Environment.Is64BitOperatingSystem) { File.WriteAllBytes("cpp2015-2019x64.exe", Properties.Resources.VC_redist_x64); Process.Start("cpp2015-2019x64.exe").WaitForExit(); File.Delete("cpp2015-2019x64.exe"); } if (!InstaledCPlusRedistributableX86) { File.WriteAllBytes("cpp2015-2019x86.exe", Properties.Resources.VC_redist_x86); Process.Start("cpp2015-2019x86.exe").WaitForExit(); File.Delete("cpp2015-2019x86.exe"); } }
private void Main_Load(object sender, EventArgs e) { if (LoaderConfig == null) { Settings s = new Settings(); s.ShowDialog(this); } else { LoadConfigInForm(); } AllStarted = true; RefreshServerList(); LoaderEvents.LauncherLoadedStartEvent(); }