mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 22:46:06 +02:00
Rework Startup Args (#946)
* Rework startup args * Preserve previous startup args on re-launch * Ignore subprocess when checking for duplicate processes * Cleanup code * Remove extra process list grabbing * Use `IsUpgradePrefix` when using `RestartApplication` * Change `ProxyServerPrefix` to `ProxyUrlPrefix`
This commit is contained in:
+21
-4
@@ -278,16 +278,33 @@ namespace VRCX
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restarts the VRCX application for an update by launching a new process with the "/Upgrade" argument and exiting the current process.
|
||||
/// Restarts the VRCX application for an update by launching a new process with the upgrade argument and exiting the current process.
|
||||
/// </summary>
|
||||
public void RestartApplication()
|
||||
{
|
||||
List<string> args = [ StartupArgs.VrcxLaunchArguements.IsUpgradePrefix ];
|
||||
|
||||
if (StartupArgs.LaunchArguements.IsDebug == true)
|
||||
{
|
||||
args.Add(StartupArgs.VrcxLaunchArguements.IsDebugPrefix);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(StartupArgs.LaunchArguements.ConfigDirectory))
|
||||
{
|
||||
args.Add($"{StartupArgs.VrcxLaunchArguements.ConfigDirectoryPrefix}={StartupArgs.LaunchArguements.ConfigDirectory}");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(StartupArgs.LaunchArguements.ProxyUrl))
|
||||
{
|
||||
args.Add($"{StartupArgs.VrcxLaunchArguements.ProxyUrlPrefix}={StartupArgs.LaunchArguements.ProxyUrl}");
|
||||
}
|
||||
|
||||
var vrcxProcess = new Process
|
||||
{
|
||||
StartInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = Path.Combine(Program.BaseDirectory, "VRCX.exe"),
|
||||
Arguments = "/Upgrade",
|
||||
Arguments = string.Join(' ', args),
|
||||
UseShellExecute = true,
|
||||
WorkingDirectory = Program.BaseDirectory
|
||||
}
|
||||
@@ -362,8 +379,8 @@ namespace VRCX
|
||||
/// <returns>The launch command.</returns>
|
||||
public string GetLaunchCommand()
|
||||
{
|
||||
var command = StartupArgs.LaunchCommand;
|
||||
StartupArgs.LaunchCommand = string.Empty;
|
||||
var command = StartupArgs.LaunchArguements.LaunchCommand;
|
||||
StartupArgs.LaunchArguements.LaunchCommand = string.Empty;
|
||||
return command;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user