From 4c5b5f361eda966c3d29e6b9d840fb49f5235aa4 Mon Sep 17 00:00:00 2001 From: Michael Biggins Date: Mon, 28 Sep 2020 20:05:15 +0100 Subject: [PATCH] Implement scheme handler, passing imposter://hostname as an argument to the Client will make it silently apply the change and launch the game. --- src/Impostor.Client/Program.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Impostor.Client/Program.cs b/src/Impostor.Client/Program.cs index 647044b..2cacc4a 100644 --- a/src/Impostor.Client/Program.cs +++ b/src/Impostor.Client/Program.cs @@ -1,5 +1,9 @@ using System; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; using System.Windows.Forms; +using Impostor.Client.Core; using Impostor.Client.Forms; namespace Impostor.Client @@ -9,9 +13,24 @@ namespace Impostor.Client [STAThread] private static void Main() { + var firstArg = Environment.GetCommandLineArgs().FirstOrDefault(); + + if (firstArg != null && Uri.TryCreate(firstArg, UriKind.Absolute, out var uri) && uri.Scheme.ToLower() == "imposter") + { + HandleUri(uri).GetAwaiter().GetResult(); + return; + } + Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FrmMain()); } + + private static async Task HandleUri(Uri uri) + { + var modifier = new AmongUsModifier(); + await modifier.SaveIp(uri.Host); + Process.Start("steam://launch/945360"); + } } } \ No newline at end of file -- 2.39.5