This commit is contained in:
Natsumi
2024-10-28 14:48:29 +13:00
parent 9496d2fe38
commit c4d958b8ba
2 changed files with 17 additions and 5 deletions

View File

@@ -12,6 +12,7 @@ using System.IO.Pipes;
using System.Linq;
using System.Management;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace VRCX
@@ -50,6 +51,7 @@ namespace VRCX
if (!disableClosing && IsDuplicateProcessRunning(LaunchArguments))
{
IPCToMain();
Thread.Sleep(10);
Environment.Exit(0);
}
}
@@ -97,13 +99,13 @@ namespace VRCX
private static bool IsDuplicateProcessRunning(VrcxLaunchArguments launchArguments)
{
var processes = Process.GetProcessesByName("VRCX")
.Where(x => x.Id != Environment.ProcessId);
var processes = Process.GetProcessesByName("VRCX");
foreach (var process in processes)
{
if (process.Id == Environment.ProcessId)
continue;
var commandLine = string.Empty;
try
{
using var searcher = new ManagementObjectSearcher("SELECT CommandLine FROM Win32_Process WHERE ProcessId = " + process.Id);