summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ModLoading/IInstructionHandler.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-05-20 19:38:08 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-05-20 19:38:08 -0400
commit310eb1fe9afdb820d5584a46200bf073fc00ccb7 (patch)
tree72c16c6d4f8447f45e8e6612cb25cd255d2b308c /src/SMAPI/Framework/ModLoading/IInstructionHandler.cs
parentaa5cc2c9be8bdc79c6fa7b1b9c2581a05b88117d (diff)
parentc5c30189e43f93c3f3c66207945187a974656c9e (diff)
downloadSMAPI-310eb1fe9afdb820d5584a46200bf073fc00ccb7.tar.gz
SMAPI-310eb1fe9afdb820d5584a46200bf073fc00ccb7.tar.bz2
SMAPI-310eb1fe9afdb820d5584a46200bf073fc00ccb7.zip
Merge branch 'mod/harmony-2.0' into develop
# Conflicts: # docs/release-notes.md # src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
Diffstat (limited to 'src/SMAPI/Framework/ModLoading/IInstructionHandler.cs')
-rw-r--r--src/SMAPI/Framework/ModLoading/IInstructionHandler.cs32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/SMAPI/Framework/ModLoading/IInstructionHandler.cs b/src/SMAPI/Framework/ModLoading/IInstructionHandler.cs
index 8830cc74..e6de6785 100644
--- a/src/SMAPI/Framework/ModLoading/IInstructionHandler.cs
+++ b/src/SMAPI/Framework/ModLoading/IInstructionHandler.cs
@@ -1,3 +1,5 @@
+using System;
+using System.Collections.Generic;
using Mono.Cecil;
using Mono.Cecil.Cil;
@@ -9,26 +11,32 @@ namespace StardewModdingAPI.Framework.ModLoading
/*********
** Accessors
*********/
- /// <summary>A brief noun phrase indicating what the handler matches.</summary>
- string NounPhrase { get; }
+ /// <summary>A brief noun phrase indicating what the handler matches, used if <see cref="Phrases"/> is empty.</summary>
+ string DefaultPhrase { get; }
+
+ /// <summary>The rewrite flags raised for the current module.</summary>
+ ISet<InstructionHandleResult> Flags { get; }
+
+ /// <summary>The brief noun phrases indicating what the handler matched for the current module.</summary>
+ ISet<string> Phrases { get; }
/*********
** Methods
*********/
- /// <summary>Perform the predefined logic for a method if applicable.</summary>
+ /// <summary>Rewrite a type reference if needed.</summary>
/// <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(ModuleDefinition module, MethodDefinition method, PlatformAssemblyMap assemblyMap, bool platformChanged);
+ /// <param name="type">The type definition to handle.</param>
+ /// <param name="replaceWith">Replaces the type reference with a new one.</param>
+ /// <returns>Returns whether the type was changed.</returns>
+ bool Handle(ModuleDefinition module, TypeReference type, Action<TypeReference> replaceWith);
- /// <summary>Perform the predefined logic for an instruction if applicable.</summary>
+ /// <summary>Rewrite a CIL instruction reference if needed.</summary>
/// <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(ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged);
+ /// <param name="instruction">The CIL instruction to handle.</param>
+ /// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
+ /// <returns>Returns whether the instruction was changed.</returns>
+ bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith);
}
}