Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable arguments passing for XNALinkButton URL #535

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ClientCore/ProcessLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
}
}
}
}
13 changes: 10 additions & 3 deletions ClientGUI/XNALinkButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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);
}

Expand All @@ -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();
}
}
}
}