INNER CODE UNIT · Kotlin
IHook
NexAlloy/NexAlloy · app/src/main/java/io/github/nexalloy/PatchExecutor.kt:59
abstract class IHook(val xposed: XposedInterface) : XposedInterface by xposed {
abstract val classLoader: ClassLoader
fun DexMethod.hookMethod(callback: XC_MethodHook) {
toMember().hookMethod(callback)
}
fun DexMethod.hookMethod(block: HookDsl<IHookCallback>.() -> Unit) {
toMember().hookMethod(block)
}
fun DexClass.toClass() = getInstance(classLoader)
fun DexMethod.toMethod(): Method {
var clz = classLoader.loadClass(className)
do {
return XposedHelpers.findMethodExactIfExists(clz, name, *paramTypeNames.toTypedArray())
?: continue
} while (clz.superclass.also { clz = it } != null)