diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-03-26 19:01:13 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-03-26 19:01:13 -0400 |
commit | 23443721cd2cc5391510a6e65b4e6559037e5b5e (patch) | |
tree | 882305b5a0d472701757c5af60a3fb7532530909 /src | |
parent | 06f5e92b88fac190f94690f1580775449014e411 (diff) | |
download | SMAPI-23443721cd2cc5391510a6e65b4e6559037e5b5e.tar.gz SMAPI-23443721cd2cc5391510a6e65b4e6559037e5b5e.tar.bz2 SMAPI-23443721cd2cc5391510a6e65b4e6559037e5b5e.zip |
allow multiple rewriters to change the same CIL instruction (#254)
Diffstat (limited to 'src')
-rw-r--r-- | src/StardewModdingAPI/Framework/AssemblyLoader.cs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/StardewModdingAPI/Framework/AssemblyLoader.cs b/src/StardewModdingAPI/Framework/AssemblyLoader.cs index c7ad3da4..aee0bbb3 100644 --- a/src/StardewModdingAPI/Framework/AssemblyLoader.cs +++ b/src/StardewModdingAPI/Framework/AssemblyLoader.cs @@ -212,9 +212,11 @@ namespace StardewModdingAPI.Framework } // rewrite instruction if needed - IInstructionRewriter rewriter = rewriters.FirstOrDefault(p => p.IsMatch(instruction, platformChanged)); - if (rewriter != null) + foreach (IInstructionRewriter rewriter in rewriters) { + if (!rewriter.IsMatch(instruction, platformChanged)) + continue; + this.LogOnce(this.Monitor, loggedMessages, $"Rewriting {assembly.Name.Name} to fix {rewriter.NounPhrase}..."); rewriter.Rewrite(module, cil, instruction, this.AssemblyMap); anyRewritten = true; |