Skip to content

Commit

Permalink
Fix compatibility with FPSBooster.
Browse files Browse the repository at this point in the history
  • Loading branch information
kianzarrin committed Jun 23, 2022
1 parent fb63630 commit 7f9dd2c
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions LoadOrderInjections/Injections/ReplaceAssembies.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using ColossalFramework.Plugins;
using KianCommons;
using Mono.Cecil;
using System;
Expand Down Expand Up @@ -65,23 +66,14 @@ public static class ReplaceAssembies {

public static Assembly LoadDLL(string dllPath) {
try {
Assembly assembly;
string symPath = dllPath + ".mdb";
if (File.Exists(symPath)) {
Log.Info("\nLoading " + dllPath + "\nSymbols " + symPath);
assembly = Assembly.Load(File.ReadAllBytes(dllPath), File.ReadAllBytes(symPath));
} else {
Log.Info("Loading " + dllPath);
assembly = Assembly.Load(File.ReadAllBytes(dllPath));
}
if (assembly != null) {
Log.Info("Assembly " + assembly.FullName + " loaded.\n");
} else {
Log.Info("Assembly at " + dllPath + " failed to load.\n");
}
return assembly;
// use LoadPlugin to ensure FPSBooster will get a chance to patch assembly.
return ReflectionHelpers.InvokeMethod(
PluginManager.instance,
"LoadPlugin",
dllPath
) as Assembly;
} catch (Exception ex) {
Log.Error("Assembly at " + dllPath + " failed to load.\n" + ex.ToString());
ex.Log(false);
return null;
}
}
Expand Down

0 comments on commit 7f9dd2c

Please sign in to comment.