mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 14:53:50 +02:00
Fix VRCX auto updater
This commit is contained in:
@@ -202,11 +202,17 @@ namespace VRCX
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void RestartApplication()
|
public void RestartApplication()
|
||||||
{
|
{
|
||||||
var VRCXProcess = new Process();
|
var vrcxProcess = new Process
|
||||||
VRCXProcess.StartInfo.FileName = Path.Combine(Program.BaseDirectory, "VRCX.exe");
|
{
|
||||||
VRCXProcess.StartInfo.UseShellExecute = false;
|
StartInfo = new ProcessStartInfo
|
||||||
VRCXProcess.StartInfo.Arguments = "/Upgrade";
|
{
|
||||||
VRCXProcess.Start();
|
FileName = Path.Combine(Program.BaseDirectory, "VRCX.exe"),
|
||||||
|
Arguments = "/Upgrade",
|
||||||
|
UseShellExecute = true,
|
||||||
|
WorkingDirectory = Program.BaseDirectory
|
||||||
|
}
|
||||||
|
};
|
||||||
|
vrcxProcess.Start();
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,12 +22,15 @@ namespace VRCX
|
|||||||
{
|
{
|
||||||
var args = Environment.GetCommandLineArgs();
|
var args = Environment.GetCommandLineArgs();
|
||||||
processList = Process.GetProcessesByName("VRCX");
|
processList = Process.GetProcessesByName("VRCX");
|
||||||
|
|
||||||
|
Debug.Assert(Program.LaunchDebug = true);
|
||||||
|
|
||||||
var isDebug = false;
|
var disableClosing = false;
|
||||||
Debug.Assert(isDebug = true);
|
|
||||||
|
|
||||||
foreach (var arg in args)
|
foreach (var arg in args)
|
||||||
{
|
{
|
||||||
|
if (arg == "/Upgrade")
|
||||||
|
disableClosing = true;
|
||||||
|
|
||||||
if (arg.Length > 12 && arg.Substring(0, 12) == "/uri=vrcx://")
|
if (arg.Length > 12 && arg.Substring(0, 12) == "/uri=vrcx://")
|
||||||
LaunchCommand = arg.Substring(12);
|
LaunchCommand = arg.Substring(12);
|
||||||
|
|
||||||
@@ -42,15 +45,15 @@ namespace VRCX
|
|||||||
Program.AppDataDirectory = filePath;
|
Program.AppDataDirectory = filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((arg.Length >= 7 && arg.Substring(0, 7) == "--debug") || isDebug)
|
if (arg.Length >= 7 && arg.Substring(0, 7) == "--debug")
|
||||||
Program.LaunchDebug = true;
|
Program.LaunchDebug = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Program.AppDataDirectory))
|
if (!string.IsNullOrEmpty(Program.AppDataDirectory))
|
||||||
return; // we're launching with a custom config path, allow it
|
disableClosing = true; // we're launching with a custom config path, allow it
|
||||||
|
|
||||||
// if we're launching a second instance, focus the first instance then exit
|
// if we're launching a second instance, focus the first instance then exit
|
||||||
if (processList.Length > 1)
|
if (!disableClosing && processList.Length > 1)
|
||||||
{
|
{
|
||||||
IPCToMain();
|
IPCToMain();
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace VRCX
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
File.Move(Update_Executable, VRCX_Setup_Executable);
|
File.Move(Update_Executable, VRCX_Setup_Executable);
|
||||||
var VRCXProcess = new Process
|
var vrcxProcess = new Process
|
||||||
{
|
{
|
||||||
StartInfo = new ProcessStartInfo
|
StartInfo = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
@@ -47,7 +47,7 @@ namespace VRCX
|
|||||||
WorkingDirectory = Program.AppDataDirectory
|
WorkingDirectory = Program.AppDataDirectory
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
VRCXProcess.Start();
|
vrcxProcess.Start();
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
Reference in New Issue
Block a user