migrate to Harmony 2.0 (#711)
This commit is contained in:
parent
9728fe3f34
commit
e08979acd3
|
@ -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("io.smapi");
|
||||
foreach (IHarmonyPatch patch in patches)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Harmony;
|
||||
|
||||
namespace StardewModdingAPI.Framework.PerformanceMonitoring
|
||||
{
|
||||
|
@ -57,7 +56,7 @@ namespace StardewModdingAPI.Framework.PerformanceMonitoring
|
|||
// add entry
|
||||
if (this.Entries.Count > this.MaxEntries)
|
||||
this.Entries.Pop();
|
||||
this.Entries.Add(entry);
|
||||
this.Entries.Push(entry);
|
||||
|
||||
// update metrics
|
||||
if (this.PeakPerformanceCounterEntry == null || entry.ElapsedMilliseconds > this.PeakPerformanceCounterEntry.Value.ElapsedMilliseconds)
|
||||
|
|
|
@ -2,7 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Reflection;
|
||||
using Harmony;
|
||||
using HarmonyLib;
|
||||
using StardewModdingAPI.Framework.Patching;
|
||||
using StardewModdingAPI.Framework.Reflection;
|
||||
using StardewValley;
|
||||
|
@ -47,7 +47,7 @@ namespace StardewModdingAPI.Patches
|
|||
|
||||
/// <summary>Apply the Harmony patch.</summary>
|
||||
/// <param name="harmony">The Harmony instance.</param>
|
||||
public void Apply(HarmonyInstance harmony)
|
||||
public void Apply(Harmony harmony)
|
||||
{
|
||||
harmony.Patch(
|
||||
original: AccessTools.Constructor(typeof(Dialogue), new[] { typeof(string), typeof(NPC) }),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Reflection;
|
||||
using Harmony;
|
||||
using HarmonyLib;
|
||||
using StardewModdingAPI.Framework.Patching;
|
||||
using StardewValley;
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace StardewModdingAPI.Patches
|
|||
|
||||
/// <summary>Apply the Harmony patch.</summary>
|
||||
/// <param name="harmony">The Harmony instance.</param>
|
||||
public void Apply(HarmonyInstance harmony)
|
||||
public void Apply(Harmony harmony)
|
||||
{
|
||||
harmony.Patch(
|
||||
original: AccessTools.Method(typeof(GameLocation), "checkEventPrecondition"),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Harmony;
|
||||
using HarmonyLib;
|
||||
using StardewModdingAPI.Enums;
|
||||
using StardewModdingAPI.Framework.Patching;
|
||||
using StardewModdingAPI.Framework.Reflection;
|
||||
|
@ -47,7 +47,7 @@ namespace StardewModdingAPI.Patches
|
|||
|
||||
/// <summary>Apply the Harmony patch.</summary>
|
||||
/// <param name="harmony">The Harmony instance.</param>
|
||||
public void Apply(HarmonyInstance harmony)
|
||||
public void Apply(Harmony harmony)
|
||||
{
|
||||
// detect CreatedBasicInfo
|
||||
harmony.Patch(
|
||||
|
|
|
@ -2,7 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Harmony;
|
||||
using HarmonyLib;
|
||||
using StardewModdingAPI.Framework.Exceptions;
|
||||
using StardewModdingAPI.Framework.Patching;
|
||||
using StardewValley;
|
||||
|
@ -49,7 +49,7 @@ namespace StardewModdingAPI.Patches
|
|||
|
||||
/// <summary>Apply the Harmony patch.</summary>
|
||||
/// <param name="harmony">The Harmony instance.</param>
|
||||
public void Apply(HarmonyInstance harmony)
|
||||
public void Apply(Harmony harmony)
|
||||
{
|
||||
harmony.Patch(
|
||||
original: AccessTools.Method(typeof(SaveGame), nameof(SaveGame.loadDataToLocations)),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Reflection;
|
||||
using Harmony;
|
||||
using HarmonyLib;
|
||||
using StardewModdingAPI.Framework.Patching;
|
||||
using StardewValley;
|
||||
using StardewValley.Menus;
|
||||
|
@ -27,7 +27,7 @@ namespace StardewModdingAPI.Patches
|
|||
*********/
|
||||
/// <summary>Apply the Harmony patch.</summary>
|
||||
/// <param name="harmony">The Harmony instance.</param>
|
||||
public void Apply(HarmonyInstance harmony)
|
||||
public void Apply(Harmony harmony)
|
||||
{
|
||||
// object.getDescription
|
||||
harmony.Patch(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Reflection;
|
||||
using Harmony;
|
||||
using HarmonyLib;
|
||||
using StardewModdingAPI.Framework.Patching;
|
||||
using StardewValley;
|
||||
|
||||
|
@ -39,7 +39,7 @@ namespace StardewModdingAPI.Patches
|
|||
|
||||
/// <summary>Apply the Harmony patch.</summary>
|
||||
/// <param name="harmony">The Harmony instance.</param>
|
||||
public void Apply(HarmonyInstance harmony)
|
||||
public void Apply(Harmony harmony)
|
||||
{
|
||||
harmony.Patch(
|
||||
original: AccessTools.Method(typeof(NPC), "parseMasterSchedule"),
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="LargeAddressAware" Version="1.0.4" />
|
||||
<PackageReference Include="Lib.Harmony" Version="1.2.0.1" />
|
||||
<PackageReference Include="Lib.Harmony" Version="2.0.0.10" />
|
||||
<PackageReference Include="Mono.Cecil" Version="0.11.2" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="Platonymous.TMXTile" Version="1.3.4" />
|
||||
|
|
Loading…
Reference in New Issue