Skip to Main Content

BTD_Mod_Helper​.Api​.MoreAccessTools


BloonsTD6 Mod Helper

BTD_Mod_Helper.Api

MoreAccessTools Class

Further methods along the lines of Harmony's HarmonyLib.AccessTools

public static class MoreAccessTools

Inheritance System.Object  MoreAccessTools

Methods

MoreAccessTools.SafeGetNestedClassMethod(Type, string, string, int) Method

Safely gets the MethodInfo for a method within a nested class. This is recommended to use because over
directly targeting it with typeof and nameof because the nested class names can change randomly.

public static System.Reflection.MethodInfo SafeGetNestedClassMethod(System.Type outerType, string nestedTypeName, string methodName="MoveNext", int index=0);

Parameters

outerType System.Type

The outer type whose name won't change

nestedTypeName System.String

The name of nested type, not including the _s

methodName System.String

The desired method name within the nested type

index System.Int32

If multiple nested classes share a name portion, use the one at this index, default 0

Returns

System.Reflection.MethodInfo
The MethodInfo, or null alongside a console warning if one couldn't be found

MoreAccessTools.TryGetNestedClassMethod(Type, string, string, MethodInfo, int) Method

Safely gets the MethodInfo for a method within a nested class. This is recommended to use because over
directly targeting it with typeof and nameof because the nested class names can change randomly.

public static bool TryGetNestedClassMethod(System.Type outerType, string nestedClassName, string methodName, out System.Reflection.MethodInfo method, int index=0);

Parameters

outerType System.Type

The outer type whose name won't change

nestedClassName System.String

methodName System.String

The desired method name within the nested type

method System.Reflection.MethodInfo

index System.Int32

If multiple nested classes share a name portion, use the one at this index, default 0

Returns

System.Boolean
The MethodInfo, or null alongside a console warning if one couldn't be found

To learn how to download BTD Mod Helper and install mods, click here