AssemblyFix.cs 696 B

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