using System; using System.Collections.Generic; using Mono.Cecil; using Mono.Cecil.Cil; namespace StardewModdingAPI.Framework.ModLoading { /// Performs predefined logic for detected CIL instructions. internal interface IInstructionHandler { /********* ** Accessors *********/ /// A brief noun phrase indicating what the handler matches, used if is empty. string DefaultPhrase { get; } /// The rewrite flags raised for the current module. ISet Flags { get; } /// The brief noun phrases indicating what the handler matched for the current module. ISet Phrases { get; } /********* ** Methods *********/ /// Rewrite a type reference if needed. /// The assembly module containing the instruction. /// The type definition to handle. /// Replaces the type reference with a new one. /// Returns whether the type was changed. bool Handle(ModuleDefinition module, TypeReference type, Action replaceWith); /// Rewrite a CIL instruction reference if needed. /// The assembly module containing the instruction. /// The CIL processor. /// The CIL instruction to handle. /// Replaces the CIL instruction with a new one. /// Returns whether the instruction was changed. bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action replaceWith); } }