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
-
objectInnerTarget
Constructors
InnerTarget(ConstructorInfo, params int[])
Selects newobj instructions using the specified constructor
public InnerTarget(ConstructorInfo constructor, params int[] positions)
Parameters
constructorConstructorInfoThe selected instance constructor
positionsint[]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
fieldFieldInfoThe selected field, optionally on a generic type definition
kindInnerTargetKindFieldRead or FieldWrite
positionsint[]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
methodMethodInfoThe selected method
positionsint[]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
propertyPropertyInfoThe selected property
kindInnerTargetKindGetter or Setter
positionsint[]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
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
valueobjectA non-null string, int, long, float, or double
positionsint[]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
objobject
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