AssemblyFix.cs 579 B

123456789101112131415161718192021222324
  1. using System.Reflection;
  2. using BepInEx.Harmony;
  3. using HarmonyLib;
  4. namespace BepInEx.NetLauncher.RuntimeFixes
  5. {
  6. internal class AssemblyFix
  7. {
  8. private static Assembly EntryAssembly { get; set; }
  9. public static void Execute(Assembly entryAssembly)
  10. {
  11. EntryAssembly = entryAssembly;
  12. HarmonyWrapper.PatchAll(typeof(AssemblyFix), "bepinex.assemblyfix");
  13. }
  14. [HarmonyPrefix, HarmonyPatch(typeof(Assembly), nameof(Assembly.GetEntryAssembly))]
  15. public static bool GetEntryAssemblyPrefix(ref Assembly __result)
  16. {
  17. __result = EntryAssembly;
  18. return false;
  19. }
  20. }
  21. }