UnityPatches.cs 795 B

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