From c084bdcaee2bea450ee8dccea9fe338ccc2b03a4 Mon Sep 17 00:00:00 2001 From: "AzureAD\\JiaxunWei" Date: Sun, 17 Mar 2024 16:38:45 +0100 Subject: [PATCH] enable arguments passing for ini --- ClientCore/ProcessLauncher.cs | 5 +++-- ClientGUI/XNALinkButton.cs | 13 ++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ClientCore/ProcessLauncher.cs b/ClientCore/ProcessLauncher.cs index 442040b83..bcca4194f 100644 --- a/ClientCore/ProcessLauncher.cs +++ b/ClientCore/ProcessLauncher.cs @@ -4,13 +4,14 @@ namespace ClientCore { public static class ProcessLauncher { - public static void StartShellProcess(string commandLine) + public static void StartShellProcess(string commandLine, string arguments = null) { using var _ = Process.Start(new ProcessStartInfo { FileName = commandLine, + Arguments = arguments, UseShellExecute = true }); } } -} \ No newline at end of file +} diff --git a/ClientGUI/XNALinkButton.cs b/ClientGUI/XNALinkButton.cs index cb918cc28..5ea792603 100644 --- a/ClientGUI/XNALinkButton.cs +++ b/ClientGUI/XNALinkButton.cs @@ -11,6 +11,7 @@ public XNALinkButton(WindowManager windowManager) : base(windowManager) { } public string URL { get; set; } public string UnixURL { get; set; } + public string Arguments { get; set; } protected override void ParseControlINIAttribute(IniFile iniFile, string key, string value) { @@ -26,6 +27,12 @@ protected override void ParseControlINIAttribute(IniFile iniFile, string key, st return; } + if (key == "Arguments") + { + Arguments = value; + return; + } + base.ParseControlINIAttribute(iniFile, key, value); } @@ -34,11 +41,11 @@ public override void OnLeftClick() OSVersion osVersion = ClientConfiguration.Instance.GetOperatingSystemVersion(); if (osVersion == OSVersion.UNIX && !string.IsNullOrEmpty(UnixURL)) - ProcessLauncher.StartShellProcess(UnixURL); + ProcessLauncher.StartShellProcess(UnixURL, Arguments); else if (!string.IsNullOrEmpty(URL)) - ProcessLauncher.StartShellProcess(URL); + ProcessLauncher.StartShellProcess(URL, Arguments); base.OnLeftClick(); } } -} \ No newline at end of file +}