From 499cd8ab317080096c373c6ed6649bd51fb01c7d Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 5 May 2020 21:45:53 -0400 Subject: combine Harmony 1.x rewrite logs (#711) --- .../Framework/ModLoading/Rewriters/Harmony1AssemblyRewriter.cs | 9 ++++++++- src/SMAPI/Framework/ModLoading/Rewriters/MethodParentRewriter.cs | 5 +++-- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src/SMAPI/Framework') diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/Harmony1AssemblyRewriter.cs b/src/SMAPI/Framework/ModLoading/Rewriters/Harmony1AssemblyRewriter.cs index 29e44bfe..9faca235 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/Harmony1AssemblyRewriter.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/Harmony1AssemblyRewriter.cs @@ -18,12 +18,19 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters private readonly Type HarmonyType = typeof(HarmonyLib.Harmony); + /********* + ** Accessors + *********/ + /// A brief noun phrase indicating what the rewriter matches. + public const string DefaultNounPhrase = "Harmony 1.x"; + + /********* ** Public methods *********/ /// Construct an instance. public Harmony1AssemblyRewriter() - : base(new TypeAssemblyFinder(Harmony1AssemblyRewriter.FromAssemblyName, InstructionHandleResult.None), "Harmony 1.x types") + : base(new TypeAssemblyFinder(Harmony1AssemblyRewriter.FromAssemblyName, InstructionHandleResult.None), Harmony1AssemblyRewriter.DefaultNounPhrase) { } diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/MethodParentRewriter.cs b/src/SMAPI/Framework/ModLoading/Rewriters/MethodParentRewriter.cs index 0984dc44..c4c740b3 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/MethodParentRewriter.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/MethodParentRewriter.cs @@ -35,11 +35,12 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters /// The type whose methods to remap. /// The type with methods to map to. /// Whether to only rewrite references if loading the assembly on a different platform than it was compiled on. - public MethodParentRewriter(string fromType, Type toType, bool onlyIfPlatformChanged = false) + /// A brief noun phrase indicating what the instruction finder matches (or null to generate one). + public MethodParentRewriter(string fromType, Type toType, bool onlyIfPlatformChanged = false, string nounPhrase = null) { this.FromType = fromType; this.ToType = toType; - this.NounPhrase = $"{fromType.Split('.').Last()} methods"; + this.NounPhrase = nounPhrase ?? $"{fromType.Split('.').Last()} methods"; this.OnlyIfPlatformChanged = onlyIfPlatformChanged; } -- cgit