summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI.AssemblyRewriters/Framework/BaseFieldRewriter.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-03-12 01:01:52 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-03-12 01:01:52 -0500
commit3663f70603fae8ed34e1e0c7500adc2c899312a5 (patch)
tree4df5bbdee93c16aaa50d3244a8149cc3356f472b /src/StardewModdingAPI.AssemblyRewriters/Framework/BaseFieldRewriter.cs
parent95e519796773a2ef17ec482e27cd4403282e2cd1 (diff)
downloadSMAPI-3663f70603fae8ed34e1e0c7500adc2c899312a5.tar.gz
SMAPI-3663f70603fae8ed34e1e0c7500adc2c899312a5.tar.bz2
SMAPI-3663f70603fae8ed34e1e0c7500adc2c899312a5.zip
split IInstructionFinder from IInstructionRewriter (#247)
Diffstat (limited to 'src/StardewModdingAPI.AssemblyRewriters/Framework/BaseFieldRewriter.cs')
-rw-r--r--src/StardewModdingAPI.AssemblyRewriters/Framework/BaseFieldRewriter.cs18
1 files changed, 1 insertions, 17 deletions
diff --git a/src/StardewModdingAPI.AssemblyRewriters/Framework/BaseFieldRewriter.cs b/src/StardewModdingAPI.AssemblyRewriters/Framework/BaseFieldRewriter.cs
index 7e01ca73..b2c25587 100644
--- a/src/StardewModdingAPI.AssemblyRewriters/Framework/BaseFieldRewriter.cs
+++ b/src/StardewModdingAPI.AssemblyRewriters/Framework/BaseFieldRewriter.cs
@@ -4,21 +4,11 @@ using Mono.Cecil.Cil;
namespace StardewModdingAPI.AssemblyRewriters.Framework
{
/// <summary>Base class for a field rewriter.</summary>
- public abstract class BaseFieldRewriter : IInstructionRewriter
+ public abstract class BaseFieldRewriter : BaseFieldFinder, IInstructionRewriter
{
/*********
** Public methods
*********/
- /// <summary>Get whether a CIL instruction should be rewritten.</summary>
- /// <param name="instruction">The IL instruction.</param>
- /// <param name="platformChanged">Whether the mod was compiled on a different platform.</param>
- public bool ShouldRewrite(Instruction instruction, bool platformChanged)
- {
- if (instruction.OpCode != OpCodes.Ldfld && instruction.OpCode != OpCodes.Ldsfld && instruction.OpCode != OpCodes.Stfld && instruction.OpCode != OpCodes.Stsfld)
- return false; // not a field reference
- return this.ShouldRewrite(instruction, (FieldReference)instruction.Operand, platformChanged);
- }
-
/// <summary>Rewrite a CIL instruction for compatibility.</summary>
/// <param name="module">The module being rewritten.</param>
/// <param name="cil">The CIL rewriter.</param>
@@ -34,12 +24,6 @@ namespace StardewModdingAPI.AssemblyRewriters.Framework
/*********
** Protected methods
*********/
- /// <summary>Get whether a field reference should be rewritten.</summary>
- /// <param name="instruction">The IL instruction.</param>
- /// <param name="fieldRef">The field reference.</param>
- /// <param name="platformChanged">Whether the mod was compiled on a different platform.</param>
- protected abstract bool ShouldRewrite(Instruction instruction, FieldReference fieldRef, bool platformChanged);
-
/// <summary>Rewrite a method for compatibility.</summary>
/// <param name="module">The module being rewritten.</param>
/// <param name="cil">The CIL rewriter.</param>