mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-24 17:23:50 +02:00
feat: kill install process after exiting game (#864)
* feat: kill install process after exiting game * Restore en.json * fix some key incorrect * gui: update for VRChat OSC Fix * fix: may incorrectly kill unrelated processes * fix: pattern incorrect
This commit is contained in:
@@ -15,7 +15,7 @@ namespace VRCX
|
||||
|
||||
CheckGameRunning();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the VRChat game and SteamVR are currently running and updates the browser's JavaScript function $app.updateIsGameRunning with the results.
|
||||
/// </summary>
|
||||
@@ -40,7 +40,7 @@ namespace VRCX
|
||||
if (MainForm.Instance?.Browser != null && !MainForm.Instance.Browser.IsLoading && MainForm.Instance.Browser.CanExecuteJavascriptInMainFrame)
|
||||
MainForm.Instance.Browser.ExecuteScriptAsync("$app.updateIsGameRunning", isGameRunning, isSteamVRRunning, isHmdAfk);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Kills the VRChat process if it is currently running.
|
||||
/// </summary>
|
||||
@@ -54,6 +54,29 @@ namespace VRCX
|
||||
return processes.Length;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Kills the install.exe process after exiting game.
|
||||
/// </summary>
|
||||
/// <returns>Whether the process is killed (true or false).</returns>
|
||||
public bool KillInstall()
|
||||
{
|
||||
bool isSuccess = false;
|
||||
var processes = Process.GetProcessesByName("install");
|
||||
foreach (var p in processes)
|
||||
{
|
||||
// "E:\SteamLibrary\steamapps\common\VRChat\install.exe"
|
||||
var match = Regex.Match(p.MainModule.FileName, "(.+?\\\\VRChat.*)(!?\\\\install.exe)");
|
||||
if (match.Success)
|
||||
{
|
||||
p.Kill();
|
||||
isSuccess = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return isSuccess;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the VRChat game process with the specified command-line arguments.
|
||||
/// </summary>
|
||||
@@ -71,13 +94,13 @@ namespace VRCX
|
||||
var path = match.Groups[1].Value;
|
||||
// var _arguments = Uri.EscapeDataString(arguments);
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
WorkingDirectory = path,
|
||||
FileName = $"{path}\\steam.exe",
|
||||
UseShellExecute = false,
|
||||
Arguments = $"-applaunch 438100 {arguments}"
|
||||
})
|
||||
?.Close();
|
||||
{
|
||||
WorkingDirectory = path,
|
||||
FileName = $"{path}\\steam.exe",
|
||||
UseShellExecute = false,
|
||||
Arguments = $"-applaunch 438100 {arguments}"
|
||||
})
|
||||
?.Close();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user