#if !HARMONY_2 using System; using System.Collections.Generic; namespace StardewModdingAPI.Framework.Patching { /// Provides generic methods for implementing Harmony patches. internal class PatchHelper { /********* ** Fields *********/ /// The interception keys currently being intercepted. private static readonly HashSet InterceptingKeys = new HashSet(StringComparer.OrdinalIgnoreCase); /********* ** Public methods *********/ /// Track a method that will be intercepted. /// The intercept key. /// Returns false if the method was already marked for interception, else true. public static bool StartIntercept(string key) { return PatchHelper.InterceptingKeys.Add(key); } /// Track a method as no longer being intercepted. /// The intercept key. public static void StopIntercept(string key) { PatchHelper.InterceptingKeys.Remove(key); } } } #endif