diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-08-31 01:13:22 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-09-01 20:02:58 -0400 |
commit | 8bfab94213e86c4245961150bd3423ee85213c5d (patch) | |
tree | 69fb8ceab3a0c21a27a2ac28eb6c42333b1bcf9b /src/SMAPI/Framework/ModLoading/AssemblyLoader.cs | |
parent | c6cc1513c5ab5544094fe30b13ee0d73e1e04109 (diff) | |
download | SMAPI-8bfab94213e86c4245961150bd3423ee85213c5d.tar.gz SMAPI-8bfab94213e86c4245961150bd3423ee85213c5d.tar.bz2 SMAPI-8bfab94213e86c4245961150bd3423ee85213c5d.zip |
reduce unneeded operations when scanning/rewriting mod DLLs
Diffstat (limited to 'src/SMAPI/Framework/ModLoading/AssemblyLoader.cs')
-rw-r--r-- | src/SMAPI/Framework/ModLoading/AssemblyLoader.cs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs b/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs index 7668e8a9..57a76a35 100644 --- a/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs +++ b/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs @@ -300,10 +300,10 @@ namespace StardewModdingAPI.Framework.ModLoading // remove old assembly reference if (this.AssemblyMap.RemoveNames.Any(name => module.AssemblyReferences[i].Name == name)) { - this.Monitor.LogOnce(loggedMessages, $"{logPrefix}Rewriting {filename} for OS..."); platformChanged = true; module.AssemblyReferences.RemoveAt(i); i--; + this.Monitor.LogOnce(loggedMessages, $"{logPrefix}Rewrote {filename} for OS..."); } } if (platformChanged) @@ -394,7 +394,7 @@ namespace StardewModdingAPI.Framework.ModLoading break; case InstructionHandleResult.DetectedGamePatch: - template = $"{logPrefix}Detected game patcher ($phrase) in assembly {filename}."; + template = $"{logPrefix}Detected game patcher in assembly {filename}."; // no need for phrase, which would confusingly be 'Harmony 1.x' here mod.SetWarning(ModWarning.PatchesGame); break; @@ -438,13 +438,10 @@ namespace StardewModdingAPI.Framework.ModLoading return; // format messages - if (handler.Phrases.Any()) - { - foreach (string message in handler.Phrases) - this.Monitor.LogOnce(loggedMessages, template.Replace("$phrase", message)); - } - else - this.Monitor.LogOnce(loggedMessages, template.Replace("$phrase", handler.DefaultPhrase ?? handler.GetType().Name)); + string phrase = handler.Phrases.Any() + ? string.Join(", ", handler.Phrases) + : handler.DefaultPhrase ?? handler.GetType().Name; + this.Monitor.LogOnce(loggedMessages, template.Replace("$phrase", phrase)); } /// <summary>Get the correct reference to use for compatibility with the current platform.</summary> |