diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-06-20 12:43:08 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-06-20 12:43:08 -0400 |
commit | e64ecc89f94641d4054162eff4943f660f43030f (patch) | |
tree | c43ca79f9947b3e16f946e1dc5fd1d02f70ce571 /src/SMAPI/Framework/Patching | |
parent | df6e745c6b842290338317ed1d3e969ee222998c (diff) | |
parent | cb9ff7019995eff92104703f097856d2523e02ce (diff) | |
download | SMAPI-e64ecc89f94641d4054162eff4943f660f43030f.tar.gz SMAPI-e64ecc89f94641d4054162eff4943f660f43030f.tar.bz2 SMAPI-e64ecc89f94641d4054162eff4943f660f43030f.zip |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Framework/Patching')
-rw-r--r-- | src/SMAPI/Framework/Patching/GamePatcher.cs | 10 | ||||
-rw-r--r-- | src/SMAPI/Framework/Patching/IHarmonyPatch.cs | 8 | ||||
-rw-r--r-- | src/SMAPI/Framework/Patching/PatchHelper.cs | 2 |
3 files changed, 19 insertions, 1 deletions
diff --git a/src/SMAPI/Framework/Patching/GamePatcher.cs b/src/SMAPI/Framework/Patching/GamePatcher.cs index f82159d0..82d7b9c8 100644 --- a/src/SMAPI/Framework/Patching/GamePatcher.cs +++ b/src/SMAPI/Framework/Patching/GamePatcher.cs @@ -1,5 +1,9 @@ using System; +#if HARMONY_2 +using HarmonyLib; +#else using Harmony; +#endif namespace StardewModdingAPI.Framework.Patching { @@ -27,7 +31,11 @@ namespace StardewModdingAPI.Framework.Patching /// <param name="patches">The patches to apply.</param> public void Apply(params IHarmonyPatch[] patches) { - HarmonyInstance harmony = HarmonyInstance.Create("io.smapi"); +#if HARMONY_2 + Harmony harmony = new Harmony("SMAPI"); +#else + HarmonyInstance harmony = HarmonyInstance.Create("SMAPI"); +#endif foreach (IHarmonyPatch patch in patches) { try diff --git a/src/SMAPI/Framework/Patching/IHarmonyPatch.cs b/src/SMAPI/Framework/Patching/IHarmonyPatch.cs index cb42f40e..922243fa 100644 --- a/src/SMAPI/Framework/Patching/IHarmonyPatch.cs +++ b/src/SMAPI/Framework/Patching/IHarmonyPatch.cs @@ -1,4 +1,8 @@ +#if HARMONY_2 +using HarmonyLib; +#else using Harmony; +#endif namespace StardewModdingAPI.Framework.Patching { @@ -10,6 +14,10 @@ namespace StardewModdingAPI.Framework.Patching /// <summary>Apply the Harmony patch.</summary> /// <param name="harmony">The Harmony instance.</param> +#if HARMONY_2 + void Apply(Harmony harmony); +#else void Apply(HarmonyInstance harmony); +#endif } } diff --git a/src/SMAPI/Framework/Patching/PatchHelper.cs b/src/SMAPI/Framework/Patching/PatchHelper.cs index 4cb436f0..d1aa0185 100644 --- a/src/SMAPI/Framework/Patching/PatchHelper.cs +++ b/src/SMAPI/Framework/Patching/PatchHelper.cs @@ -1,3 +1,4 @@ +#if !HARMONY_2 using System; using System.Collections.Generic; @@ -32,3 +33,4 @@ namespace StardewModdingAPI.Framework.Patching } } } +#endif |