public MainWindow(GameConfig config, bool forceNoMovies) { this.config = config; Title = "Librelancer Launcher"; Resizable = false; var mainBox = new VBox() { Spacing = 6 }; //Directory var dirbox = new HBox() { Spacing = 2 }; mainBox.PackStart(new Label() { Text = "Freelancer Directory: " }); dirbox.PackStart((textInput = new TextEntry()), true, true); textInput.Text = config.FreelancerPath; var btnChooseFolder = new Button() { Label = " ... " }; btnChooseFolder.Clicked += BtnChooseFolder_Clicked; dirbox.PackStart(btnChooseFolder); mainBox.PackStart(dirbox); //Options skipMovies = new CheckBox() { Label = "Skip Intro Movies" }; if (forceNoMovies) { skipMovies.Active = true; skipMovies.Sensitive = false; } else { skipMovies.Active = !config.IntroMovies; } var smbox = new HBox(); smbox.PackStart(skipMovies); mainBox.PackStart(smbox); muteMusic = new CheckBox() { Label = "Mute Music" }; muteMusic.Active = config.MuteMusic; mainBox.PackStart(muteMusic); vsync = new CheckBox() { Label = "VSync" }; vsync.Active = config.VSync; mainBox.PackStart(vsync); //Resolution resWidthBox = new TextEntry(); resWidthBox.Text = config.BufferWidth.ToString(); resWidthBox.TextInput += Masking; resHeightBox = new TextEntry(); resHeightBox.Text = config.BufferHeight.ToString(); resHeightBox.TextInput += Masking; var hboxResolution = new HBox(); hboxResolution.PackEnd(resHeightBox); hboxResolution.PackEnd(new Label() { Text = "x" }); hboxResolution.PackEnd(resWidthBox); hboxResolution.PackStart(new Label() { Text = "Resolution:" }); mainBox.PackStart(hboxResolution); //Launch var launchbox = new HBox() { Spacing = 2 }; var btnLaunch = new Button("Launch"); btnLaunch.Clicked += BtnLaunch_Clicked; launchbox.PackEnd(btnLaunch); mainBox.PackEnd(launchbox); //Finish CloseRequested += MainWindow_CloseRequested; Content = mainBox; }
public static uint Launch(string game, string patchFile) { try { uint num = 0; int num2 = (int)Registry.GetValue(@"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA", 0); if (patchFile.ToLower().Contains(".msi")) { MsiInstallProduct(patchFile, ""); } else if (patchFile.ToLower().Contains(".msp")) { MsiApplyPatch(patchFile, "", 0, ""); } else if (patchFile.ToLower().Contains(".rtp")) { GameConfig gameConfig = GameLauncher._ConfigManager.GetGameConfig(game); uint num3 = RTPatchApply32WithCall(0, patchFile, null, "Outspark", "-nop", 0x201L, 0L, 0L); num = num3; string strMore = "&patchFile=" + patchFile; if (num3 == 0) { gameConfig.iNumPatchErrors = 0; ReportMetrics.report("patchSuccess", game, gameConfig.iVersion.ToString(), GameLauncher._ConfigManager.PrimeConfiguration.strSystemGUID, strMore); } else { gameConfig.iNumPatchErrors++; strMore = strMore + "&patchError=" + num3.ToString(); ReportMetrics.report("patchFailed", game, gameConfig.iVersion.ToString(), GameLauncher._ConfigManager.PrimeConfiguration.strSystemGUID, strMore); if (gameConfig.iNumPatchErrors >= 3) { } } } else { string str2 = " /i \"" + patchFile + "\""; if (num2 == 0) { str2 = str2 + " /passive"; } ProcessStartInfo info = new ProcessStartInfo(patchFile) { UseShellExecute = true }; Process process = new Process { StartInfo = info }; try { process.Start(); process.WaitForExit(0xdbba0); num = 1; } catch (Exception exception) { Console.WriteLine(exception.Message); } } return(num); } catch (Exception) { return(0); } }