using Mono.Cecil; using Mono.Cecil.Cil; namespace StardewModdingAPI.AssemblyRewriters.Framework { /// Base class for a method rewriter. public abstract class BaseMethodRewriter : BaseMethodFinder, 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) { MethodReference methodRef = (MethodReference)instruction.Operand; this.Rewrite(module, cil, instruction, methodRef, assemblyMap); } /********* ** Protected methods *********/ /// Rewrite a method for compatibility. /// The module being rewritten. /// The CIL rewriter. /// The instruction which calls the method. /// The method reference invoked by the . /// Metadata for mapping assemblies to the current platform. protected abstract void Rewrite(ModuleDefinition module, ILProcessor cil, Instruction instruction, MethodReference methodRef, PlatformAssemblyMap assemblyMap); } }