blob: 126504e3e6fe31d1e97b1ae8a19b6f5dcf4f9a41 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#nullable disable
using System;
using System.Collections.Generic;
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, 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>Rewrite a module definition if needed.</summary>
/// <param name="module">The assembly module.</param>
/// <returns>Returns whether the module was changed.</returns>
bool Handle(ModuleDefinition module);
/// <summary>Rewrite a type reference if needed.</summary>
/// <param name="module">The assembly module containing the instruction.</param>
/// <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>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 CIL instruction to handle.</param>
/// <returns>Returns whether the instruction was changed.</returns>
bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction);
}
}
|