AssemblyFix.cs 558 B

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