Browse documentation

Class InnerTarget

Namespace
HarmonyLib
Assembly
0Harmony.dll

Selects occurrences of a member operation or literal load inside an outer method

public sealed class InnerTarget
Inheritance
object
InnerTarget

Constructors

InnerTarget(ConstructorInfo, params int[])

Selects newobj instructions using the specified constructor

public InnerTarget(ConstructorInfo constructor, params int[] positions)

Parameters

constructor ConstructorInfo

The selected instance constructor

positions int[]

One-based occurrences, negative from the end, or empty for all

InnerTarget(FieldInfo, InnerTargetKind, params int[])

Selects loads or stores of a field

public InnerTarget(FieldInfo field, InnerTargetKind kind, params int[] positions)

Parameters

field FieldInfo

The selected field, optionally on a generic type definition

kind InnerTargetKind

FieldRead or FieldWrite

positions int[]

One-based occurrences, negative from the end, or empty for all

InnerTarget(MethodInfo, params int[])

Selects an exact method or explicit generic method family

public InnerTarget(MethodInfo method, params int[] positions)

Parameters

method MethodInfo

The selected method

positions int[]

One-based occurrences, negative from the end, or empty for all

InnerTarget(PropertyInfo, InnerTargetKind, params int[])

Selects a property getter or setter as its actual accessor method

public InnerTarget(PropertyInfo property, InnerTargetKind kind, params int[] positions)

Parameters

property PropertyInfo

The selected property

kind InnerTargetKind

Getter or Setter

positions int[]

One-based occurrences, negative from the end, or empty for all

Fields

positions

One-based matches; negative positions count from the end, and empty selects all

public int[] positions

Field Value

int[]

Remarks

Counts operations after transpilers, before Infix insertion. Zero, null and missing positions are invalid; at least one match is required. Installation copies the selector and positions, so later edits do not affect installed patches.

Properties

ConstantValue

The selected literal value, or null for a member target

public object ConstantValue { get; }

Property Value

object

Kind

The normalized operation; property accessors are Method targets

public InnerTargetKind Kind { get; }

Property Value

InnerTargetKind

Member

The exact selected member or explicit declaring-type family; null for a literal

public MemberInfo Member { get; }

Property Value

MemberInfo

Methods

Constant(object, params int[])

Selects exact string, int, long, float, or double literal loads; floating-point identity preserves every bit

public static InnerTarget Constant(object value, params int[] positions)

Parameters

value object

A non-null string, int, long, float, or double

positions int[]

One-based occurrences, negative from the end, or empty for all

Returns

InnerTarget

The literal selector

Equals(object)

Compares operation selectors independently of occurrence positions

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

Remarks

Compares stored identities without resolving loaded modules. Registration validates live targets separately.

GetHashCode()

Returns the operation selector hash independently of occurrence positions

public override int GetHashCode()

Returns

int
Harmony 3 preview

For the stable release, read the 2.x documentation.