You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
959 B

  1. using HarmonyLib;
  2. using System;
  3. namespace IPA.Injector
  4. {
  5. internal static class AntiYeetPatch
  6. {
  7. private static Harmony instance;
  8. public static void Apply()
  9. {
  10. #if BeatSaber
  11. Logging.Logger.Injector.Info("Applying anti-yeet patch");
  12. try
  13. {
  14. instance = new Harmony("BSIPA Anti-Yeet");
  15. var original = AccessTools.Method("IPAPluginsDirDeleter:Awake");
  16. var prefix = new HarmonyMethod(AccessTools.Method(typeof(AntiYeetPatch), nameof(SuppressIPAPluginsDirDeleter)));
  17. instance.Patch(original, prefix);
  18. }
  19. catch (Exception e)
  20. {
  21. Logging.Logger.Injector.Warn("Could not apply anti-yeet patch");
  22. Logging.Logger.Injector.Warn(e);
  23. }
  24. #endif
  25. }
  26. private static bool SuppressIPAPluginsDirDeleter() => false;
  27. }
  28. }