From: Michael Biggins Date: Mon, 28 Sep 2020 19:05:15 +0000 (+0100) Subject: Implement scheme handler, passing imposter://hostname as an argument to the Client... X-Git-Tag: v1.1.0~1^2~22^2~4 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=4c5b5f361eda966c3d29e6b9d840fb49f5235aa4;p=rhonda%2Fimpostor.git Implement scheme handler, passing imposter://hostname as an argument to the Client will make it silently apply the change and launch the game. --- 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