UnityPatches.cs 866 B

1234567891011121314151617181920212223242526272829
  1. using System;
  2. using BepInEx.Harmony;
  3. using Harmony;
  4. namespace BepInEx.Bootstrap
  5. {
  6. internal static class UnityPatches
  7. {
  8. public static HarmonyInstance HarmonyInstance { get; } = HarmonyInstance.Create("com.bepinex.unitypatches");
  9. public static void Apply()
  10. {
  11. HarmonyWrapper.PatchAll(typeof(UnityPatches), HarmonyInstance);
  12. }
  13. #if UNITY_2018
  14. /*
  15. * DESC: Workaround for Trace class not working because of missing .config file
  16. * AFFECTS: Unity 2018+
  17. */
  18. [HarmonyPostfix, HarmonyPatch(typeof(AppDomain), nameof(AppDomain.SetupInformation), MethodType.Getter)]
  19. public static void GetExeConfigName(AppDomainSetup __result)
  20. {
  21. __result.ApplicationBase = $"file://{Paths.GameRootPath}";
  22. __result.ConfigurationFile = "app.config";
  23. }
  24. #endif
  25. }
  26. }