summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Commands/HarmonySummaryCommand.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-07-21 22:49:53 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-07-21 22:49:53 -0400
commit92bcb8405c4dc0f4af283146a2ad6ea3a178fd06 (patch)
tree2e5bae4b7e8c1a625c2c8f1e3b8729c5ca61c8aa /src/SMAPI/Framework/Commands/HarmonySummaryCommand.cs
parent7e5d77fb8c2606795af239717a596de460bc58f7 (diff)
parent72b3c9d14314a3f69a0ca9d6ac9de9de1d31943d (diff)
downloadSMAPI-92bcb8405c4dc0f4af283146a2ad6ea3a178fd06.tar.gz
SMAPI-92bcb8405c4dc0f4af283146a2ad6ea3a178fd06.tar.bz2
SMAPI-92bcb8405c4dc0f4af283146a2ad6ea3a178fd06.zip
Merge branch 'harmony-2' into develop
Diffstat (limited to 'src/SMAPI/Framework/Commands/HarmonySummaryCommand.cs')
-rw-r--r--src/SMAPI/Framework/Commands/HarmonySummaryCommand.cs26
1 files changed, 0 insertions, 26 deletions
diff --git a/src/SMAPI/Framework/Commands/HarmonySummaryCommand.cs b/src/SMAPI/Framework/Commands/HarmonySummaryCommand.cs
index f3731d16..45b34556 100644
--- a/src/SMAPI/Framework/Commands/HarmonySummaryCommand.cs
+++ b/src/SMAPI/Framework/Commands/HarmonySummaryCommand.cs
@@ -3,25 +3,13 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
-#if HARMONY_2
using HarmonyLib;
-#else
-using Harmony;
-#endif
namespace StardewModdingAPI.Framework.Commands
{
/// <summary>The 'harmony_summary' SMAPI console command.</summary>
internal class HarmonySummaryCommand : IInternalCommand
{
-#if !HARMONY_2
- /*********
- ** Fields
- *********/
- /// <summary>The Harmony instance through which to fetch patch info.</summary>
- private readonly HarmonyInstance HarmonyInstance = HarmonyInstance.Create($"SMAPI.{nameof(HarmonySummaryCommand)}");
-#endif
-
/*********
** Accessors
*********/
@@ -60,9 +48,7 @@ namespace StardewModdingAPI.Framework.Commands
{
PatchType.Prefix => 0,
PatchType.Postfix => 1,
-#if HARMONY_2
PatchType.Finalizer => 2,
-#endif
PatchType.Transpiler => 3,
_ => 4
});
@@ -111,26 +97,16 @@ namespace StardewModdingAPI.Framework.Commands
/// <summary>Get all current Harmony patches.</summary>
private IEnumerable<SearchResult> GetAllPatches()
{
-#if HARMONY_2
foreach (MethodBase method in Harmony.GetAllPatchedMethods().ToArray())
-#else
- foreach (MethodBase method in this.HarmonyInstance.GetPatchedMethods().ToArray())
-#endif
{
// get metadata for method
-#if HARMONY_2
HarmonyLib.Patches patchInfo = Harmony.GetPatchInfo(method);
-#else
- Harmony.Patches patchInfo = this.HarmonyInstance.GetPatchInfo(method);
-#endif
IDictionary<PatchType, IReadOnlyCollection<Patch>> patchGroups = new Dictionary<PatchType, IReadOnlyCollection<Patch>>
{
[PatchType.Prefix] = patchInfo.Prefixes,
[PatchType.Postfix] = patchInfo.Postfixes,
-#if HARMONY_2
[PatchType.Finalizer] = patchInfo.Finalizers,
-#endif
[PatchType.Transpiler] = patchInfo.Transpilers
};
@@ -160,10 +136,8 @@ namespace StardewModdingAPI.Framework.Commands
/// <summary>A postfix patch.</summary>
Postfix,
-#if HARMONY_2
/// <summary>A finalizer patch.</summary>
Finalizer,
-#endif
/// <summary>A transpiler patch.</summary>
Transpiler