using Mono.Cecil; using Mono.Cecil.Cil; namespace StardewModdingAPI.AssemblyRewriters.Framework { /// Base class for a field rewriter. public abstract class BaseFieldRewriter : BaseFieldFinder, IInstructionRewriter { /********* ** Public methods *********/ /// Rewrite a CIL instruction for compatibility. /// The module being rewritten. /// The CIL rewriter. /// The instruction to rewrite. /// Metadata for mapping assemblies to the current platform. public void Rewrite(ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap) { FieldReference fieldRef = (FieldReference)instruction.Operand; this.Rewrite(module, cil, instruction, fieldRef, assemblyMap); } /********* ** Protected methods *********/ /// Rewrite a method for compatibility. /// The module being rewritten. /// The CIL rewriter. /// The instruction which references the field. /// The field reference invoked by the . /// Metadata for mapping assemblies to the current platform. protected abstract void Rewrite(ModuleDefinition module, ILProcessor cil, Instruction instruction, FieldReference fieldRef, PlatformAssemblyMap assemblyMap); } }