File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using System ;
2+ using System . Diagnostics ;
23using System . IO ;
34using System . Linq ;
45using System . Reflection ;
6+ using System . Threading ;
57using BepInEx . Preloader . Core ;
68
79namespace BepInEx . IL2CPP
@@ -64,9 +66,13 @@ public static void Main(string[] args)
6466 {
6567 // We set it to the current directory first as a fallback, but try to use the same location as the .exe file.
6668 var silentExceptionLog = $ "preloader_{ DateTime . Now : yyyyMMdd_HHmmss_fff} .log";
67-
69+ Mutex mutex = null ;
70+
6871 try
6972 {
73+ mutex = new Mutex ( false , Process . GetCurrentProcess ( ) . ProcessName + typeof ( DoorstopEntrypoint ) . FullName ) ;
74+ mutex . WaitOne ( ) ;
75+
7076 EnvVars . LoadVars ( ) ;
7177
7278 silentExceptionLog =
@@ -83,6 +89,10 @@ public static void Main(string[] args)
8389 {
8490 File . WriteAllText ( silentExceptionLog , ex . ToString ( ) ) ;
8591 }
92+ finally
93+ {
94+ mutex ? . ReleaseMutex ( ) ;
95+ }
8696 }
8797
8898 public static Assembly ResolveCurrentDirectory ( object sender , ResolveEventArgs args )
You can’t perform that action at this time.
0 commit comments