summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Patching
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/Framework/Patching')
-rw-r--r--src/SMAPI/Framework/Patching/GamePatcher.cs4
-rw-r--r--src/SMAPI/Framework/Patching/IHarmonyPatch.cs4
-rw-r--r--src/SMAPI/Framework/Patching/PatchHelper.cs34
3 files changed, 4 insertions, 38 deletions
diff --git a/src/SMAPI/Framework/Patching/GamePatcher.cs b/src/SMAPI/Framework/Patching/GamePatcher.cs
index f82159d0..dcad285a 100644
--- a/src/SMAPI/Framework/Patching/GamePatcher.cs
+++ b/src/SMAPI/Framework/Patching/GamePatcher.cs
@@ -1,5 +1,5 @@
using System;
-using Harmony;
+using HarmonyLib;
namespace StardewModdingAPI.Framework.Patching
{
@@ -27,7 +27,7 @@ namespace StardewModdingAPI.Framework.Patching
/// <param name="patches">The patches to apply.</param>
public void Apply(params IHarmonyPatch[] patches)
{
- HarmonyInstance harmony = HarmonyInstance.Create("io.smapi");
+ Harmony harmony = new Harmony("SMAPI");
foreach (IHarmonyPatch patch in patches)
{
try
diff --git a/src/SMAPI/Framework/Patching/IHarmonyPatch.cs b/src/SMAPI/Framework/Patching/IHarmonyPatch.cs
index cb42f40e..7d5eb3d4 100644
--- a/src/SMAPI/Framework/Patching/IHarmonyPatch.cs
+++ b/src/SMAPI/Framework/Patching/IHarmonyPatch.cs
@@ -1,4 +1,4 @@
-using Harmony;
+using HarmonyLib;
namespace StardewModdingAPI.Framework.Patching
{
@@ -10,6 +10,6 @@ namespace StardewModdingAPI.Framework.Patching
/// <summary>Apply the Harmony patch.</summary>
/// <param name="harmony">The Harmony instance.</param>
- void Apply(HarmonyInstance harmony);
+ void Apply(Harmony harmony);
}
}
diff --git a/src/SMAPI/Framework/Patching/PatchHelper.cs b/src/SMAPI/Framework/Patching/PatchHelper.cs
deleted file mode 100644
index 4cb436f0..00000000
--- a/src/SMAPI/Framework/Patching/PatchHelper.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace StardewModdingAPI.Framework.Patching
-{
- /// <summary>Provides generic methods for implementing Harmony patches.</summary>
- internal class PatchHelper
- {
- /*********
- ** Fields
- *********/
- /// <summary>The interception keys currently being intercepted.</summary>
- private static readonly HashSet<string> InterceptingKeys = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
-
-
- /*********
- ** Public methods
- *********/
- /// <summary>Track a method that will be intercepted.</summary>
- /// <param name="key">The intercept key.</param>
- /// <returns>Returns false if the method was already marked for interception, else true.</returns>
- public static bool StartIntercept(string key)
- {
- return PatchHelper.InterceptingKeys.Add(key);
- }
-
- /// <summary>Track a method as no longer being intercepted.</summary>
- /// <param name="key">The intercept key.</param>
- public static void StopIntercept(string key)
- {
- PatchHelper.InterceptingKeys.Remove(key);
- }
- }
-}