From a330846d526133e149a23f35555a39319cd782f7 Mon Sep 17 00:00:00 2001 From: Mira <56395159+TheXorog@users.noreply.github.com> Date: Fri, 14 Apr 2023 06:40:52 +0200 Subject: [PATCH] Update Program.cs --- BeatRecorder/Program.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/BeatRecorder/Program.cs b/BeatRecorder/Program.cs index f83d33f..e662e03 100644 --- a/BeatRecorder/Program.cs +++ b/BeatRecorder/Program.cs @@ -3,6 +3,7 @@ using BeatRecorder.Util.BeatSaber; using BeatRecorder.Util.OBS; using BeatRecorder.Util.OpenVR; +using System.Reflection; namespace BeatRecorder; @@ -42,9 +43,10 @@ private async Task MainAsync(string[] args) { await Task.Delay(1000); - if (Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length > 1) + if (Process.GetProcessesByName(Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location)).Length > 1) { _logger.LogError("Only one instance of this application is allowed"); + await Task.Delay(1000); Environment.Exit(0); return; }