From 7914734375df7b4c94e9119611a0eb85cc2caac9 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 7 Mar 2021 19:48:47 -0500 Subject: get patcher names automatically if needed --- src/SMAPI.Mods.ErrorHandler/Patches/DialogueErrorPatch.cs | 7 ------- src/SMAPI.Mods.ErrorHandler/Patches/EventPatches.cs | 7 ------- src/SMAPI.Mods.ErrorHandler/Patches/GameLocationPatches.cs | 7 ------- src/SMAPI.Mods.ErrorHandler/Patches/LoadErrorPatch.cs | 7 ------- src/SMAPI.Mods.ErrorHandler/Patches/ObjectErrorPatch.cs | 7 ------- src/SMAPI.Mods.ErrorHandler/Patches/ScheduleErrorPatch.cs | 7 ------- .../Patches/SpriteBatchValidationPatches.cs | 7 ------- src/SMAPI.Mods.ErrorHandler/Patches/UtilityErrorPatches.cs | 7 ------- src/SMAPI/Framework/Patching/GamePatcher.cs | 2 +- src/SMAPI/Framework/Patching/IHarmonyPatch.cs | 6 +++--- src/SMAPI/Patches/LoadContextPatch.cs | 7 ------- 11 files changed, 4 insertions(+), 67 deletions(-) (limited to 'src') diff --git a/src/SMAPI.Mods.ErrorHandler/Patches/DialogueErrorPatch.cs b/src/SMAPI.Mods.ErrorHandler/Patches/DialogueErrorPatch.cs index ba0ca582..cce13064 100644 --- a/src/SMAPI.Mods.ErrorHandler/Patches/DialogueErrorPatch.cs +++ b/src/SMAPI.Mods.ErrorHandler/Patches/DialogueErrorPatch.cs @@ -29,13 +29,6 @@ namespace StardewModdingAPI.Mods.ErrorHandler.Patches private static IReflectionHelper Reflection; - /********* - ** Accessors - *********/ - /// - public string Name => nameof(DialogueErrorPatch); - - /********* ** Public methods *********/ diff --git a/src/SMAPI.Mods.ErrorHandler/Patches/EventPatches.cs b/src/SMAPI.Mods.ErrorHandler/Patches/EventPatches.cs index a15c1d32..72863d17 100644 --- a/src/SMAPI.Mods.ErrorHandler/Patches/EventPatches.cs +++ b/src/SMAPI.Mods.ErrorHandler/Patches/EventPatches.cs @@ -23,13 +23,6 @@ namespace StardewModdingAPI.Mods.ErrorHandler.Patches private static IMonitor MonitorForGame; - /********* - ** Accessors - *********/ - /// - public string Name => nameof(EventPatches); - - /********* ** Public methods *********/ diff --git a/src/SMAPI.Mods.ErrorHandler/Patches/GameLocationPatches.cs b/src/SMAPI.Mods.ErrorHandler/Patches/GameLocationPatches.cs index c10f2de7..1edf2d6a 100644 --- a/src/SMAPI.Mods.ErrorHandler/Patches/GameLocationPatches.cs +++ b/src/SMAPI.Mods.ErrorHandler/Patches/GameLocationPatches.cs @@ -24,13 +24,6 @@ namespace StardewModdingAPI.Mods.ErrorHandler.Patches private static IMonitor MonitorForGame; - /********* - ** Accessors - *********/ - /// - public string Name => nameof(GameLocationPatches); - - /********* ** Public methods *********/ diff --git a/src/SMAPI.Mods.ErrorHandler/Patches/LoadErrorPatch.cs b/src/SMAPI.Mods.ErrorHandler/Patches/LoadErrorPatch.cs index 2227ea07..52d5f5a1 100644 --- a/src/SMAPI.Mods.ErrorHandler/Patches/LoadErrorPatch.cs +++ b/src/SMAPI.Mods.ErrorHandler/Patches/LoadErrorPatch.cs @@ -31,13 +31,6 @@ namespace StardewModdingAPI.Mods.ErrorHandler.Patches private static Action OnContentRemoved; - /********* - ** Accessors - *********/ - /// - public string Name => nameof(LoadErrorPatch); - - /********* ** Public methods *********/ diff --git a/src/SMAPI.Mods.ErrorHandler/Patches/ObjectErrorPatch.cs b/src/SMAPI.Mods.ErrorHandler/Patches/ObjectErrorPatch.cs index 70f054cd..9f8a98cd 100644 --- a/src/SMAPI.Mods.ErrorHandler/Patches/ObjectErrorPatch.cs +++ b/src/SMAPI.Mods.ErrorHandler/Patches/ObjectErrorPatch.cs @@ -20,13 +20,6 @@ namespace StardewModdingAPI.Mods.ErrorHandler.Patches [SuppressMessage("ReSharper", "IdentifierTypo", Justification = "Argument names are defined by Harmony and methods are named for clarity.")] internal class ObjectErrorPatch : IHarmonyPatch { - /********* - ** Accessors - *********/ - /// - public string Name => nameof(ObjectErrorPatch); - - /********* ** Public methods *********/ diff --git a/src/SMAPI.Mods.ErrorHandler/Patches/ScheduleErrorPatch.cs b/src/SMAPI.Mods.ErrorHandler/Patches/ScheduleErrorPatch.cs index abbd1a8f..d2a5e988 100644 --- a/src/SMAPI.Mods.ErrorHandler/Patches/ScheduleErrorPatch.cs +++ b/src/SMAPI.Mods.ErrorHandler/Patches/ScheduleErrorPatch.cs @@ -26,13 +26,6 @@ namespace StardewModdingAPI.Mods.ErrorHandler.Patches private static IMonitor MonitorForGame; - /********* - ** Accessors - *********/ - /// - public string Name => nameof(ScheduleErrorPatch); - - /********* ** Public methods *********/ diff --git a/src/SMAPI.Mods.ErrorHandler/Patches/SpriteBatchValidationPatches.cs b/src/SMAPI.Mods.ErrorHandler/Patches/SpriteBatchValidationPatches.cs index 0211cfb1..95e4f5ef 100644 --- a/src/SMAPI.Mods.ErrorHandler/Patches/SpriteBatchValidationPatches.cs +++ b/src/SMAPI.Mods.ErrorHandler/Patches/SpriteBatchValidationPatches.cs @@ -16,13 +16,6 @@ namespace StardewModdingAPI.Mods.ErrorHandler.Patches [SuppressMessage("ReSharper", "IdentifierTypo", Justification = "Argument names are defined by Harmony and methods are named for clarity.")] internal class SpriteBatchValidationPatches : IHarmonyPatch { - /********* - ** Accessors - *********/ - /// - public string Name => nameof(SpriteBatchValidationPatches); - - /********* ** Public methods *********/ diff --git a/src/SMAPI.Mods.ErrorHandler/Patches/UtilityErrorPatches.cs b/src/SMAPI.Mods.ErrorHandler/Patches/UtilityErrorPatches.cs index 481c881e..1ddd407c 100644 --- a/src/SMAPI.Mods.ErrorHandler/Patches/UtilityErrorPatches.cs +++ b/src/SMAPI.Mods.ErrorHandler/Patches/UtilityErrorPatches.cs @@ -18,13 +18,6 @@ namespace StardewModdingAPI.Mods.ErrorHandler.Patches [SuppressMessage("ReSharper", "IdentifierTypo", Justification = "Argument names are defined by Harmony and methods are named for clarity.")] internal class UtilityErrorPatches : IHarmonyPatch { - /********* - ** Accessors - *********/ - /// - public string Name => nameof(UtilityErrorPatches); - - /********* ** Public methods *********/ diff --git a/src/SMAPI/Framework/Patching/GamePatcher.cs b/src/SMAPI/Framework/Patching/GamePatcher.cs index 82d7b9c8..ddecda08 100644 --- a/src/SMAPI/Framework/Patching/GamePatcher.cs +++ b/src/SMAPI/Framework/Patching/GamePatcher.cs @@ -44,7 +44,7 @@ namespace StardewModdingAPI.Framework.Patching } catch (Exception ex) { - this.Monitor.Log($"Couldn't apply runtime patch '{patch.Name}' to the game. Some SMAPI features may not work correctly. See log file for details.", LogLevel.Error); + this.Monitor.Log($"Couldn't apply runtime patch '{patch.GetType().Name}' to the game. Some SMAPI features may not work correctly. See log file for details.", LogLevel.Error); this.Monitor.Log(ex.GetLogSummary(), LogLevel.Trace); } } diff --git a/src/SMAPI/Framework/Patching/IHarmonyPatch.cs b/src/SMAPI/Framework/Patching/IHarmonyPatch.cs index 922243fa..38d30ab2 100644 --- a/src/SMAPI/Framework/Patching/IHarmonyPatch.cs +++ b/src/SMAPI/Framework/Patching/IHarmonyPatch.cs @@ -9,9 +9,9 @@ namespace StardewModdingAPI.Framework.Patching /// A Harmony patch to apply. internal interface IHarmonyPatch { - /// A unique name for this patch. - string Name { get; } - + /********* + ** Methods + *********/ /// Apply the Harmony patch. /// The Harmony instance. #if HARMONY_2 diff --git a/src/SMAPI/Patches/LoadContextPatch.cs b/src/SMAPI/Patches/LoadContextPatch.cs index 28bc23b6..c43d7071 100644 --- a/src/SMAPI/Patches/LoadContextPatch.cs +++ b/src/SMAPI/Patches/LoadContextPatch.cs @@ -33,13 +33,6 @@ namespace StardewModdingAPI.Patches private static bool IsInLoadForNewGame; - /********* - ** Accessors - *********/ - /// - public string Name => nameof(LoadContextPatch); - - /********* ** Public methods *********/ -- cgit