summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Framework/ModLoading/IInstructionHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/StardewModdingAPI/Framework/ModLoading/IInstructionHandler.cs')
-rw-r--r--src/StardewModdingAPI/Framework/ModLoading/IInstructionHandler.cs36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/StardewModdingAPI/Framework/ModLoading/IInstructionHandler.cs b/src/StardewModdingAPI/Framework/ModLoading/IInstructionHandler.cs
new file mode 100644
index 00000000..be2e10ee
--- /dev/null
+++ b/src/StardewModdingAPI/Framework/ModLoading/IInstructionHandler.cs
@@ -0,0 +1,36 @@
+using Mono.Cecil;
+using Mono.Cecil.Cil;
+
+namespace StardewModdingAPI.Framework.ModLoading
+{
+ /// <summary>Performs predefined logic for detected CIL instructions.</summary>
+ internal interface IInstructionHandler
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>A brief noun phrase indicating what the handler matches.</summary>
+ string NounPhrase { get; }
+
+
+ /*********
+ ** Methods
+ *********/
+ /// <summary>Perform the predefined logic for a method if applicable.</summary>
+ /// <param name="mod">The mod containing the instruction.</param>
+ /// <param name="module">The assembly module containing the instruction.</param>
+ /// <param name="method">The method definition containing the instruction.</param>
+ /// <param name="assemblyMap">Metadata for mapping assemblies to the current platform.</param>
+ /// <param name="platformChanged">Whether the mod was compiled on a different platform.</param>
+ InstructionHandleResult Handle(IModMetadata mod, ModuleDefinition module, MethodDefinition method, PlatformAssemblyMap assemblyMap, bool platformChanged);
+
+ /// <summary>Perform the predefined logic for an instruction if applicable.</summary>
+ /// <param name="mod">The mod containing the instruction.</param>
+ /// <param name="module">The assembly module containing the instruction.</param>
+ /// <param name="cil">The CIL processor.</param>
+ /// <param name="instruction">The instruction to handle.</param>
+ /// <param name="assemblyMap">Metadata for mapping assemblies to the current platform.</param>
+ /// <param name="platformChanged">Whether the mod was compiled on a different platform.</param>
+ InstructionHandleResult Handle(IModMetadata mod, ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged);
+ }
+}