SwapNewMaidPropPatcher.cs 661 B

123456789101112131415161718192021222324
  1. #if COM25
  2. using System;
  3. using System.Diagnostics.CodeAnalysis;
  4. using HarmonyLib;
  5. namespace MeidoPhotoStudio.Plugin;
  6. public static class SwapNewMaidPropPatcher
  7. {
  8. public static event EventHandler<ProcStartEventArgs> NewMaidPropSwapping;
  9. [HarmonyPatch(typeof(Maid), nameof(Maid.SwapNewMaidProp))]
  10. [HarmonyPrefix]
  11. [SuppressMessage("StyleCop.Analyzers.NamingRules", "SA1313", Justification = "Harmony parameter")]
  12. private static void NotifyNewMaidPropSwapping(Maid __instance, bool toNewBody)
  13. {
  14. if (__instance.IsCrcBody == toNewBody)
  15. return;
  16. NewMaidPropSwapping?.Invoke(null, new(__instance));
  17. }
  18. }
  19. #endif