From 9bd78bf80cb7c7e621fdf97bd98a0b7f3a5984fd Mon Sep 17 00:00:00 2001 From: DraakjeYoblama <40168786+DraakjeYoblama@users.noreply.github.com> Date: Wed, 29 Nov 2023 10:35:55 +0100 Subject: [PATCH] Added -nolauncher launch option --- Program.cs | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/Program.cs b/Program.cs index 4bffe9e..3102858 100644 --- a/Program.cs +++ b/Program.cs @@ -3,6 +3,7 @@ using NLog.Targets; using System.Diagnostics; using System.Globalization; +using System.Media; using System.Runtime.InteropServices; namespace CityLauncher @@ -34,12 +35,18 @@ internal static class Program /// @author Neato (https://steamcommunity.com/id/frofoo) /// [STAThread] - static void Main() + static void Main(string[] args) { bool IsNewWindow = true; using (Mutex mtx = new(true, "{BD4C408D-EF15-4C98-B792-C30D089E19D1}", out IsNewWindow)) { - if (IsNewWindow) + if (args.Contains("-nolauncher")) + { + SetupCulture(); + SetupLogger(); + LauncherBypass(); + } + else if (IsNewWindow) { SetupCulture(); SetupLogger(); @@ -108,5 +115,25 @@ private static void SetupLogger() config.AddRule(LogLevel.Debug, LogLevel.Warn, logfile); LogManager.Configuration = config; } - } + + private static void LauncherBypass() + { + Nlog.Info("LauncherBypass - Starting logs at {0} on {1}.", DateTime.Now.ToString("HH:mm:ss"), DateTime.Now.ToString("D", new CultureInfo("en-GB"))); + using (Process LaunchGame = new()) + { + if (FileHandler.DetectGameExe()) + { + LaunchGame.StartInfo.FileName = "BatmanAC.exe"; + LaunchGame.StartInfo.CreateNoWindow = true; + LaunchGame.Start(); + Nlog.Info("LauncherBypass - Launching the game. Concluding logs at {0} on {1}.", DateTime.Now.ToString("HH:mm:ss"), DateTime.Now.ToString("D", new CultureInfo("en-GB"))); + Application.Exit(); + } + else + { + MessageBox.Show("Could not find 'BatmanAC.exe'.\nIs the Launcher in the correct folder?", "Error!", MessageBoxButtons.OK); + } + } + } +} } \ No newline at end of file