From 8c5bd12f4793a9c866b6046c05482592a5c799bc Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 19 Sep 2017 22:45:28 -0400 Subject: merge assembly rewriters into main SMAPI project (#347) --- .../Framework/ModLoading/IInstructionRewriter.cs | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/StardewModdingAPI/Framework/ModLoading/IInstructionRewriter.cs (limited to 'src/StardewModdingAPI/Framework/ModLoading/IInstructionRewriter.cs') diff --git a/src/StardewModdingAPI/Framework/ModLoading/IInstructionRewriter.cs b/src/StardewModdingAPI/Framework/ModLoading/IInstructionRewriter.cs new file mode 100644 index 00000000..9b35cdae --- /dev/null +++ b/src/StardewModdingAPI/Framework/ModLoading/IInstructionRewriter.cs @@ -0,0 +1,38 @@ +using Mono.Cecil; +using Mono.Cecil.Cil; + +namespace StardewModdingAPI.Framework.ModLoading +{ + /// Rewrites CIL instructions for compatibility. + internal interface IInstructionRewriter + { + /********* + ** Accessors + *********/ + /// A brief noun phrase indicating what the rewriter matches. + string NounPhrase { get; } + + + /********* + ** Methods + *********/ + /// Rewrite a method definition for compatibility. + /// The module being rewritten. + /// The method definition to rewrite. + /// Metadata for mapping assemblies to the current platform. + /// Whether the mod was compiled on a different platform. + /// Returns whether the instruction was rewritten. + /// The CIL instruction is not compatible, and can't be rewritten. + bool Rewrite(ModuleDefinition module, MethodDefinition method, PlatformAssemblyMap assemblyMap, bool platformChanged); + + /// 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. + /// Whether the mod was compiled on a different platform. + /// Returns whether the instruction was rewritten. + /// The CIL instruction is not compatible, and can't be rewritten. + bool Rewrite(ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged); + } +} -- cgit