private void FrostWatcher() { string FrostLogFile = Application.StartupPath + "/Frost/launcherUpdater.log"; if (File.Exists(FrostLogFile)) { File.Delete(FrostLogFile); } while (WeRunningYup) { try { bool LaunchRequest = false; if (File.Exists(FrostLogFile)) { var forstProcessess = Process.GetProcesses().Where(pr => pr.ProcessName.Contains("frost")); foreach (var process in forstProcessess) { process.WaitForExit(); } string FrostLog = File.ReadAllText(FrostLogFile); File.Delete(FrostLogFile + "-DarkBackup.log"); File.Move(FrostLogFile, FrostLogFile + "-DarkBackup.log"); if (FrostLog != "") { string launchOptions = FrostLog.Split(new[] { '\r', '\n' }).FirstOrDefault().Split(new[] { "halo_online.exe" }, StringSplitOptions.None)[1]; this.Invoke(new MethodInvoker(delegate { txt4gameArguments.Text = launchOptions; })); LaunchRequest = true; } } if (LaunchRequest) { this.Invoke(new MethodInvoker(delegate { splash = new Forms.Splash(); splash.Show(); })); inLauncherLoop = true; Thread launcherLoop = new Thread(KillFrostLauncherLoop); launcherLoop.Start(); GoogleAnalyticsApi.TrackEvent("MainForm.cs", "FrostWatcher", "Started Halo Online from 4game"); LaunchHaloOnline(); inLauncherLoop = false; } } catch (Exception e) { GoogleAnalyticsApi.TrackEvent("Errors", "FrostWatcher", e.Message); } } }
private void btnLaunchHaloOnline_Click(object sender, EventArgs e) { btnLaunchHaloOnline.Enabled = false; btnLaunchHaloOnline.Text = "Launching..."; GoogleAnalyticsApi.TrackEvent("MainForm.cs", "btnLaunchHaloOnline_Click", ""); splash = new Forms.Splash(); splash.Show(); Thread startHalo = new Thread(LaunchHaloOnline); startHalo.Start(); }