From cc4d3c1cf8755467acc4c72d25bf1e03fd8c4cba Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 29 Nov 2016 14:03:14 -0500 Subject: add framework for rewriting incompatible methods (#166) --- .../IMethodRewriter.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/StardewModdingAPI.AssemblyRewriters/IMethodRewriter.cs (limited to 'src/StardewModdingAPI.AssemblyRewriters/IMethodRewriter.cs') diff --git a/src/StardewModdingAPI.AssemblyRewriters/IMethodRewriter.cs b/src/StardewModdingAPI.AssemblyRewriters/IMethodRewriter.cs new file mode 100644 index 00000000..5cbb7e0d --- /dev/null +++ b/src/StardewModdingAPI.AssemblyRewriters/IMethodRewriter.cs @@ -0,0 +1,21 @@ +using Mono.Cecil; +using Mono.Cecil.Cil; + +namespace StardewModdingAPI.AssemblyRewriters +{ + /// Rewrites a method for compatibility. + public interface IMethodRewriter + { + /// Get whether the given method reference can be rewritten. + /// The method reference. + bool ShouldRewrite(MethodReference methodRef); + + /// 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. + void Rewrite(ModuleDefinition module, ILProcessor cil, Instruction callOp, MethodReference methodRef, PlatformAssemblyMap assemblyMap); + } +} -- cgit