diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/YukiHookAPI.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/YukiHookAPI.md new file mode 100644 index 00000000..c3c7d9b8 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/YukiHookAPI.md @@ -0,0 +1,595 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# YukiHookAPI - object + +```kotlin:no-line-numbers +object YukiHookAPI +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 这是 `YukiHookAPI` 的 API 调用总类,Hook 相关功能的开始、Hook 相关功能的配置都在这里。 + +## API_VERSION_NAME - field + +```kotlin:no-line-numbers +const val API_VERSION_NAME: String +``` + +**Change Records** + +`v1.0.4` `added` + +**Function Illustrate** + +> 获取当前 `YukiHookAPI` 的版本。 + +## API_VERSION_CODE - field + +```kotlin:no-line-numbers +const val API_VERSION_CODE: Int +``` + +**Change Records** + +`v1.0.4` `added` + +**Function Illustrate** + +> 获取当前 `YukiHookAPI` 的版本号。 + +

executorName - field

+ +**Change Records** + +`v1.0.5` `added` + +`v1.0.91` `removed` + +请转移到 `Status.executorName` + +

executorVersion - field

+ +**Change Records** + +`v1.0.5` `added` + +`v1.0.91` `removed` + +请转移到 `Status.executorVersion` + +## Status - object + +```kotlin:no-line-numbers +object Status +``` + +**Change Records** + +`v1.0.91` `added` + +**Function Illustrate** + +> 当前 `YukiHookAPI` 的状态。 + +### compiledTimestamp - field + +```kotlin:no-line-numbers +val compiledTimestamp: Long +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获取项目编译完成的时间戳 (当前本地时间)。 + +### isXposedEnvironment - field + +```kotlin:no-line-numbers +val isXposedEnvironment: Boolean +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获取当前是否为 (Xposed) 宿主环境。 + +### executorName - field + +```kotlin:no-line-numbers +val executorName: String +``` + +**Change Records** + +`v1.0.91` `added` + +**Function Illustrate** + +> 获取当前 Hook 框架的名称。 + +无法获取会返回 `unknown`,`XposedBridge` 不存在会返回 `invalid`。 + +::: warning + +在模块环境中需要启用 **Configs.isEnableHookModuleStatus**。 + +::: + +### executorVersion - field + +```kotlin:no-line-numbers +val executorVersion: Int +``` + +**Change Records** + +`v1.0.91` `added` + +**Function Illustrate** + +> 获取当前 Hook 框架的版本。 + +无法获取会返回 `-1`。 + +::: warning + +在模块环境中需要启用 **Configs.isEnableHookModuleStatus**。 + +::: + +### isModuleActive - field + +```kotlin:no-line-numbers +val isModuleActive: Boolean +``` + +**Change Records** + +`v1.0.91` `added` + +**Function Illustrate** + +> 判断模块是否在 Xposed 或太极、无极中激活。 + +::: warning + +在模块环境中你需要将 **Application** 继承于 **ModuleApplication**。 + +在模块环境中需要启用 **Configs.isEnableHookModuleStatus**。 + +在 (Xposed) 宿主环境中仅返回非 **isTaiChiModuleActive** 的激活状态。 + +::: + +### isXposedModuleActive - field + +```kotlin:no-line-numbers +val isXposedModuleActive: Boolean +``` + +**Change Records** + +`v1.0.91` `added` + +**Function Illustrate** + +> 仅判断模块是否在 Xposed 中激活。 + +::: warning + +在模块环境中需要启用 **Configs.isEnableHookModuleStatus**。 + +在 (Xposed) 宿主环境中始终返回 true。 + +::: + +### isTaiChiModuleActive - field + +```kotlin:no-line-numbers +val isTaiChiModuleActive: Boolean +``` + +**Change Records** + +`v1.0.91` `added` + +**Function Illustrate** + +> 仅判断模块是否在太极、无极中激活。 + +::: warning + +在模块环境中你需要将 **Application** 继承于 **ModuleApplication**。 + +在 (Xposed) 宿主环境中始终返回 false。 + +::: + +### isSupportResourcesHook - field + +```kotlin:no-line-numbers +val isSupportResourcesHook: Boolean +``` + +**Change Records** + +`v1.0.91` `added` + +**Function Illustrate** + +> 判断当前 Hook Framework 是否支持资源钩子(Resources Hook)。 + +::: warning + +在模块环境中需要启用 **Configs.isEnableHookModuleStatus**。 + +在 (Xposed) 宿主环境中可能会延迟等待事件回调后才会返回 true。 + +请注意你需要确保 **InjectYukiHookWithXposed.isUsingResourcesHook** 已启用,否则始终返回 false。 + +::: + +## Configs - object + +```kotlin:no-line-numbers +object Configs +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 对 API 相关功能的配置类。 + +### debugLog - method + +```kotlin:no-line-numbers +inline fun debugLog(initiate: YukiHookLogger.Configs.() -> Unit) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 配置 `YukiHookLogger.Configs` 相关参数。 + +

debugTag - field

+ +**Change Records** + +`v1.0` `first` + +`v1.1.0` `deprecated` + +请转移到 `YukiHookLogger.Configs.tag` + +### isDebug - field + +```kotlin:no-line-numbers +var isDebug: Boolean +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 是否启用 DEBUG 模式。 + +默认为开启状态,开启后模块将会向 `Logcat` 和 `XposedBridge.log` 打印详细的 Hook 日志,关闭后仅会打印 `E` 级别的日志。 + +

isAllowPrintingLogs - field

+ +**Change Records** + +`v1.0.4` `added` + +`v1.1.0` `deprecated` + +请转移到 `YukiHookLogger.Configs.isEnable` + +### isEnableModulePrefsCache - field + +```kotlin:no-line-numbers +var isEnableModulePrefsCache: Boolean +``` + +**Change Records** + +`v1.0.5` `added` + +**Function Illustrate** + +> 是否启用 `YukiHookModulePrefs` 的键值缓存功能。 + +为防止内存复用过高问题,此功能默认启用。 + +你可以手动在 `YukiHookModulePrefs` 中自由开启和关闭缓存功能以及清除缓存。 + +### isEnableModuleAppResourcesCache - field + +```kotlin:no-line-numbers +var isEnableModuleAppResourcesCache: Boolean +``` + +**Change Records** + +`v1.0.87` `added` + +**Function Illustrate** + +> 是否启用当前 Xposed 模块自身 `Resources` 缓存功能。 + +为防止内存复用过高问题,此功能默认启用。 + +你可以手动调用 `PackageParam.refreshModuleAppResources` 来刷新缓存。 + +::: warning + +关闭后每次使用 **PackageParam.moduleAppResources** 都会重新创建,可能会造成运行缓慢。 + +::: + +### isEnableHookModuleStatus - field + +```kotlin:no-line-numbers +var isEnableHookModuleStatus: Boolean +``` + +**Change Records** + +`v1.0.88` `added` + +**Function Illustrate** + +> 是否启用 Hook Xposed 模块激活等状态功能. + +为原生支持 Xposed 模块激活状态检测,此功能默认启用。 + +::: warning + +关闭后你将不能再在模块环境中使用 **YukiHookAPI.Status** 中的激活状态判断功能。 + +::: + +### isEnableHookSharedPreferences - field + +```kotlin:no-line-numbers +var isEnableHookSharedPreferences: Boolean +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 是否启用 Hook `SharedPreferences`。 + +启用后将在模块启动时强制将 `SharedPreferences` 文件权限调整为 `Context.MODE_WORLD_READABLE` (0664)。 + +::: warning + +这是一个可选的实验性功能,此功能默认不启用。 + +仅用于修复某些系统可能会出现在启用了 **New XSharedPreferences** 后依然出现文件权限错误问题,若你能正常使用 **YukiHookModulePrefs** 就不建议启用此功能。 + +::: + +### isEnableDataChannel - field + +```kotlin:no-line-numbers +var isEnableDataChannel: Boolean +``` + +**Change Records** + +`v1.0.88` `added` + +**Function Illustrate** + +> 是否启用当前 Xposed 模块与宿主交互的 `YukiHookDataChannel` 功能。 + +请确保 Xposed 模块的 `Application` 继承于 `ModuleApplication` 才能有效。 + +此功能默认启用,关闭后将不会在功能初始化的时候装载 `YukiHookDataChannel`。 + +### isEnableMemberCache - field + +```kotlin:no-line-numbers +var isEnableMemberCache: Boolean +``` + +**Change Records** + +`v1.0.68` `added` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 是否启用 `Member` 缓存功能。 + +为防止 `Member` 复用过高造成的系统 GC 问题,此功能默认启用。 + +启用后会缓存已经找到的 `Method`、`Constructor`、`Field`。 + +缓存的 `Member` 都将处于 `MemberCacheStore` 的全局静态实例中。 + +推荐使用 `MethodFinder`、`ConstructorFinder`、`FieldFinder` 来获取 `Member`。 + +除非缓存的 `Member` 发生了混淆的问题,例如使用 R8 混淆后的 APP 的目标 `Member`,否则建议启用。 + +## configs - method + +```kotlin:no-line-numbers +inline fun configs(initiate: Configs.() -> Unit) +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 对 `Configs` 类实现了一个 `lambda` 方法体。 + +你可以轻松的调用它进行配置。 + +**Function Example** + +你可以在 `HookEntryClass` 的 `onInit` 方法中调用 `configs` 方法和 `debugLog` 方法完成对 API 的功能配置,实时生效。 + +> The following example + +```kotlin +class HookEntryClass : IYukiHookXposedInit { + + override fun onInit() { + YukiHookAPI.configs { + debugLog { + tag = "YukiHookAPI" + isEnable = true + isRecord = false + elements(TAG, PRIORITY, PACKAGE_NAME, USER_ID) + } + isDebug = BuildConfig.DEBUG + isEnableModulePrefsCache = true + isEnableModuleAppResourcesCache = true + isEnableHookModuleStatus = true + isEnableHookSharedPreferences = false + isEnableDataChannel = true + isEnableMemberCache = true + } + } + + override fun onHook() { + // Your code here. + } +} +``` + +若觉得上面的写法不美观,你还可以写得更加简洁。 + +> The following example + +```kotlin +class HookEntryClass : IYukiHookXposedInit { + + override fun onInit() = configs { + debugLog { + tag = "YukiHookAPI" + isEnable = true + isRecord = false + elements(TAG, PRIORITY, PACKAGE_NAME, USER_ID) + } + isDebug = BuildConfig.DEBUG + isEnableModulePrefsCache = true + isEnableModuleAppResourcesCache = true + isEnableHookModuleStatus = true + isEnableHookSharedPreferences = false + isEnableDataChannel = true + isEnableMemberCache = true + } + + override fun onHook() { + // Your code here. + } +} +``` + +你也可以不通过 `configs` 和 `debugLog` 方法,直接进行配置。 + +> The following example + +```kotlin +class HookEntryClass : IYukiHookXposedInit { + + override fun onInit() { + YukiHookLogger.Configs.tag = "YukiHookAPI" + YukiHookLogger.Configs.isEnable = true + YukiHookLogger.Configs.isRecord = false + YukiHookLogger.Configs.elements( + YukiHookLogger.Configs.TAG, + YukiHookLogger.Configs.PRIORITY, + YukiHookLogger.Configs.PACKAGE_NAME, + YukiHookLogger.Configs.USER_ID + ) + YukiHookAPI.Configs.isDebug = BuildConfig.DEBUG + YukiHookAPI.Configs.isEnableModulePrefsCache = true + YukiHookAPI.Configs.isEnableModuleAppResourcesCache = true + YukiHookAPI.Configs.isEnableHookModuleStatus = true + YukiHookAPI.Configs.isEnableHookSharedPreferences = false + YukiHookAPI.Configs.isEnableDataChannel = true + YukiHookAPI.Configs.isEnableMemberCache = true + } + + override fun onHook() { + // Your code here. + } +} +``` + +## encase - method + +```kotlin:no-line-numbers +fun encase(initiate: PackageParam.() -> Unit) +``` + +```kotlin:no-line-numbers +fun encase(vararg hooker: YukiBaseHooker) +``` + +```kotlin:no-line-numbers +fun encase(baseContext: Context?, initiate: PackageParam.() -> Unit) +``` + +```kotlin:no-line-numbers +fun encase(baseContext: Context?, vararg hooker: YukiBaseHooker) +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 装载 Hook 入口的核心方法。 + +**Function Example** + +详情请参考 + +- [Created by lambda](../../../../../config/api-example#created-by-lambda) + +- [Created by Custom Hooker](../../../../../config/api-example#created-by-custom-hooker) + +- [Precautions when using as Hook API](../../../../../config/api-example#precautions-when-using-as-hook-api) \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/annotation/xposed/InjectYukiHookWithXposed.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/annotation/xposed/InjectYukiHookWithXposed.md new file mode 100644 index 00000000..0e6567e0 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/annotation/xposed/InjectYukiHookWithXposed.md @@ -0,0 +1,42 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# InjectYukiHookWithXposed - annotation + +```kotlin:no-line-numbers +annotation class InjectYukiHookWithXposed( + val sourcePath: String, + val modulePackageName: String, + val entryClassName: String, + val isUsingResourcesHook: Boolean +) +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.80` `modified` + +新增 `entryClassName` 参数 + +`v1.0.92` `modified` + +新增 `isUsingResourcesHook` 参数 + +**Function Illustrate** + +> 标识 `YukiHookAPI` 注入 Xposed 入口的类注解。 + +**Function Example** + +详情请参考 [InjectYukiHookWithXposed Annotation](../../../../../../../config/xposed-using#injectyukihookwithxposed-annotation)。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/CurrentClass.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/CurrentClass.md new file mode 100644 index 00000000..fcf802f2 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/CurrentClass.md @@ -0,0 +1,237 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# CurrentClass - class + +```kotlin:no-line-numbers +class CurrentClass internal constructor(internal val classSet: Class<*>, internal val instance: Any) +``` + +**Change Records** + +`v1.0.70` `added` + +`v1.1.0` `modified` + +调整了构造方法的参数名称 + +**Function Illustrate** + +> 当前实例的类操作对象。 + +## name - field + +```kotlin:no-line-numbers +val name: String +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获得当前 `classSet` 的 `Class.getName`。 + +## simpleName - field + +```kotlin:no-line-numbers +val simpleName: String +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获得当前 `classSet` 的 `Class.getSimpleName`。 + +## generic - method + +```kotlin:no-line-numbers +fun generic(): GenericClass? +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获得当前实例中的泛型父类。 + +如果当前实例不存在泛型将返回 `null`。 + +## generic - method + +```kotlin:no-line-numbers +inline fun generic(initiate: GenericClass.() -> Unit): GenericClass? +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获得当前实例中的泛型父类。 + +如果当前实例不存在泛型将返回 `null`。 + +## superClass - method + +```kotlin:no-line-numbers +fun superClass(): SuperClass +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 调用父类实例。 + +## field - method + +```kotlin:no-line-numbers +inline fun field(initiate: FieldConditions): FieldFinder.Result.Instance +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 调用当前实例中的变量。 + +## method - method + +```kotlin:no-line-numbers +inline fun method(initiate: MethodConditions): MethodFinder.Result.Instance +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 调用当前实例中的方法。 + +## SuperClass - class + +```kotlin:no-line-numbers +inner class SuperClass internal constructor(internal val superClassSet: Class<*>) +``` + +**Change Records** + +`v1.0.80` `added` + +`v1.1.0` `modified` + +新增 `superClassSet` 参数 + +**Function Illustrate** + +> 当前类的父类实例的类操作对象。 + +### name - field + +```kotlin:no-line-numbers +val name: String +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获得当前 `classSet` 中父类的 `Class.getName`。 + +### simpleName - field + +```kotlin:no-line-numbers +val simpleName: String +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获得当前 `classSet` 中父类的 `Class.getSimpleName`。 + +### generic - method + +```kotlin:no-line-numbers +fun generic(): GenericClass? +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获得当前实例父类中的泛型父类。 + +如果当前实例不存在泛型将返回 `null`。 + +### generic - method + +```kotlin:no-line-numbers +inline fun generic(initiate: GenericClass.() -> Unit): GenericClass? +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获得当前实例父类中的泛型父类。 + +如果当前实例不存在泛型将返回 `null`。 + +### field - method + +```kotlin:no-line-numbers +inline fun field(initiate: FieldConditions): FieldFinder.Result.Instance +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 调用父类实例中的变量。 + +### method - method + +```kotlin:no-line-numbers +inline fun method(initiate: MethodConditions): MethodFinder.Result.Instance +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 调用父类实例中的方法。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/GenericClass.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/GenericClass.md new file mode 100644 index 00000000..64bb9a40 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/GenericClass.md @@ -0,0 +1,39 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# GenericClass - class + +```kotlin:no-line-numbers +class GenericClass internal constructor(private val type: ParameterizedType) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 当前 `Class` 的泛型父类操作对象。 + +## argument - method + +```kotlin:no-line-numbers +fun argument(index: Int): Class<*> +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获得泛型参数数组下标的 `Class` 实例。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/HookClass.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/HookClass.md new file mode 100644 index 00000000..7a72a62c --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/HookClass.md @@ -0,0 +1,31 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# HookClass - class + +```kotlin:no-line-numbers +class HookClass internal constructor(internal var instance: Class<*>?, internal var name: String, internal var throwable: Throwable?) +``` + +**Change Records** + +`v1.0` `first` + +`v1.1.0` `modified` + +`HookClass` 相关功能不再对外开放 + +**Function Illustrate** + +> 创建一个当前 Hook 的 `Class` 接管类。 + +`instance` 为实例,`name` 为实例完整包名,`throwable` 为找不到实例的时候抛出的异常。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/HookResources.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/HookResources.md new file mode 100644 index 00000000..5084a406 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/HookResources.md @@ -0,0 +1,28 @@ +--- +next: + text: 特色功能 + link: /zh-cn/api/special-features/reflection +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# HookResources - class + +```kotlin:no-line-numbers +class HookResources internal constructor(var instance: YukiResources?) +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 创建一个当前 Hook 的 `YukiResources` 接管类。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/VariousClass.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/VariousClass.md new file mode 100644 index 00000000..6dbf1459 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/VariousClass.md @@ -0,0 +1,59 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# VariousClass - class + +```kotlin:no-line-numbers +class VariousClass(vararg var name: String) +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 这是一个不确定性 `Class` 类名装载器,通过 `name` 装载 `Class` 名称数组。 + +## get - method + +```kotlin:no-line-numbers +fun get(loader: ClassLoader? = null): Class<*> +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 获取匹配的实体类。 + +使用当前 `loader` 装载目标 `Class`。 + +## getOrNull - method + +```kotlin:no-line-numbers +fun getOrNull(loader: ClassLoader? = null): Class<*>? +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获取匹配的实体类。 + +使用当前 `loader` 装载目标 `Class`。 + +匹配不到 `Class` 会返回 `null`,不会抛出异常。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.md new file mode 100644 index 00000000..2c8d3a8f --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.md @@ -0,0 +1,1033 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# YukiMemberHookCreator - class + +```kotlin:no-line-numbers +class YukiMemberHookCreator(internal val packageParam: PackageParam, internal val hookClass: HookClass) +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.80` `modified` + +对 `hookClass` 进行 inline 处理 + +`v1.1.0` `modified` + +修正拼写错误的 **Creater** 命名到 **Creator** + +**Function Illustrate** + +> `YukiHookAPI` 的 `Member` 核心 Hook 实现类。 + +## PRIORITY_DEFAULT - field + +```kotlin:no-line-numbers +val PRIORITY_DEFAULT: Int +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 默认 Hook 回调优先级。 + +## PRIORITY_LOWEST - field + +```kotlin:no-line-numbers +val PRIORITY_LOWEST: Int +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 延迟回调 Hook 方法结果。 + +## PRIORITY_HIGHEST - field + +```kotlin:no-line-numbers +val PRIORITY_HIGHEST: Int +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 更快回调 Hook 方法结果。 + +## instanceClass - field + +```kotlin:no-line-numbers +val instanceClass: Class<*> +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.2` `modified` + +~~`thisClass`~~ 更名为 `instanceClass` + +**Function Illustrate** + +> 得到当前被 Hook 的 `Class`。 + +::: danger + +不推荐直接使用,万一得不到 **Class** 对象则会无法处理异常导致崩溃。 + +::: + +## injectMember - method + +```kotlin:no-line-numbers +inline fun injectMember(priority: Int, tag: String, initiate: MemberHookCreator.() -> Unit): MemberHookCreator.Result +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.80` `modified` + +将方法体进行 inline + +增加 `priority` Hook 优先级 + +**Function Illustrate** + +> 注入要 Hook 的 `Method`、`Constructor`。 + +**Function Example** + +你可以注入任意 `Method` 与 `Constructor`,使用 `injectMember` 即可创建一个 `Hook` 对象。 + +> The following example + +```kotlin +injectMember { + // Your code here. +} +``` + +你还可以自定义 `tag`,方便你在调试的时候能够区分你的 `Hook` 对象。 + +> The following example + +```kotlin +injectMember(tag = "KuriharaYuki") { + // Your code here. +} +``` + +你还可以自定义 `priority`,以控制当前 Hook 对象并列执行的优先级速度。 + +> The following example + +```kotlin +injectMember(priority = PRIORITY_HIGHEST) { + // Your code here. +} +``` + +## useDangerousOperation - method + +```kotlin:no-line-numbers +fun useDangerousOperation(option: String) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 允许 Hook 过程中的所有危险行为。 + +请在 `option` 中键入 `Yes do as I say!` 代表你同意允许所有危险行为。 + +你还需要在整个调用域中声明注解 `CauseProblemsApi` 以消除警告。 + +若你只需要 Hook `ClassLoader` 的 `loadClass` 方法,请参考 [ClassLoader.onLoadClass](../factory/ReflectionFactory#classloader-onloadclass-ext-method)。 + +::: danger + +若你不知道允许此功能会带来何种后果,请勿使用。 + +::: + +## MemberHookCreator - class + +```kotlin:no-line-numbers +inner class MemberHookCreator internal constructor(private val priority: Int, internal val tag: String) +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.80` `modified` + +增加 `priority` Hook 优先级 + +`v1.0.81` `modified` + +增加 `packageName` 当前 Hook 的 APP 包名 + +`v1.1.0` `modified` + +移除 `packageName` + +修正拼写错误的 **Creater** 命名到 **Creator** + +**Function Illustrate** + +> Hook 核心功能实现类,查找和处理需要 Hook 的 `Method`、`Constructor`。 + +

member - field

+ +**Change Records** + +`v1.0` `first` + +`v1.1.0` `removed` + +请转移到 `members` + +### members - method + +```kotlin:no-line-numbers +fun members(vararg member: Member?) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 手动指定要 Hook 的 `Method`、`Constructor`。 + +::: warning + +不建议使用此方法设置目标需要 Hook 的 **Member** 对象,你可以使用 **method** 或 **constructor** 方法。 + +::: + +**Function Example** + +你可以调用 `instanceClass` 来手动查找要 Hook 的 `Method`、`Constructor`。 + +> The following example + +```kotlin +injectMember { + members(instanceClass.getDeclaredMethod("test", StringType)) + beforeHook {} + afterHook {} +} +``` + +同样地,你也可以传入一组 `Member` 同时进行 Hook。 + +> The following example + +```kotlin +injectMember { + members( + instanceClass.getDeclaredMethod("test1", StringType), + instanceClass.getDeclaredMethod("test2", StringType), + instanceClass.getDeclaredMethod("test3", StringType) + ) + beforeHook {} + afterHook {} +} +``` + +

allMethods - method

+ +**Change Records** + +`v1.0` `first` + +`v1.1.0` `deprecated` + +请使用 `method { name = /** name */ }.all()` 来取代它 + +

allConstructors - method

+ +**Change Records** + +`v1.0` `first` + +`v1.1.0` `deprecated` + +请使用 `allMembers(MembersType.CONSTRUCTOR)` 来取代它 + +### allMembers - method + +```kotlin:no-line-numbers +fun allMembers(type: MembersType) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 查找并 Hook `hookClass` 中的全部 `Method`、`Constructor`。 + +::: warning + +无法准确处理每个 **Member** 的返回值和 **param**,建议使用 **method** or **constructor** 对每个 **Member** 单独 Hook。 + +::: + +### method - method + +```kotlin:no-line-numbers +inline fun method(initiate: MethodConditions): MethodFinder.Result +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 查找当前 `Class` 需要 Hook 的 `Method` 。 + +**Function Example** + +你可参考 [MethodFinder](finder/members/MethodFinder) 查看详细用法。 + +> The following example + +```kotlin +injectMember { + method { + name = "test" + param(StringType) + returnType = UnitType + } + beforeHook {} + afterHook {} +} +``` + +若想 Hook 当前查找 `method { ... }` 条件的全部结果,你只需要在最后加入 `all` 即可。 + +> The following example + +```kotlin +injectMember { + method { + name = "test" + paramCount(1..5) + }.all() + beforeHook {} + afterHook {} +} +``` + +此时 `beforeHook` 与 `afterHook` 会在每个查找到的结果中多次回调 Hook 方法体。 + +::: warning + +若没有 **all**,默认只会 Hook 当前条件查找到的数组下标结果第一位。 + +::: + +### constructor - method + +```kotlin:no-line-numbers +inline fun constructor(initiate: ConstructorConditions): ConstructorFinder.Result +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 查找当前 `Class` 需要 Hook 的 `Constructor`。 + +**Function Example** + +你可参考 [ConstructorFinder](finder/members/ConstructorFinder) 查看详细用法。 + +> The following example + +```kotlin +injectMember { + constructor { param(StringType) } + beforeHook {} + afterHook {} +} +``` + +若想 Hook 当前查找 `constructor { ... }` 条件的全部结果,你只需要在最后加入 `all` 即可。 + +> The following example + +```kotlin +injectMember { + constructor { paramCount(1..5) }.all() + beforeHook {} + afterHook {} +} +``` + +此时 `beforeHook` 与 `afterHook` 会在每个查找到的结果中多次回调 Hook 方法体。 + +::: warning + +若没有 **all**,默认只会 Hook 当前条件查找到的数组下标结果第一位。 + +::: + +### HookParam.field - i-ext-method + +```kotlin:no-line-numbers +inline fun HookParam.field(initiate: FieldConditions): FieldFinder.Result +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 使用当前 `hookClass` 查找并得到 `Field`。 + +**Function Example** + +你可参考 [FieldFinder](finder/members/FieldFinder) 查看详细用法。 + +> The following example + +```kotlin +injectMember { + method { + name = "test" + param(StringType) + returnType = UnitType + } + afterHook { + // 这里不需要再调用 instanceClass.field 进行查找 + field { + name = "isSweet" + type = BooleanType + }.get(instance).setTrue() + } +} +``` + +### HookParam.method - i-ext-method + +```kotlin:no-line-numbers +inline fun HookParam.method(initiate: MethodConditions): MethodFinder.Result +``` + +**Change Records** + +`v1.0.2` `first` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 使用当前 `hookClass` 查找并得到 `Method` 。 + +### HookParam.constructor - i-ext-method + +```kotlin:no-line-numbers +inline fun HookParam.constructor(initiate: ConstructorConditions): ConstructorFinder.Result +``` + +**Change Records** + +`v1.0.2` `first` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 使用当前 `hookClass` 查找并得到 `Constructor`。 + +### HookParam.injectMember - i-ext-method + +```kotlin:no-line-numbers +inline fun HookParam.injectMember(priority: Int, tag: String, initiate: MemberHookCreator.() -> Unit): MemberHookCreator.Result +``` + +**Change Records** + +`v1.0.88` `added` + +**Function Illustrate** + +> 注入要 Hook 的 `Method`、`Constructor` (嵌套 Hook)。 + +### beforeHook - method + +```kotlin:no-line-numbers +fun beforeHook(initiate: HookParam.() -> Unit): HookCallback +``` + +**Change Records** + +`v1.0` `first` + +`v1.1.0` `modified` + +新增 `HookCallback` 返回类型 + +**Function Illustrate** + +> 在 `Member` 执行完成前 Hook。 + +### afterHook - method + +```kotlin:no-line-numbers +fun afterHook(initiate: HookParam.() -> Unit): HookCallback +``` + +**Change Records** + +`v1.0` `first` + +`v1.1.0` `modified` + +新增 `HookCallback` 返回类型 + +**Function Illustrate** + +> 在 `Member` 执行完成后 Hook。 + +### replaceAny - method + +```kotlin:no-line-numbers +fun replaceAny(initiate: HookParam.() -> Any?) +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 拦截并替换此 `Member` 内容,给出返回值。 + +### replaceUnit - method + +```kotlin:no-line-numbers +fun replaceUnit(initiate: HookParam.() -> Unit) +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 拦截并替换此 `Member` 内容,没有返回值,可以称为 `Void`。 + +### replaceTo - method + +```kotlin:no-line-numbers +fun replaceTo(any: Any?) +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 拦截并替 `Member` 返回值。 + +### replaceToTrue - method + +```kotlin:no-line-numbers +fun replaceToTrue() +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 拦截并替换 `Member` 返回值为 `true`。 + +::: danger + +确保替换 **Member** 的返回对象为 **Boolean**。 + +::: + +### replaceToFalse - method + +```kotlin:no-line-numbers +fun replaceToFalse() +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 拦截并替换 `Member` 返回值为 `false`。 + +::: danger + +确保替换 **Member** 的返回对象为 **Boolean**。 + +::: + +### intercept - method + +```kotlin:no-line-numbers +fun intercept() +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 拦截此 `Member` 。 + +这将会禁止此 `Member` 执行并返回 `null`。 + +::: danger + +例如 **Int**、**Long**、**Boolean** 常量返回值的 **Member** 一旦被设置为 **null** 可能会造成 Hook APP 抛出异常。 + +::: + +### removeSelf - method + +```kotlin:no-line-numbers +fun removeSelf(result: (Boolean) -> Unit) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 移除当前注入的 Hook `Method`、`Constructor` (解除 Hook)。 + +::: danger + +你只能在 Hook 回调方法中使用此功能。 + +::: + +### HookCallback - class + +```kotlin:no-line-numbers +inner class HookCallback internal constructor() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> Hook 方法体回调实现类。 + +#### onFailureThrowToApp - method + +```kotlin:no-line-numbers +fun onFailureThrowToApp() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 当回调方法体内发生异常时将异常抛出给当前 Hook APP。 + +### Result - class + +```kotlin:no-line-numbers +inner class Result internal constructor() +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 监听 Hook 结果实现类。 + +#### result - method + +```kotlin:no-line-numbers +inline fun result(initiate: Result.() -> Unit): Result +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.5` `modified` + +~~`failures`~~ 修改为 `result` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 创建监听失败事件方法体。 + +**Function Example** + +你可以使用此方法为 `Result` 类创建 `lambda` 方法体。 + +> The following example + +```kotlin +injectMember { + // Your code here. +}.result { + onHooked {} + onAlreadyHooked {} + ignoredConductFailure() + onHookingFailure {} + // ... +} +``` + +#### by - method + +```kotlin:no-line-numbers +inline fun by(condition: () -> Boolean): Result +``` + +**Change Records** + +`v1.0.5` `added` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 添加执行 Hook 需要满足的条件,不满足条件将直接停止 Hook。 + +#### onHooked - method + +```kotlin:no-line-numbers +fun onHooked(result: (Member) -> Unit): Result +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 监听 `members` Hook 成功的回调方法。 + +在首次 Hook 成功后回调。 + +在重复 Hook 时会回调 `onAlreadyHooked`。 + +#### onAlreadyHooked - method + +```kotlin:no-line-numbers +fun onAlreadyHooked(result: (Member) -> Unit): Result +``` + +**Change Records** + +`v1.0.89` `added` + +**Function Illustrate** + +> 监听 `members` 重复 Hook 的回调方法。 + +::: warning + +同一个 **hookClass** 中的同一个 **members** 不会被 API 重复 Hook,若由于各种原因重复 Hook 会回调此方法。 + +::: + +#### onNoSuchMemberFailure - method + +```kotlin:no-line-numbers +fun onNoSuchMemberFailure(result: (Throwable) -> Unit): Result +``` + +**Change Records** + +`v1.0.5` `added` + +**Function Illustrate** + +> 监听 `members` 不存在发生错误的回调方法。 + +#### onConductFailure - method + +```kotlin:no-line-numbers +fun onConductFailure(result: (HookParam, Throwable) -> Unit): Result +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 监听 Hook 进行过程中发生错误的回调方法。 + +#### onHookingFailure - method + +```kotlin:no-line-numbers +fun onHookingFailure(result: (Throwable) -> Unit): Result +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 监听 Hook 开始时发生的错误的回调方法。 + +#### onAllFailure - method + +```kotlin:no-line-numbers +fun onAllFailure(result: (Throwable) -> Unit): Result +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 监听全部 Hook 过程发生错误的回调方法。 + +#### ignoredNoSuchMemberFailure - method + +```kotlin:no-line-numbers +fun ignoredNoSuchMemberFailure(): Result +``` + +**Change Records** + +`v1.0.5` `added` + +**Function Illustrate** + +> 忽略 `members` 不存在发生的错误。 + +#### ignoredConductFailure - method + +```kotlin:no-line-numbers +fun ignoredConductFailure(): Result +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 忽略 Hook 进行过程中发生的错误。 + +#### ignoredHookingFailure - method + +```kotlin:no-line-numbers +fun ignoredHookingFailure(): Result +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 忽略 Hook 开始时发生的错误。 + +#### ignoredAllFailure - method + +```kotlin:no-line-numbers +fun ignoredAllFailure(): Result +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 忽略全部 Hook 过程发生的错误。 + +#### remove - method + +```kotlin:no-line-numbers +fun remove(result: (Boolean) -> Unit) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 移除当前注入的 Hook `Method`、`Constructor` (解除 Hook)。 + +::: warning + +你只能在 Hook 成功后才能解除 Hook,可监听 **onHooked** 事件。 + +::: + +## Result - class + +```kotlin:no-line-numbers +inner class Result internal constructor() +``` + +**Change Records** + +`v1.0.3` `added` + +**Function Illustrate** + +> 监听全部 Hook 结果实现类。 + +### result - method + +```kotlin:no-line-numbers +inline fun result(initiate: Result.() -> Unit): Result +``` + +**Change Records** + +`v1.0.3` `added` + +`v1.0.5` `modified` + +~~`failures`~~ 修改为 `result` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 创建监听事件方法体。 + +### by - method + +```kotlin:no-line-numbers +inline fun by(condition: () -> Boolean): Result +``` + +**Change Records** + +`v1.0.5` `added` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 添加执行 Hook 需要满足的条件,不满足条件将直接停止 Hook。 + +### onPrepareHook - method + +```kotlin:no-line-numbers +fun onPrepareHook(callback: () -> Unit): Result +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 监听 `hookClass` 存在时准备开始 Hook 的操作。 + +### onHookClassNotFoundFailure - method + +```kotlin:no-line-numbers +fun onHookClassNotFoundFailure(result: (Throwable) -> Unit): Result +``` + +**Change Records** + +`v1.0.3` `added` + +**Function Illustrate** + +> 监听 `hookClass` 找不到时发生错误的回调方法。 + +### ignoredHookClassNotFoundFailure - method + +```kotlin:no-line-numbers +fun ignoredHookClassNotFoundFailure(): Result +``` + +**Change Records** + +`v1.0.3` `added` + +**Function Illustrate** + +> 忽略 `hookClass` 找不到时出现的错误。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/YukiResourcesHookCreator.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/YukiResourcesHookCreator.md new file mode 100644 index 00000000..831478a9 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/YukiResourcesHookCreator.md @@ -0,0 +1,617 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# YukiResourcesHookCreator - class + +```kotlin:no-line-numbers +class YukiResourcesHookCreator(internal val packageParam: PackageParam, internal val hookResources: HookResources) +``` + +**Change Records** + +`v1.0.80` `added` + +`v1.1.0` `modified` + +修正拼写错误的 **Creater** 命名到 **Creator** + +**Function Illustrate** + +> `YukiHookAPI` 的 `Resources` 核心 Hook 实现类。 + +## injectResource - method + +```kotlin:no-line-numbers +inline fun injectResource(tag: String, initiate: ResourceHookCreator.() -> Unit): ResourceHookCreator.Result +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 注入要 Hook 的 Resources。 + +**Function Example** + +你可以注入任意 Resources,使用 `injectResource` 即可创建一个 `Hook` 对象。 + +> The following example + +```kotlin +injectResource { + // Your code here. +} +``` + +你还可以自定义 `tag`,方便你在调试的时候能够区分你的 `Hook` 对象。 + +> The following example + +```kotlin +injectResource(tag = "KuriharaYuki") { + // Your code here. +} +``` + +## ResourcesHookCreator - class + +```kotlin:no-line-numbers +inner class ResourcesHookCreator internal constructor(private val tag: String) +``` + +**Change Records** + +`v1.0.80` `added` + +`v1.1.0` `modified` + +移除 `packageName` + +修正拼写错误的 **Creater** 命名到 **Creator** + +**Function Illustrate** + +> Hook 核心功能实现类。 + +查找和处理需要 Hook 的 Resources。 + +### resourceId - field + +```kotlin:no-line-numbers +var resourceId: Int +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 直接设置需要替换的 Resources Id。 + +::: warning + +不建议使用此方法设置目标需要 Hook 的 Resources Id,你可以使用 **conditions** 方法。 + +::: + +**Function Example** + +你可以直接设置并指定目标 Hook APP 的 Resources Id。 + +> The following example + +```kotlin +injectResource { + resourceId = 0x7f060001.toInt() + replaceTo(...) +} +``` + +### conditions - method + +```kotlin:no-line-numbers +inline fun conditions(initiate: ConditionFinder.() -> Unit) +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 设置 Resources 查找条件。 + +若你设置了 `resourceId` 则此方法将不会被使用。 + +**Function Example** + +你可参考 [ConditionFinder](#conditionfinder-class) 查看详细用法。 + +> The following example + +```kotlin +injectResource { + conditions { + name = "test_string" + string() + } + replaceTo(...) +} +``` + +### replaceTo - method + +```kotlin:no-line-numbers +fun replaceTo(any: Any) +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 替换指定 Resources 为指定的值。 + +**Function Example** + +你可以替换找到的 Resources 为你想要的值,可以是 `String`、`Drawable` 等。 + +比如我们要替换一个找到的字符串 Resources。 + +> The following example + +```kotlin +injectResource { + conditions { + name = "test_string" + string() + } + replaceTo("replace string") +} +``` + +或是替换为一个 `Drawable`,你无需对目标 Resources 实现 `fwd` 方法或 `DrawableLoader`。 + +> The following example + +```kotlin +injectResource { + conditions { + name = "test_drawable" + drawable() + } + replaceTo(ColorDrawable(Color.RED)) +} +``` + +### replaceToTrue - method + +```kotlin:no-line-numbers +fun replaceToTrue() +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 替换指定 Resources 为 `true`。 + +::: danger + +确保目标替换 Resources 的类型为 **Boolean**。 + +::: + +### replaceToFalse - method + +```kotlin:no-line-numbers +fun replaceToFalse() +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 替换指定 Resources 为 `false`。 + +::: danger + +确保目标替换 Resources 的类型为 **Boolean**。 + +::: + +### replaceToModuleResource - method + +```kotlin:no-line-numbers +fun replaceToModuleResource(resId: Int) +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 替换为当前 Xposed 模块的 Resources。 + +你可以直接使用模块的 `R.string.xxx`、`R.mipmap.xxx`、`R.drawable.xxx` 替换 Hook APP 的 Resources。 + +**Function Example** + +使用此方法可非常方便地使用当前模块的 Resources 去替换目标 Hook APP 的 Resources。 + +这个过程你无需对目标 Resources 实现 `fwd` 方法。 + +比如我们要替换一个字符串。 + +> The following example + +```kotlin +injectResource { + conditions { + name = "test_string" + string() + } + replaceToModuleResource(R.string.module_string) +} +``` + +还可以替换一些复杂的 Resources,比如 `xml` 创建的 `drawable`。 + +> The following example + +```kotlin +injectResource { + conditions { + name = "test_drawable" + drawable() + } + replaceToModuleResource(R.drawable.module_drawable) +} +``` + +### injectAsLayout - method + +```kotlin:no-line-numbers +fun injectAsLayout(initiate: YukiResources.LayoutInflatedParam.() -> Unit) +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 作为装载的布局注入。 + +**Function Example** + +你可以直接注入一个布局监听并修改它的内部 `View`。 + +> The following example + +```kotlin +injectResource { + conditions { + name = "activity_main" + layout() + } + injectAsLayout { + findViewByIdentifier(name = "test_view")?.isVisible = false + findViewByIdentifier(name = "test_text_view")?.text = "Hook this" + } +} +``` + +你还可以通过 `currentView` 拿到 `Context`。 + +> The following example + +```kotlin +injectResource { + conditions { + name = "activity_main" + layout() + } + injectAsLayout { + Toast.makeText(currentView.context, "Hook this", Toast.LENGTH_SHORT).show() + } +} +``` + +### ConditionFinder - class + +```kotlin:no-line-numbers +inner class ConditionFinder internal constructor() +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> Resources 查找条件实现类。 + +#### name - field + +```kotlin:no-line-numbers +var name: String +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 设置 Resources 名称。 + +#### anim - method + +```kotlin:no-line-numbers +fun anim() +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 设置 Resources 类型为动画。 + +#### animator - method + +```kotlin:no-line-numbers +fun animator() +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 设置 Resources 类型为属性动画。 + +#### bool - method + +```kotlin:no-line-numbers +fun bool() +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 设置 Resources 类型为布朗(Boolean)。 + +#### color - method + +```kotlin:no-line-numbers +fun color() +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 设置 Resources 类型为颜色(Color)。 + +#### dimen - method + +```kotlin:no-line-numbers +fun dimen() +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 设置 Resources 类型为尺寸(Dimention)。 + +#### drawable - method + +```kotlin:no-line-numbers +fun drawable() +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 设置 Resources 类型为 Drawable。 + +#### integer - method + +```kotlin:no-line-numbers +fun integer() +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 设置 Resources 类型为整型(Integer)。 + +#### layout - method + +```kotlin:no-line-numbers +fun layout() +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 设置 Resources 类型为布局(Layout)。 + +#### plurals - method + +```kotlin:no-line-numbers +fun plurals() +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 设置 Resources 类型为 Plurals。 + +#### string - method + +```kotlin:no-line-numbers +fun string() +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 设置 Resources 类型为字符串(String)。 + +#### xml - method + +```kotlin:no-line-numbers +fun xml() +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 设置 Resources 类型为 Xml。 + +#### mipmap - method + +```kotlin:no-line-numbers +fun mipmap() +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 设置 Resources 类型为位图(Mipmap)。 + +#### array - method + +```kotlin:no-line-numbers +fun array() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 Resources 类型为数组(Array)。 + +### Result - class + +```kotlin:no-line-numbers +inner class Result internal constructor() +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 监听全部 Hook 结果实现类,可在这里处理失败事件监听。 + +#### result - method + +```kotlin:no-line-numbers +inline fun result(initiate: Result.() -> Unit): Result +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 创建监听事件方法体。 + +#### by - method + +```kotlin:no-line-numbers +inline fun by(condition: () -> Boolean): Result +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 添加执行 Hook 需要满足的条件,不满足条件将直接停止 Hook。 + +### onHookingFailure - method + +```kotlin:no-line-numbers +fun onHookingFailure(result: (Throwable) -> Unit): Result +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 监听 Hook 过程发生错误的回调方法。 + +### ignoredHookingFailure - method + +```kotlin:no-line-numbers +fun ignoredHookingFailure(): Result +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 忽略 Hook 过程出现的错误。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/BaseFinder.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/BaseFinder.md new file mode 100644 index 00000000..3684ccb0 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/BaseFinder.md @@ -0,0 +1,131 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# BaseFinder - class + +```kotlin:no-line-numbers +abstract class BaseFinder +``` + +**Change Records** + +`v1.0.70` `added` + +`v1.1.0` `modified` + +分离原始命名 `BaseFinder` 中的部分方法与参数到 `MemberBaseFinder` + +**Function Illustrate** + +> 这是 `Class` 与 `Member` 查找类功能的基本类实现。 + +## BaseFinder.IndexTypeCondition - class + +```kotlin:no-line-numbers +inner class IndexTypeCondition internal constructor(private val type: IndexConfigType) +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 字节码下标筛选实现类。 + +### index - method + +```kotlin:no-line-numbers +fun index(num: Int) +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 设置下标。 + +若 `index` 小于零则为倒序,此时可以使用 `IndexTypeConditionSort.reverse` 方法实现。 + +可使用 `IndexTypeConditionSort.first` 和 `IndexTypeConditionSort.last` 设置首位和末位筛选条件。 + +### index - method + +```kotlin:no-line-numbers +fun index(): IndexTypeConditionSort +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 得到下标。 + +### IndexTypeConditionSort - class + +```kotlin:no-line-numbers +inner class IndexTypeConditionSort internal constructor() +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 字节码下标排序实现类。 + +#### first - method + +```kotlin:no-line-numbers +fun first() +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 设置满足条件的第一个。 + +#### last - method + +```kotlin:no-line-numbers +fun last() +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 设置满足条件的最后一个。 + +#### reverse - method + +```kotlin:no-line-numbers +fun reverse(num: Int) +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 设置倒序下标。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/CountRules.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/CountRules.md new file mode 100644 index 00000000..33850652 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/CountRules.md @@ -0,0 +1,83 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# CountRules - class + +```kotlin:no-line-numbers +class CountRules private constructor() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 这是一个模糊 `Class`、`Member` 数组 (下标) 个数条件实现类。 + +可对 R8 混淆后的 `Class`、`Member` 进行更加详细的定位。 + +## Int.isZero - i-ext-method + +```kotlin:no-line-numbers +fun Int.isZero(): Boolean +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 是否为 0。 + +## Int.moreThan - i-ext-method + +```kotlin:no-line-numbers +fun Int.moreThan(count: Int): Boolean +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 大于 `count`。 + +## Int.lessThan - i-ext-method + +```kotlin:no-line-numbers +fun Int.lessThan(count: Int): Boolean +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 小于 `count`。 + +## Int.inInterval - i-ext-method + +```kotlin:no-line-numbers +fun Int.inInterval(countRange: IntRange): Boolean +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 在 `countRange` 区间 A ≤ this ≤ B。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/ModifierRules.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/ModifierRules.md new file mode 100644 index 00000000..9d201070 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/ModifierRules.md @@ -0,0 +1,271 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# ModifierRules - class + +```kotlin:no-line-numbers +class ModifierRules private constructor() +``` + +**Change Records** + +`v1.0.67` `added` + +`v1.1.0` `modified` + +新增 `Class` 的描述符判断 + +作为 lambda 整体判断条件使用 + +移动到 base 包名 + +私有化构造方法 + +**Function Illustrate** + +> 这是一个 `Class`、`Member` 描述符条件实现类。 + +可对 R8 混淆后的 `Class`、`Member` 进行更加详细的定位。 + +## isPublic - i-ext-field + +```kotlin:no-line-numbers +val isPublic: Boolean +``` + +**Change Records** + +`v1.0.67` `added` + +`v1.1.0` `modified` + +统一合并到扩展方法并改名 + +**Function Illustrate** + +> `Class`、`Member` 类型是否包含 `public`。 + +## isPrivate - i-ext-field + +```kotlin:no-line-numbers +val isPrivate: Boolean +``` + +**Change Records** + +`v1.0.67` `added` + +`v1.1.0` `modified` + +统一合并到扩展方法并改名 + +**Function Illustrate** + +> `Class`、`Member` 类型是否包含 `private`。 + +## isProtected - i-ext-field + +```kotlin:no-line-numbers +val isProtected: Boolean +``` + +**Change Records** + +`v1.0.67` `added` + +`v1.1.0` `modified` + +统一合并到扩展方法并改名 + +**Function Illustrate** + +> `Class`、`Member` 类型是否包含 `protected`。 + +## isStatic - i-ext-field + +```kotlin:no-line-numbers +val isStatic: Boolean +``` + +**Change Records** + +`v1.0.67` `added` + +`v1.1.0` `modified` + +统一合并到扩展方法并改名 + +**Function Illustrate** + +> `Class`、`Member` 类型是否包含 `static`。 + +对于任意的静态 `Class`、`Member` 可添加此描述进行确定。 + +::: warning + +Kotlin → Jvm 后的 **object** 类中的方法并不是静态的。 + +::: + +## isFinal - i-ext-field + +```kotlin:no-line-numbers +val isFinal: Boolean +``` + +**Change Records** + +`v1.0.67` `added` + +`v1.1.0` `modified` + +统一合并到扩展方法并改名 + +**Function Illustrate** + +> `Class`、`Member` 类型是否包含 `final`。 + +::: warning + +Kotlin → Jvm 后没有 **open** 符号标识的 **Class**、**Member** 和没有任何关联的 **Class**、**Member** 都将为 **final**。 + +::: + +## isSynchronized - i-ext-field + +```kotlin:no-line-numbers +val isSynchronized: Boolean +``` + +**Change Records** + +`v1.0.67` `added` + +`v1.1.0` `modified` + +统一合并到扩展方法并改名 + +**Function Illustrate** + +> `Class`、`Member` 类型是否包含 `synchronized`。 + +## isVolatile - i-ext-field + +```kotlin:no-line-numbers +val isVolatile: Boolean +``` + +**Change Records** + +`v1.0.67` `added` + +`v1.1.0` `modified` + +统一合并到扩展方法并改名 + +**Function Illustrate** + +> `Field` 类型是否包含 `volatile`。 + +## isTransient - i-ext-field + +```kotlin:no-line-numbers +val isTransient: Boolean +``` + +**Change Records** + +`v1.0.67` `added` + +`v1.1.0` `modified` + +统一合并到扩展方法并改名 + +**Function Illustrate** + +> `Field` 类型是否包含 `transient`。 + +## isNative - i-ext-field + +```kotlin:no-line-numbers +val isNative: Boolean +``` + +**Change Records** + +`v1.0.67` `added` + +`v1.1.0` `modified` + +统一合并到扩展方法并改名 + +**Function Illustrate** + +> `Method` 类型是否包含 `native`。 + +对于任意 JNI 对接的 `Method` 可添加此描述进行确定。 + +## isInterface - i-ext-field + +```kotlin:no-line-numbers +val isInterface: Boolean +``` + +**Change Records** + +`v1.0.67` `added` + +`v1.1.0` `modified` + +统一合并到扩展方法并改名 + +**Function Illustrate** + +> `Class` 类型是否包含 `interface`。 + +## isAbstract - i-ext-field + +```kotlin:no-line-numbers +val isAbstract: Boolean +``` + +**Change Records** + +`v1.0.67` `added` + +`v1.1.0` `modified` + +统一合并到扩展方法并改名 + +**Function Illustrate** + +> `Class`、`Member` 类型是否包含 `abstract`。 + +对于任意的抽象 `Class`、`Member` 可添加此描述进行确定。 + +## isStrict - i-ext-field + +```kotlin:no-line-numbers +val isStrict: Boolean +``` + +**Change Records** + +`v1.0.67` `added` + +`v1.1.0` `modified` + +统一合并到扩展方法并改名 + +**Function Illustrate** + +> `Class`、`Member` 类型是否包含 `strictfp`。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/NameRules.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/NameRules.md new file mode 100644 index 00000000..c4fc1f3c --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/NameRules.md @@ -0,0 +1,167 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# NameRules - class + +```kotlin:no-line-numbers +class NameRules private constructor() +``` + +**Change Records** + +`v1.0.88` `added` + +`v1.1.0` `modified` + +`NameConditions` 更名为 `NameRules` + +作为 lambda 整体判断条件使用 + +移动到 base 包名 + +私有化构造方法 + +**Function Illustrate** + +> 这是一个模糊 `Class`、`Member` 名称条件实现类。 + +可对 R8 混淆后的 `Class`、`Member` 进行更加详细的定位。 + +## String.isSynthetic - i-ext-method + +```kotlin:no-line-numbers +fun String.isSynthetic(index: Int): Boolean +``` + +**Change Records** + +`v1.0.88` `added` + +`v1.1.0` `modified` + +统一合并到扩展方法并改名 + +**Function Illustrate** + +> 是否为匿名类的主类调用对象。 + +## String.isOnlySymbols - i-ext-method + +```kotlin:no-line-numbers +fun String.isOnlySymbols(): Boolean +``` + +**Change Records** + +`v1.0.88` `added` + +`v1.1.0` `modified` + +统一合并到扩展方法并改名 + +**Function Illustrate** + +> 是否只有符号。 + +## String.isOnlyLetters - i-ext-method + +```kotlin:no-line-numbers +fun String.isOnlyLetters(): Boolean +``` + +**Change Records** + +`v1.0.88` `added` + +`v1.1.0` `modified` + +统一合并到扩展方法并改名 + +**Function Illustrate** + +> 是否只有字母。 + +## String.isOnlyNumbers - i-ext-method + +```kotlin:no-line-numbers +fun String.isOnlyNumbers(): Boolean +``` + +**Change Records** + +`v1.0.88` `added` + +`v1.1.0` `modified` + +统一合并到扩展方法并改名 + +**Function Illustrate** + +> 是否只有数字。 + +## String.isOnlyLettersNumbers - i-ext-method + +```kotlin:no-line-numbers +fun String.isOnlyLettersNumbers(): Boolean +``` + +**Change Records** + +`v1.0.88` `added` + +`v1.1.0` `modified` + +统一合并到扩展方法并改名 + +**Function Illustrate** + +> 是否只有字母或数字。 + +## String.isOnlyLowercase - i-ext-method + +```kotlin:no-line-numbers +fun String.isOnlyLowercase(): Boolean +``` + +**Change Records** + +`v1.0.88` `added` + +`v1.1.0` `modified` + +统一合并到扩展方法并改名 + +**Function Illustrate** + +> 是否只有小写字母。 + +在没有其它条件的情况下设置此条件允许判断对象存在字母以外的字符。 + +## String.isOnlyUppercase - i-ext-method + +```kotlin:no-line-numbers +fun String.isOnlyUppercase(): Boolean +``` + +**Change Records** + +`v1.0.88` `added` + +`v1.1.0` `modified` + +统一合并到扩展方法并改名 + +**Function Illustrate** + +> 是否只有大写字母。 + +在没有其它条件的情况下设置此条件允许判断对象存在字母以外的字符。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.md new file mode 100644 index 00000000..58130e78 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.md @@ -0,0 +1,733 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# DexClassFinder - class + +```kotlin:no-line-numbers +class DexClassFinder internal constructor( + internal var name: String, + internal var async: Boolean, + override val loaderSet: ClassLoader? +) : ClassBaseFinder +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> `Class` 查找类。 + +可使用 `BaseDexClassLoader` 通过指定条件查找指定 `Class` 或一组 `Class`。 + +::: warning + +此功能尚在试验阶段,性能与稳定性可能仍然存在问题,使用过程遇到问题请向我们报告并帮助我们改进。 + +::: + +## companion object - object + +**Change Records** + +`v1.1.0` `added` + +### clearCache - method + +```kotlin:no-line-numbers +fun clearCache(context: Context?, versionName: String?, versionCode: Long?) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 清除当前 `DexClassFinder` 的 `Class` 缓存。 + +适用于全部通过 [ClassLoader.searchClass](../../../factory/ReflectionFactory#classloader-searchclass-ext-method) 或 [PackageParam.searchClass](../../../param/PackageParam#searchclass-method) 获取的 `DexClassFinder`。 + +## fullName - field + +```kotlin:no-line-numbers +var fullName: String +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 完整名称。 + +只会查找匹配到的 `Class.getName`。 + +例如 `com.demo.Test` 需要填写 `com.demo.Test`。 + +## simpleName - field + +```kotlin:no-line-numbers +var simpleName: String +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 简单名称。 + +只会查找匹配到的 `Class.getSimpleName`。 + +例如 `com.demo.Test` 只需要填写 `Test`。 + +对于匿名类例如 `com.demo.Test$InnerTest` 会为空,此时你可以使用 [singleName](#singlename-field)。 + +## singleName - field + +```kotlin:no-line-numbers +var singleName: String +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 独立名称。 + +设置后将首先使用 `Class.getSimpleName`,若为空则会使用 `Class.getName` 进行处理。 + +例如 `com.demo.Test` 只需要填写 `Test`。 + +对于匿名类例如 `com.demo.Test$InnerTest` 只需要填写 `Test$InnerTest`。 + +## from - method + +```kotlin:no-line-numbers +fun from(vararg name: String): FromPackageRules +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置在指定包名范围查找当前 `Class`。 + +设置后仅会在当前 `name` 开头匹配的包名路径下进行查找,可提升查找速度。 + +例如 ↓ + +`com.demo.test` + +`com.demo.test.demo` + +::: warning + +建议设置此参数指定查找范围,否则 **Class** 过多时将会非常慢。 + +::: + +## modifiers - method + +```kotlin:no-line-numbers +fun modifiers(conditions: ModifierConditions) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 标识符筛选条件。 + +可不设置筛选条件。 + +## fullName - method + +```kotlin:no-line-numbers +fun fullName(value: String): ClassNameRules +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 完整名称。 + +只会查找匹配到的 `Class.getName`。 + +例如 `com.demo.Test` 需要填写 `com.demo.Test`。 + +## simpleName - method + +```kotlin:no-line-numbers +fun simpleName(value: String): ClassNameRules +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 简单名称。 + +只会查找匹配到的 `Class.getSimpleName`。 + +例如 `com.demo.Test` 只需要填写 `Test`。 + +对于匿名类例如 `com.demo.Test$InnerTest 会为空`,此时你可以使用 [singleName](#singlename-method)。 + +## singleName - method + +```kotlin:no-line-numbers +fun singleName(value: String): ClassNameRules +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 独立名称。 + +设置后将首先使用 `Class.getSimpleName`,若为空则会使用 `Class.getName` 进行处理。 + +例如 `com.demo.Test` 只需要填写 `Test`。 + +对于匿名类例如 `com.demo.Test$InnerTest` 只需要填写 `Test$InnerTest`。 + +## fullName - method + +```kotlin:no-line-numbers +fun fullName(conditions: NameConditions) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 完整名称条件。 + +只会查找匹配到的 `Class.getName`。 + +## simpleName - method + +```kotlin:no-line-numbers +fun simpleName(conditions: NameConditions) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 简单名称条件。 + +只会查找匹配到的 `Class.getSimpleName`。 + +## singleName - method + +```kotlin:no-line-numbers +fun singleName(conditions: NameConditions) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 独立名称条件。 + +设置后将首先使用 `Class.getSimpleName`,若为空则会使用 `Class.getName` 进行处理。 + +## extends - method + +```kotlin:no-line-numbers +inline fun extends() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 继承的父类。 + +## extends - method + +```kotlin:no-line-numbers +fun extends(vararg name: String) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 继承的父类。 + +会同时查找 `name` 中所有匹配的父类。 + +## implements - method + +```kotlin:no-line-numbers +inline fun implements() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 实现的接口类。 + +## implements - method + +```kotlin:no-line-numbers +fun implements(vararg name: String) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 实现的接口类。 + +会同时查找 `name` 中所有匹配的接口类。 + +## anonymous - method + +```kotlin:no-line-numbers +fun anonymous() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 标识 `Class` 为匿名类。 + +例如 `com.demo.Test$1` 或 `com.demo.Test$InnerTest`。 + +标识后你可以使用 [enclosing](#enclosing-method) 来进一步指定匿名类的 (封闭类) 主类。 + +## noExtends - method + +```kotlin:no-line-numbers +fun noExtends() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 没有任何继承。 + +此时 `Class` 只应该继承于 `Any`。 + +::: warning + +设置此条件后 [extends](#extends-method) 将失效。 + +::: + +## noImplements - method + +```kotlin:no-line-numbers +fun noImplements() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 没有任何接口。 + +::: warning + +设置此条件后 [implements](#implements-method) 将失效。 + +::: + +## noSuper - method + +```kotlin:no-line-numbers +fun noSuper() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 没有任何继承与接口。 + +此时 `Class` 只应该继承于 `Any`。 + +::: warning + +设置此条件后 [extends](#extends-method) 与 [implements](#implements-method) 将失效。 + +::: + +## enclosing - method + +```kotlin:no-line-numbers +inline fun enclosing() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 匿名类的 (封闭类) 主类。 + +## enclosing - method + +```kotlin:no-line-numbers +fun enclosing(vararg name: String) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 匿名类的 (封闭类) 主类。 + +会同时查找 `name` 中所有匹配的 (封闭类) 主类。 + +## FromPackageRules - class + +```kotlin:no-line-numbers +inner class FromPackageRules internal constructor(private val packages: ArrayList) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 包名范围名称过滤匹配条件实现类。 + +### absolute - method + +```kotlin:no-line-numbers +fun absolute() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置包名绝对匹配。 + +例如有如下包名 ↓ + +`com.demo.test.a` + +`com.demo.test.a.b` + +`com.demo.test.active` + +若包名条件为 `com.demo.test.a` 则绝对匹配仅能匹配到第一个。 + +相反地,不设置以上示例会全部匹配。 + +## ClassNameRules - class + +```kotlin:no-line-numbers +inner class ClassNameRules internal constructor(private val name: ClassRulesData.NameRulesData) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 类名匹配条件实现类。 + +### optional - method + +```kotlin:no-line-numbers +fun optional() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置类名可选。 + +例如有如下类名 ↓ + +`com.demo.Test` **fullName** / `Test` **simpleName** + +`defpackage.a` **fullName** / `a` **simpleName** + +这两个类名都是同一个类,但是在有些版本中被混淆有些版本没有。 + +此时可设置类名为 `com.demo.Test` **fullName** / `Test` **simpleName**。 + +这样就可在完全匹配类名情况下使用类名而忽略其它查找条件,否则忽略此条件继续使用其它查找条件。 + +## member - method + +```kotlin:no-line-numbers +inline fun member(initiate: MemberRules.() -> Unit): MemberRulesResult +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 满足的 `Member` 条件。 + +## field - method + +```kotlin:no-line-numbers +inline fun field(initiate: FieldRules.() -> Unit): MemberRulesResult +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 满足的 `Field` 条件。 + +## method - method + +```kotlin:no-line-numbers +inline fun method(initiate: MethodRules.() -> Unit): MemberRulesResult +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 满足的 `Method` 条件。 + +## constructor - method + +```kotlin:no-line-numbers +inline fun constructor(initiate: ConstructorRules.() -> Unit): MemberRulesResult +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Class` 满足的 `Constructor` 条件。 + +## Result - class + +```kotlin:no-line-numbers +inner class Result internal constructor(internal var isNotFound: Boolean, internal var throwable: Throwable?) : BaseResult +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> `Class` 查找结果实现类。 + +### result - method + +```kotlin:no-line-numbers +inline fun result(initiate: Result.() -> Unit): Result +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 创建监听结果事件方法体。 + +### get - method + +```kotlin:no-line-numbers +fun get(): Class<*>? +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 得到 `Class` 本身。 + +若有多个 `Class` 结果只会返回第一个。 + +在查找条件找不到任何结果的时候将返回 `null`。 + +若你设置了 `async` 请使用 [wait](#wait-method) 方法。 + +### all - method + +```kotlin:no-line-numbers +fun all(): HashSet> +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 得到 `Class` 本身数组。 + +返回全部查找条件匹配的多个 `Class` 实例。 + +在查找条件找不到任何结果的时候将返回空的 `HashSet`。 + +若你设置了 `async` 请使用 [waitAll](#waitall-method) 方法。 + +### all - method + +```kotlin:no-line-numbers +fun all(result: (Class<*>) -> Unit): Result +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 得到 `Class` 本身数组 (依次遍历)。 + +回调全部查找条件匹配的多个 `Class` 实例。 + +在查找条件找不到任何结果的时候将不会执行。 + +若你设置了 `async` 请使用 [waitAll](#waitall-method) 方法。 + +### wait - method + +```kotlin:no-line-numbers +fun wait(result: (Class<*>?) -> Unit): Result +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 得到 `Class` 本身 (异步)。 + +若有多个 `Class` 结果只会回调第一个。 + +在查找条件找不到任何结果的时候将回调 null。 + +你需要设置 `async` 后此方法才会被回调,否则请使用 [get](#get-method) 方法。 + +### waitAll - method + +```kotlin:no-line-numbers +fun waitAll(result: (HashSet>) -> Unit): Result +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 得到 `Class` 本身数组 (异步)。 + +回调全部查找条件匹配的多个 `Class` 实例。 + +在查找条件找不到任何结果的时候将回调空的 `HashSet`。 + +你需要设置 `async` 后此方法才会被回调,否则请使用 [all](#all-method) 方法。 + +### onNoClassDefFoundError - method + +```kotlin:no-line-numbers +fun onNoClassDefFoundError(result: (Throwable) -> Unit): Result +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 监听找不到 `Class` 时。 + +### ignored - method + +```kotlin:no-line-numbers +fun ignored(): Result +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 忽略异常并停止打印任何错误日志。 + +此时若要监听异常结果,你需要手动实现 [onNoClassDefFoundError](#onnoclassdeffounderror-method) 方法。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/ConstructorRules.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/ConstructorRules.md new file mode 100644 index 00000000..47db110e --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/ConstructorRules.md @@ -0,0 +1,131 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# ConstructorRules - class + +```kotlin:no-line-numbers +class ConstructorRules internal constructor(internal val rulesData: ConstructorRulesData) : BaseRules +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> `Constructor` 查找条件实现类。 + +## paramCount - field + +```kotlin:no-line-numbers +var paramCount: Int +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Constructor` 参数个数。 + +你可以不使用 `param` 指定参数类型而是仅使用此变量指定参数个数。 + +若参数个数小于零则忽略并使用 `param`。 + +## modifiers - method + +```kotlin:no-line-numbers +fun modifiers(conditions: ModifierConditions) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Constructor` 标识符筛选条件。 + +可不设置筛选条件。 + +## emptyParam - method + +```kotlin:no-line-numbers +fun emptyParam() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Constructor` 空参数、无参数。 + +## param - method + +```kotlin:no-line-numbers +fun param(vararg paramType: Any) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Constructor` 参数。 + +如果同时使用了 `paramCount` 则 `paramType` 的数量必须与 `paramCount` 完全匹配。 + +如果 `Constructor` 中存在一些无意义又很长的类型,你可以使用 `VagueType` 来替代它。 + +::: danger + +无参 **Constructor** 请使用 **emptyParam** 设置查找条件。 + +有参 **Constructor** 必须使用此方法设定参数或使用 **paramCount** 指定个数。 + +::: + +## paramCount - method + +```kotlin:no-line-numbers +fun paramCount(numRange: IntRange) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Constructor` 参数个数范围。 + +你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数范围。 + +## paramCount - method + +```kotlin:no-line-numbers +fun paramCount(conditions: CountConditions) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Constructor` 参数个数条件。 + +你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数条件。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/FieldRules.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/FieldRules.md new file mode 100644 index 00000000..732ff6b6 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/FieldRules.md @@ -0,0 +1,85 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# FieldRules - class + +```kotlin:no-line-numbers +class FieldRules internal constructor(internal val rulesData: FieldRulesData) : BaseRules +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> `Field` 查找条件实现类。 + +## name - field + +```kotlin:no-line-numbers +var name: String +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Field` 名称。 + +## type - field + +```kotlin:no-line-numbers +var type: Any? +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Field` 类型。 + +可不填写类型。 + +## modifiers - method + +```kotlin:no-line-numbers +fun modifiers(conditions: ModifierConditions) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Field` 标识符筛选条件。 + +可不设置筛选条件。 + +## name - method + +```kotlin:no-line-numbers +fun name(conditions: NameConditions) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Field` 名称条件。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MemberRules.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MemberRules.md new file mode 100644 index 00000000..ac2afba2 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MemberRules.md @@ -0,0 +1,41 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# MemberRules - class + +```kotlin:no-line-numbers +class MemberRules internal constructor(internal val rulesData: MemberRulesData) : BaseRules +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> `Member` 查找条件实现类。 + +## modifiers - method + +```kotlin:no-line-numbers +fun modifiers(conditions: ModifierConditions) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Member` 标识符筛选条件。 + +可不设置筛选条件。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MethodRules.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MethodRules.md new file mode 100644 index 00000000..4c3ba057 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MethodRules.md @@ -0,0 +1,175 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# MethodRules - class + +```kotlin:no-line-numbers +class MethodRules internal constructor(internal val rulesData: MethodRulesData) : BaseRules +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> `Method` 查找条件实现类。 + +## name - field + +```kotlin:no-line-numbers +var name: String +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Method` 名称。 + +## paramCount - field + +```kotlin:no-line-numbers +var paramCount: Int +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Method` 参数个数。 + +你可以不使用 `param` 指定参数类型而是仅使用此变量指定参数个数。 + +若参数个数小于零则忽略并使用 `param`。 + +## returnType - field + +```kotlin:no-line-numbers +var returnType: Any? +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Method` 返回值。 + +可不填写返回值。 + +## modifiers - method + +```kotlin:no-line-numbers +fun modifiers(conditions: ModifierConditions) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Method` 标识符筛选条件。 + +可不设置筛选条件。 + +## emptyParam - method + +```kotlin:no-line-numbers +fun emptyParam() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Method` 空参数、无参数。 + +## param - method + +```kotlin:no-line-numbers +fun param(vararg paramType: Any) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Method` 参数。 + +如果同时使用了 `paramCount` 则 `paramType` 的数量必须与 `paramCount` 完全匹配。 + +如果 `Method` 中存在一些无意义又很长的类型,你可以使用 `VagueType` 来替代它。 + +::: danger + +无参 **Method** 请使用 **emptyParam** 设置查找条件。 + +有参 **Method** 必须使用此方法设定参数或使用 **paramCount** 指定个数。 + +::: + +## name - method + +```kotlin:no-line-numbers +fun name(conditions: NameConditions) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Method` 名称条件。 + +## paramCount - method + +```kotlin:no-line-numbers +fun paramCount(numRange: IntRange) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Method` 参数个数范围。 + +你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数范围。 + +## paramCount - method + +```kotlin:no-line-numbers +fun paramCount(conditions: CountConditions) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Method` 参数个数条件。 + +你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数条件。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/result/MemberRulesResult.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/result/MemberRulesResult.md new file mode 100644 index 00000000..1ae1e145 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/result/MemberRulesResult.md @@ -0,0 +1,81 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# MemberRulesResult - class + +```kotlin:no-line-numbers +class MemberRulesResult internal constructor(private val rulesData: MemberRulesData) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 当前 `Member` 查找条件结果实现类。 + +## none - method + +```kotlin:no-line-numbers +fun none(): MemberRulesResult +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置当前 `Member` 在查找条件中个数为 `0`。 + +## count - method + +```kotlin:no-line-numbers +fun count(num: Int): MemberRulesResult +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置当前 `Member` 在查找条件中需要全部匹配的个数。 + +## count - method + +```kotlin:no-line-numbers +fun count(numRange: IntRange): MemberRulesResult +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置当前 `Member` 在查找条件中需要全部匹配的个数范围。 + +## count - method + +```kotlin:no-line-numbers +fun count(conditions: CountConditions): MemberRulesResult +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置当前 `Member` 在查找条件中需要全部匹配的个数条件。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.md new file mode 100644 index 00000000..b97e5eca --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.md @@ -0,0 +1,764 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# ConstructorFinder - class + +```kotlin:no-line-numbers +class ConstructorFinder internal constructor(override val hookInstance: YukiMemberHookCreator.MemberHookCreator?, override val classSet: Class<*>) : MemberBaseFinder +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.2` `modified` + +合并到 `BaseFinder` + +`v1.1.0` `modified` + +合并到 `MemberBaseFinder` + +**Function Illustrate** + +> `Constructor` 查找类。 + +可通过指定类型查找指定 `Constructor` 或一组 `Constructor`。 + +## paramCount - field + +```kotlin:no-line-numbers +var paramCount: Int +``` + +**Change Records** + +`v1.0.67` `added` + +**Function Illustrate** + +> 设置 `Constructor` 参数个数。 + +你可以不使用 `param` 指定参数类型而是仅使用此变量指定参数个数。 + +若参数个数小于零则忽略并使用 `param`。 + +## modifiers - method + +```kotlin:no-line-numbers +fun modifiers(conditions: ModifierConditions): IndexTypeCondition +``` + +**Change Records** + +`v1.0.67` `added` + +`v1.0.80` `modified` + +将方法体进行 inline + +`v1.1.0` `modified` + +合并到 `ModifierConditions` + +**Function Illustrate** + +> 设置 `Constructor` 标识符筛选条件。 + +可不设置筛选条件,默认模糊查找并取第一个匹配的 `Constructor`。 + +::: danger + +存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。 + +::: + +## emptyParam - method + +```kotlin:no-line-numbers +fun emptyParam(): IndexTypeCondition +``` + +**Change Records** + +`v1.0.75` `added` + +**Function Illustrate** + +> 设置 `Constructor` 空参数、无参数。 + +## param - method + +```kotlin:no-line-numbers +fun param(vararg paramType: Any): IndexTypeCondition +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 设置 `Constructor` 参数。 + +如果同时使用了 `paramCount` 则 `paramType` 的数量必须与 `paramCount` 完全匹配。 + +如果 `Constructor` 中存在一些无意义又很长的类型,你可以使用 [VagueType](../../../type/defined/DefinedTypeFactory#vaguetype-field) 来替代它。 + +::: danger + +无参 **Constructor** 请使用 **emptyParam** 设置查找条件。 + +有参 **Constructor** 必须使用此方法设定参数或使用 **paramCount** 指定个数。 + +存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。 + +::: + +## paramCount - method + +```kotlin:no-line-numbers +fun paramCount(num: Int): IndexTypeCondition +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 设置 `Constructor` 参数个数。 + +你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数。 + +若参数个数小于零则忽略并使用 `param`。 + +::: danger + +存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。 + +::: + +## paramCount - method + +```kotlin:no-line-numbers +fun paramCount(numRange: IntRange): IndexTypeCondition +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Constructor` 参数个数范围。 + +你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数范围。 + +::: danger + +存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。 + +::: + +## paramCount - method + +```kotlin:no-line-numbers +fun paramCount(conditions: CountConditions): IndexTypeCondition +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Constructor` 参数个数条件。 + +你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数条件。 + +::: danger + +存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。 + +::: + +## superClass - method + +```kotlin:no-line-numbers +fun superClass(isOnlySuperClass: Boolean) +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 设置在 `classSet` 的所有父类中查找当前 `Constructor`。 + +::: warning + +若当前 **classSet** 的父类较多可能会耗时,API 会自动循环到父类继承是 **Any** 前的最后一个类。 + +::: + +## RemedyPlan - class + +```kotlin:no-line-numbers +inner class RemedyPlan internal constructor() +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> `Constructor` 重查找实现类,可累计失败次数直到查找成功。 + +### constructor - method + +```kotlin:no-line-numbers +inline fun constructor(initiate: ConstructorConditions) +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 创建需要重新查找的 `Constructor`。 + +你可以添加多个备选 `Constructor`,直到成功为止,若最后依然失败,将停止查找并输出错误日志。 + +### Result - class + +```kotlin:no-line-numbers +inner class Result internal constructor() +``` + +**Change Records** + +`v1.0.1` `added` + +**Function Illustrate** + +> `RemedyPlan` 结果实现类。 + +#### onFind - method + +```kotlin:no-line-numbers +fun onFind(initiate: HashSet>.() -> Unit) +``` + +**Change Records** + +`v1.0.1` `added` + +`v1.1.0` `modified` + +`initiate` 参数 `Constructor` 变为 `HashSet` + +**Function Illustrate** + +> 当在 `RemedyPlan` 中找到结果时。 + +**Function Example** + +你可以方便地对重查找的 `Constructor` 实现 `onFind` 方法。 + +> The following example + +```kotlin +constructor { + // Your code here. +}.onFind { + // Your code here. +} +``` + +## Process - class + +```kotlin:no-line-numbers +inner class Process internal constructor(internal val isNoSuch: Boolean, internal val throwable: Throwable?) : BaseResult +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> `Constructor` 查找结果处理类,为 `hookInstance` 提供。 + +### result - method + +```kotlin:no-line-numbers +inline fun result(initiate: Process.() -> Unit): Process +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 创建监听结果事件方法体。 + +**Function Example** + +你可以使用 `lambda` 形式创建 `Result` 类。 + +> The following example + +```kotlin +constructor { + // Your code here. +}.result { + all() + remedys {} + onNoSuchConstructor {} +} +``` + +### all - method + +```kotlin:no-line-numbers +fun all(): Process +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置全部查找条件匹配的多个 `Constructor` 实例结果到 `hookInstance`。 + +### remedys - method + +```kotlin:no-line-numbers +inline fun remedys(initiate: RemedyPlan.() -> Unit): Result +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 创建 `Constructor` 重查找功能。 + +**Function Example** + +当你遇到一种 `Constructor` 可能存在不同形式的存在时,可以使用 `RemedyPlan` 重新查找它,而没有必要使用 `onNoSuchConstructor` 捕获异常二次查找 `Constructor`。 + +若第一次查找失败了,你还可以在这里继续添加此方法体直到成功为止。 + +> The following example + +```kotlin +constructor { + // Your code here. +}.remedys { + constructor { + // Your code here. + } + constructor { + // Your code here. + } +} +``` + +### onNoSuchConstructor - method + +```kotlin:no-line-numbers +inline fun onNoSuchConstructor(result: (Throwable) -> Unit): Result +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 监听找不到 `Constructor` 时。 + +只会返回第一次的错误信息,不会返回 `RemedyPlan` 的错误信息。 + +## Result - class + +```kotlin:no-line-numbers +inner class Result internal constructor(internal val isNoSuch: Boolean, internal val throwable: Throwable?) : BaseResult +``` + +**Change Records** + +`v1.0` `first` + +`v1.1.0` `modified` + +继承到接口 `BaseResult` + +**Function Illustrate** + +> `Constructor` 查找结果实现类。 + +### result - method + +```kotlin:no-line-numbers +inline fun result(initiate: Result.() -> Unit): Result +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 创建监听结果事件方法体。 + +**Function Example** + +你可以使用 `lambda` 形式创建 `Result` 类。 + +> The following example + +```kotlin +constructor { + // Your code here. +}.result { + get().call() + all() + remedys {} + onNoSuchConstructor {} +} +``` + +### get - method + +```kotlin:no-line-numbers +fun get(): Instance +``` + +**Change Records** + +`v1.0.2` `added` + +**Function Illustrate** + +> 获得 `Constructor` 实例处理类。 + +若有多个 `Constructor` 结果只会返回第一个。 + +::: danger + +若你设置了 **remedys** 请使用 **wait** 回调结果方法。 + +::: + +**Function Example** + +你可以通过获得方法所在实例来执行构造方法创建新的实例对象。 + +> The following example + +```kotlin +constructor { + // Your code here. +}.get().call() +``` + +你可以 `cast` 构造方法为指定类型的实例对象。 + +> The following example + +```kotlin +constructor { + // Your code here. +}.get().newInstance() +``` + +::: danger + +若构造方法含有参数则后方参数必填。 + +::: + +> The following example + +```kotlin +constructor { + // Your code here. +}.get().newInstance("param1", "param2") +``` + +### all - method + +```kotlin:no-line-numbers +fun all(): ArrayList +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获得 `Constructor` 实例处理类数组。 + +返回全部查找条件匹配的多个 `Constructor` 实例结果。 + +**Function Example** + +你可以通过此方法来获得当前条件结果中匹配的全部 `Constructor`。 + +> The following example + +```kotlin +constructor { + // Your code here. +}.all().forEach { instance -> + instance.call(...) +} +``` + +### give - method + +```kotlin:no-line-numbers +fun give(): Constructor<*>? +``` + +**Change Records** + +`v1.0.67` `added` + +**Function Illustrate** + +> 得到 `Constructor` 本身。 + +若有多个 `Constructor` 结果只会返回第一个。 + +在查找条件找不到任何结果的时候将返回 `null`。 + +### giveAll - method + +```kotlin:no-line-numbers +fun giveAll(): HashSet> +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 得到 `Constructor` 本身数组。 + +返回全部查找条件匹配的多个 `Constructor` 实例。 + +在查找条件找不到任何结果的时候将返回空的 `HashSet`。 + +### wait - method + +```kotlin:no-line-numbers +fun wait(initiate: Instance.() -> Unit) +``` + +**Change Records** + +`v1.0.2` `added` + +**Function Illustrate** + +> 获得 `Constructor` 实例处理类,配合 `RemedyPlan` 使用。 + +若有多个 `Constructor` 结果只会返回第一个。 + +::: danger + +若你设置了 **remedys** 必须使用此方法才能获得结果。 + +若你没有设置 **remedys** 此方法将不会被回调。 + +::: + +### waitAll - method + +```kotlin:no-line-numbers +fun waitAll(initiate: ArrayList.() -> Unit) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获得 `Constructor` 实例处理类数组,配合 `RemedyPlan` 使用。 + +返回全部查找条件匹配的多个 `Constructor` 实例结果。 + +::: danger + +若你设置了 **remedys** 必须使用此方法才能获得结果。 + +若你没有设置 **remedys** 此方法将不会被回调。 + +::: + +### remedys - method + +```kotlin:no-line-numbers +inline fun remedys(initiate: RemedyPlan.() -> Unit): Result +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 创建 `Constructor` 重查找功能。 + +**Function Example** + +当你遇到一种 `Constructor` 可能存在不同形式的存在时,可以使用 `RemedyPlan` 重新查找它,而没有必要使用 `onNoSuchConstructor` 捕获异常二次查找 `Constructor`。 + +若第一次查找失败了,你还可以在这里继续添加此方法体直到成功为止。 + +> The following example + +```kotlin +constructor { + // Your code here. +}.remedys { + constructor { + // Your code here. + } + constructor { + // Your code here. + } +} +``` + +### onNoSuchConstructor - method + +```kotlin:no-line-numbers +inline fun onNoSuchConstructor(result: (Throwable) -> Unit): Result +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 监听找不到 `Constructor` 时。 + +只会返回第一次的错误信息,不会返回 `RemedyPlan` 的错误信息。 + +### ignored - method + +```kotlin:no-line-numbers +fun ignored(): Result +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 忽略异常并停止打印任何错误日志。 + +若 `isNotIgnoredHookingFailure` 为 `false` 则自动忽略。 + +::: warning + +此时若要监听异常结果,你需要手动实现 **onNoSuchConstructor** 方法。 + +::: + +

ignoredError - method

+ +**Change Records** + +`v1.0.3` `added` + +`v1.1.0` `deprecated` + +请转移到新方法 `ignored()` + +### Instance - class + +```kotlin:no-line-numbers +inner class Instance internal constructor(private val constructor: Constructor<*>?) +``` + +**Change Records** + +`v1.0.2` `added` + +`v1.1.0` `modified` + +新增 `constructor` 参数 + +**Function Illustrate** + +> `Constructor` 实例处理类。 + +#### call - method + +```kotlin:no-line-numbers +fun call(vararg param: Any?): Any? +``` + +**Change Records** + +`v1.0.2` `added` + +**Function Illustrate** + +> 执行 `Constructor` 创建目标实例,不指定目标实例类型。 + +#### newInstance - method + +```kotlin:no-line-numbers +fun newInstance(vararg param: Any?): T? +``` + +**Change Records** + +`v1.0.2` `added` + +**Function Illustrate** + +> 执行 `Constructor` 创建目标实例 ,指定 `T` 目标实例类型。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.md new file mode 100644 index 00000000..1ab8f3cf --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.md @@ -0,0 +1,927 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# FieldFinder - class + +```kotlin:no-line-numbers +class FieldFinder internal constructor(override val hookInstance: YukiMemberHookCreator.MemberHookCreator?, override val classSet: Class<*>?) : MemberBaseFinder +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.2` `modified` + +合并到 `BaseFinder` + +`v1.1.0` `modified` + +合并到 `MemberBaseFinder` + +**Function Illustrate** + +> `Field` 查找类。 + +可通过指定类型查找指定 `Field` 或一组 `Field`。 + +

classSet - field

+ +**Change Records** + +`v1.0` `first` + +`v1.0.2` `removed` + +## name - field + +```kotlin:no-line-numbers +var name: String +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.70` `modified` + +允许不填写名称 + +**Function Illustrate** + +> 设置 `Field` 名称。 + +::: danger + +若不填写名称则必须存在一个其它条件。 + +::: + +## type - field + +```kotlin:no-line-numbers +var type: Any? +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 设置 `Field` 类型。 + +可不填写类型。 + +## modifiers - method + +```kotlin:no-line-numbers +fun modifiers(conditions: ModifierConditions): IndexTypeCondition +``` + +**Change Records** + +`v1.0.67` `added` + +`v1.0.80` `modified` + +将方法体进行 inline + +`v1.1.0` `modified` + +合并到 `ModifierConditions` + +**Function Illustrate** + +> 设置 `Field` 标识符筛选条件。 + +可不设置筛选条件。 + +::: danger + +存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。 + +::: + +## order - method + +```kotlin:no-line-numbers +fun order(): IndexTypeCondition +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 顺序筛选字节码的下标。 + +## name - method + +```kotlin:no-line-numbers +fun name(value: String): IndexTypeCondition +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 设置 `Field` 名称。 + +::: danger + +若不填写名称则必须存在一个其它条件。 + +存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。 + +::: + +## name - method + +```kotlin:no-line-numbers +fun name(conditions: NameConditions): IndexTypeCondition +``` + +**Change Records** + +`v1.0.88` `added` + +`v1.1.0` `modified` + +合并到 `NameConditions` + +**Function Illustrate** + +> 设置 `Field` 名称条件。 + +::: danger + +若不填写名称则必须存在一个其它条件。 + +存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。 + +::: + +## type - method + +```kotlin:no-line-numbers +fun type(value: Any): IndexTypeCondition +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 设置 `Field` 类型。 + +::: danger + +可不填写类型。 + +存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。 + +::: + +## superClass - method + +```kotlin:no-line-numbers +fun superClass(isOnlySuperClass: Boolean) +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 设置在 `classSet` 的所有父类中查找当前 `Field`。 + +::: warning + +若当前 **classSet** 的父类较多可能会耗时,API 会自动循环到父类继承是 **Any** 前的最后一个类。 + +::: + +## RemedyPlan - class + +```kotlin:no-line-numbers +inner class RemedyPlan internal constructor() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> `Field` 重查找实现类,可累计失败次数直到查找成功。 + +### field - method + +```kotlin:no-line-numbers +inline fun field(initiate: FieldConditions): Result +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 创建需要重新查找的 `Field`。 + +你可以添加多个备选 `Field`,直到成功为止,若最后依然失败,将停止查找并输出错误日志。 + +### Result - class + +```kotlin:no-line-numbers +inner class Result internal constructor() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> `RemedyPlan` 结果实现类。 + +#### onFind - method + +```kotlin:no-line-numbers +fun onFind(initiate: HashSet.() -> Unit) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 当在 `RemedyPlan` 中找到结果时。 + +**Function Example** + +你可以方便地对重查找的 `Field` 实现 `onFind` 方法。 + +> The following example + +```kotlin +field { + // Your code here. +}.onFind { + // Your code here. +} +``` + +## Result - class + +```kotlin:no-line-numbers +inner class Result internal constructor(internal val isNoSuch: Boolean, private val throwable: Throwable?) : BaseResult +``` + +**Change Records** + +`v1.0` `first` + +`v1.1.0` `modified` + +继承到接口 `BaseResult` + +**Function Illustrate** + +> `Field` 查找结果实现类。 + +### result - method + +```kotlin:no-line-numbers +inline fun result(initiate: Result.() -> Unit): Result +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 创建监听结果事件方法体。 + +**Function Example** + +你可以使用 `lambda` 形式创建 `Result` 类。 + +> The following example + +```kotlin +field { + // Your code here. +}.result { + get(instance).set("something") + get(instance).string() + get(instance).cast() + get().boolean() + all(instance) + give() + giveAll() + onNoSuchField {} +} +``` + +### get - method + +```kotlin:no-line-numbers +fun get(instance: Any?): Instance +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 获得 `Field` 实例处理类。 + +若有多个 `Field` 结果只会返回第一个。 + +**Function Example** + +你可以轻松地得到 `Field` 的实例以及使用它进行设置实例。 + +> The following example + +```kotlin +field { + // Your code here. +}.get(instance).set("something") +``` + +如果你取到的是静态 `Field`,可以不需要设置实例。 + +> The following example + +```kotlin +field { + // Your code here. +}.get().set("something") +``` + +### all - method + +```kotlin:no-line-numbers +fun all(instance: Any?): ArrayList +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获得 `Field` 实例处理类数组。 + +返回全部查找条件匹配的多个 `Field` 实例结果。 + +**Function Example** + +你可以通过此方法来获得当前条件结果中匹配的全部 `Field`,其 `Field` 所在实例用法与 `get` 相同。 + +> The following example + +```kotlin +field { + // Your code here. +}.all(instance).forEach { instance -> + instance.self +} +``` + +### give - method + +```kotlin:no-line-numbers +fun give(): Field? +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 得到 `Field` 本身。 + +若有多个 Field 结果只会返回第一个。 + +在查找条件找不到任何结果的时候将返回 `null`。 + +### giveAll - method + +```kotlin:no-line-numbers +fun giveAll(): HashSet +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 得到 `Field` 本身数组。 + +返回全部查找条件匹配的多个 `Field` 实例。 + +在查找条件找不到任何结果的时候将返回空的 `HashSet`。 + +### wait - method + +```kotlin:no-line-numbers +fun wait(instance: Any?, initiate: Instance.() -> Unit) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获得 `Field` 实例处理类,配合 `RemedyPlan` 使用。 + +若有多个 `Field` 结果只会返回第一个。 + +::: danger + +若你设置了 **remedys** 必须使用此方法才能获得结果。 + +若你没有设置 **remedys** 此方法将不会被回调。 + +::: + +### waitAll - method + +```kotlin:no-line-numbers +fun waitAll(instance: Any?, initiate: ArrayList.() -> Unit) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获得 `Field` 实例处理类数组,配合 `RemedyPlan` 使用。 + +返回全部查找条件匹配的多个 `Field` 实例结果。 + +::: danger + +若你设置了 **remedys** 必须使用此方法才能获得结果。 + +若你没有设置 **remedys** 此方法将不会被回调。 + +::: + +### remedys - method + +```kotlin:no-line-numbers +inline fun remedys(initiate: RemedyPlan.() -> Unit): Result +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 创建 `Field` 重查找功能。 + +**Function Example** + +当你遇到一种 `Field` 可能存在不同形式的存在时,可以使用 `RemedyPlan` 重新查找它,而没有必要使用 `onNoSuchField` 捕获异常二次查找 `Field`。 + +若第一次查找失败了,你还可以在这里继续添加此方法体直到成功为止。 + +> The following example + +```kotlin +field { + // Your code here. +}.remedys { + field { + // Your code here. + } + field { + // Your code here. + } +} +``` + +### onNoSuchField - method + +```kotlin:no-line-numbers +fun onNoSuchField(result: (Throwable) -> Unit): Result +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 监听找不到 `Field` 时。 + +### ignored - method + +```kotlin:no-line-numbers +fun ignored(): Result +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 忽略异常并停止打印任何错误日志。 + +若 `isNotIgnoredHookingFailure` 为 `false` 则自动忽略。 + +::: warning + +此时若要监听异常结果,你需要手动实现 **onNoSuchField** 方法。 + +::: + +

ignoredError - method

+ +**Change Records** + +`v1.0.3` `added` + +`v1.1.0` `deprecated` + +请转移到新方法 `ignored()` + +### Instance - class + +```kotlin:no-line-numbers +inner class Instance internal constructor(private val instance: Any?, private val field: Field?) +``` + +**Change Records** + +`v1.0` `first` + +`v1.1.0` `modified` + +新增 `field` 参数 + +不再对外公开 `self` 参数 + +**Function Illustrate** + +> `Field` 实例变量处理类。 + +

self - field

+ +**Change Records** + +`v1.0` `first` + +`v1.1.0` `removed` + +请直接使用 `any` 方法得到 `Field` 自身的实例化对象 + +#### current - method + +```kotlin:no-line-numbers +fun current(ignored: Boolean): CurrentClass? +``` + +```kotlin:no-line-numbers +inline fun current(ignored: Boolean, initiate: CurrentClass.() -> Unit): Any? +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获得当前 `Field` 自身 `self` 实例的类操作对象 `CurrentClass`。 + +#### cast - method + +```kotlin:no-line-numbers +fun cast(): T? +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.68` `modified` + +修改 ~~`of`~~ 为 `cast` + +移动方法到 `Instance` + +**Function Illustrate** + +> 得到当前 `Field` 实例。 + +#### byte - method + +```kotlin:no-line-numbers +fun byte(): Byte? +``` + +**Change Records** + +`v1.0.68` `added` + +**Function Illustrate** + +> 得到当前 `Field` Byte 实例。 + +#### int - method + +```kotlin:no-line-numbers +fun int(): Int +``` + +**Change Records** + +`v1.0.65` `added` + +`v1.0.68` `modified` + +修改 ~~`ofInt`~~ 为 `int` + +移动方法到 `Instance` + +**Function Illustrate** + +> 得到当前 `Field` Int 实例。 + +#### long - method + +```kotlin:no-line-numbers +fun long(): Long +``` + +**Change Records** + +`v1.0.65` `added` + +`v1.0.68` `modified` + +修改 ~~`ofLong`~~ 为 `long` + +移动方法到 `Instance` + +**Function Illustrate** + +> 得到当前 `Field` Long 实例。 + +#### short - method + +```kotlin:no-line-numbers +fun short(): Short +``` +**Change Records** + +`v1.0.65` `added` + +`v1.0.68` `modified` + +修改 ~~`ofShort`~~ 为 `short` + +移动方法到 `Instance` + +**Function Illustrate** + +> 得到当前 `Field` Short 实例。 + +#### double - method + +```kotlin:no-line-numbers +fun double(): Double +``` + +**Change Records** + +`v1.0.65` `added` + +`v1.0.68` `modified` + +修改 ~~`ofDouble`~~ 为 `double` + +移动方法到 `Instance` + +**Function Illustrate** + +> 得到当前 `Field` Double 实例。 + +#### float - method + +```kotlin:no-line-numbers +fun float(): Float +``` +**Change Records** + +`v1.0.65` `added` + +`v1.0.68` `modified` + +修改 ~~`ofFloat`~~ 为 `float` + +移动方法到 `Instance` + +**Function Illustrate** + +> 得到当前 `Field` Float 实例。 + +#### string - method + +```kotlin:no-line-numbers +fun string(): String +``` + +**Change Records** + +`v1.0.65` `added` + +`v1.0.68` `modified` + +修改 ~~`ofString`~~ 为 `string` + +移动方法到 `Instance` + +**Function Illustrate** + +> 得到当前 `Field` String 实例。 + +#### char - method + +```kotlin:no-line-numbers +fun char(): Char +``` + +**Change Records** + +`v1.0.68` `added` + +**Function Illustrate** + +> 得到当前 `Field` Char 实例。 + +#### boolean - method + +```kotlin:no-line-numbers +fun boolean(): Boolean +``` + +**Change Records** + +`v1.0.65` `added` + +`v1.0.68` `modified` + +修改 ~~`ofBoolean`~~ 为 `boolean` + +移动方法到 `Instance` + +**Function Illustrate** + +> 得到当前 `Field` Boolean 实例。 + +#### any - method + +```kotlin:no-line-numbers +fun any(): Any? +``` +**Change Records** + +`v1.0.65` `added` + +`v1.0.68` `modified` + +修改 ~~`ofAny`~~ 为 `any` + +移动方法到 `Instance` + +**Function Illustrate** + +> 得到当前 `Field` Any 实例。 + +#### array - method + +```kotlin:no-line-numbers +inline fun array(): Array +``` + +**Change Records** + +`v1.0.68` `added` + +**Function Illustrate** + +> 得到当前 `Field` Array 实例。 + +#### list - method + +```kotlin:no-line-numbers +inline fun list(): List +``` + +**Change Records** + +`v1.0.68` `added` + +**Function Illustrate** + +> 得到当前 `Field` List 实例。 + +#### set - method + +```kotlin:no-line-numbers +fun set(any: Any?) +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 设置当前 `Field` 实例。 + +#### setTrue - method + +```kotlin:no-line-numbers +fun setTrue() +``` +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 设置当前 `Field` 实例为 `true`。 + +::: danger + +请确保实例对象类型为 **Boolean**。 + +::: + +#### setFalse - method + +```kotlin:no-line-numbers +fun setFalse() +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 设置当前 `Field` 实例为 `false`。 + +::: danger + +请确保实例对象类型为 **Boolean**。 + +::: + +#### setNull - method + +```kotlin:no-line-numbers +fun setNull() +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 设置当前 `Field` 实例为 `null`。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.md new file mode 100644 index 00000000..d9a354b3 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.md @@ -0,0 +1,1076 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# MethodFinder - class + +```kotlin:no-line-numbers +class MethodFinder internal constructor(override val hookInstance: YukiMemberHookCreator.MemberHookCreator?, override val classSet: Class<*>) : MemberBaseFinder +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.2` `modified` + +合并到 `BaseFinder` + +`v1.1.0` `modified` + +合并到 `MemberBaseFinder` + +**Function Illustrate** + +> `Method` 查找类。 + +可通过指定类型查找指定 `Method` 或一组 `Method`。 + +## name - field + +```kotlin:no-line-numbers +var name: String +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.70` `modified` + +允许不填写名称 + +**Function Illustrate** + +> 设置 `Method` 名称。 + +::: danger + +若不填写名称则必须存在一个其它条件。 + +::: + +## paramCount - field + +```kotlin:no-line-numbers +var paramCount: Int +``` + +**Change Records** + +`v1.0.67` `added` + +**Function Illustrate** + +> 设置 `Method` 参数个数。 + +你可以不使用 `param` 指定参数类型而是仅使用此变量指定参数个数。 + +若参数个数小于零则忽略并使用 `param`。 + +## returnType - field + +```kotlin:no-line-numbers +var returnType: Any? +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 设置 `Method` 返回值,可不填写返回值。 + +## modifiers - method + +```kotlin:no-line-numbers +fun modifiers(conditions: ModifierConditions): IndexTypeCondition +``` + +**Change Records** + +`v1.0.67` `added` + +`v1.0.80` `modified` + +将方法体进行 inline + +`v1.1.0` `modified` + +合并到 `ModifierConditions` + +**Function Illustrate** + +> 设置 `Method` 标识符筛选条件。 + +可不设置筛选条件。 + +::: danger + +存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。 + +::: + +## emptyParam - method + +```kotlin:no-line-numbers +fun emptyParam(): IndexTypeCondition +``` + +**Change Records** + +`v1.0.75` `added` + +**Function Illustrate** + +> 设置 `Method` 空参数、无参数。 + +## param - method + +```kotlin:no-line-numbers +fun param(vararg paramType: Any): IndexTypeCondition +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 设置 `Method` 参数。 + +如果同时使用了 `paramCount` 则 `paramType` 的数量必须与 `paramCount` 完全匹配。 + +如果 `Method` 中存在一些无意义又很长的类型,你可以使用 [VagueType](../../../type/defined/DefinedTypeFactory#vaguetype-field) 来替代它。 + +::: danger + +无参 **Method** 请使用 **emptyParam** 设置查找条件。 + +有参 **Method** 必须使用此方法设定参数或使用 **paramCount** 指定个数。 + +存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。 + +::: + +## order - method + +```kotlin:no-line-numbers +fun order(): IndexTypeCondition +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 顺序筛选字节码的下标。 + +## name - method + +```kotlin:no-line-numbers +fun name(value: String): IndexTypeCondition +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 设置 `Method` 名称。 + +::: danger + +若不填写名称则必须存在一个其它条件。 + +存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。 + +::: + +## name - method + +```kotlin:no-line-numbers +fun name(conditions: NameConditions): IndexTypeCondition +``` + +**Change Records** + +`v1.0.88` `added` + +`v1.1.0` `modified` + +合并到 `NameConditions` + +**Function Illustrate** + +> 设置 `Method` 名称条件。 + +::: danger + +若不填写名称则必须存在一个其它条件。 + +存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。 + +::: + +## paramCount - method + +```kotlin:no-line-numbers +fun paramCount(num: Int): IndexTypeCondition +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 设置 `Method` 参数个数。 + +你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数。 + +若参数个数小于零则忽略并使用 `param`。 + +::: danger + +存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。 + +::: + +## paramCount - method + +```kotlin:no-line-numbers +fun paramCount(numRange: IntRange): IndexTypeCondition +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Method` 参数个数范围。 + +你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数范围。 + +::: danger + +存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。 + +::: + +## paramCount - method + +```kotlin:no-line-numbers +fun paramCount(conditions: CountConditions): IndexTypeCondition +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置 `Method` 参数个数条件。 + +你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数条件。 + +::: danger + +存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。 + +::: + +## returnType - method + +```kotlin:no-line-numbers +fun returnType(value: Any): IndexTypeCondition +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 设置 `Method` 返回值。 + +可不填写返回值。 + +::: danger + +存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。 + +::: + +## superClass - method + +```kotlin:no-line-numbers +fun superClass(isOnlySuperClass: Boolean) +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 设置在 `classSet` 的所有父类中查找当前 `Method`。 + +::: warning + +若当前 **classSet** 的父类较多可能会耗时,API 会自动循环到父类继承是 **Any** 前的最后一个类。 + +::: + +## RemedyPlan - class + +```kotlin:no-line-numbers +inner class RemedyPlan internal constructor() +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> `Method` 重查找实现类,可累计失败次数直到查找成功。 + +### method - method + +```kotlin:no-line-numbers +inline fun method(initiate: MethodConditions): Result +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 创建需要重新查找的 `Method`。 + +你可以添加多个备选 `Method`,直到成功为止,若最后依然失败,将停止查找并输出错误日志。 + +### Result - class + +```kotlin:no-line-numbers +inner class Result internal constructor() +``` + +**Change Records** + +`v1.0.1` `added` + +**Function Illustrate** + +> `RemedyPlan` 结果实现类。 + +#### onFind - method + +```kotlin:no-line-numbers +fun onFind(initiate: HashSet.() -> Unit) +``` + +**Change Records** + +`v1.0.1` `added` + +`v1.1.0` `modified` + +`initiate` 参数 `Method` 变为 `HashSet` + +**Function Illustrate** + +> 当在 `RemedyPlan` 中找到结果时。 + +**Function Example** + +你可以方便地对重查找的 `Method` 实现 `onFind` 方法。 + +> The following example + +```kotlin +method { + // Your code here. +}.onFind { + // Your code here. +} +``` + +## Process - class + +```kotlin:no-line-numbers +inner class Process internal constructor(internal val isNoSuch: Boolean, internal val throwable: Throwable?) : BaseResult +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> `Method` 查找结果处理类,为 `hookInstance` 提供。 + +### result - method + +```kotlin:no-line-numbers +inline fun result(initiate: Process.() -> Unit): Process +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 创建监听结果事件方法体。 + +**Function Example** + +你可以使用 `lambda` 形式创建 `Result` 类。 + +> The following example + +```kotlin +method { + // Your code here. +}.result { + all() + remedys {} + onNoSuchMethod {} +} +``` + +### all - method + +```kotlin:no-line-numbers +fun all(): Process +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置全部查找条件匹配的多个 `Method` 实例结果到 `hookInstance`。 + +### remedys - method + +```kotlin:no-line-numbers +inline fun remedys(initiate: RemedyPlan.() -> Unit): Result +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 创建 `Method` 重查找功能。 + +**Function Example** + +当你遇到一种 `Method` 可能存在不同形式的存在时,可以使用 `RemedyPlan` 重新查找它,而没有必要使用 `onNoSuchMethod` 捕获异常二次查找 `Method`。 + +若第一次查找失败了,你还可以在这里继续添加此方法体直到成功为止。 + +> The following example + +```kotlin +method { + // Your code here. +}.remedys { + method { + // Your code here. + } + method { + // Your code here. + } +} +``` + +### onNoSuchMethod - method + +```kotlin:no-line-numbers +inline fun onNoSuchMethod(result: (Throwable) -> Unit): Result +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 监听找不到 `Method` 时。 + +只会返回第一次的错误信息,不会返回 `RemedyPlan` 的错误信息。 + +## Result - class + +```kotlin:no-line-numbers +inner class Result internal constructor(internal val isNoSuch: Boolean, private val throwable: Throwable?) : BaseResult +``` + +**Change Records** + +`v1.0` `first` + +`v1.1.0` `modified` + +继承到接口 `BaseResult` + +**Function Illustrate** + +> `Method` 查找结果实现类。 + +### result - method + +```kotlin:no-line-numbers +inline fun result(initiate: Result.() -> Unit): Result +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 创建监听结果事件方法体。 + +**Function Example** + +你可以使用 `lambda` 形式创建 `Result` 类。 + +> The following example + +```kotlin +method { + // Your code here. +}.result { + get(instance).call() + all(instance) + remedys {} + onNoSuchMethod {} +} +``` + +### get - method + +```kotlin:no-line-numbers +fun get(instance: Any?): Instance +``` + +**Change Records** + +`v1.0.2` `added` + +**Function Illustrate** + +> 获得 `Method` 实例处理类。 + +若有多个 `Method` 结果只会返回第一个。 + +::: danger + +若你设置了 **remedys** 请使用 **wait** 回调结果方法。 + +::: + +**Function Example** + +你可以通过获得方法所在实例来执行 `Method`。 + +> The following example + +```kotlin +method { + // Your code here. +}.get(instance).call() +``` + +若当前为静态方法,你可以不设置实例。 + +> The following example + +```kotlin +method { + // Your code here. +}.get().call() +``` + +### all - method + +```kotlin:no-line-numbers +fun all(instance: Any?): ArrayList +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获得 `Method` 实例处理类数组。 + +返回全部查找条件匹配的多个 `Method` 实例结果。 + +**Function Example** + +你可以通过此方法来获得当前条件结果中匹配的全部 `Method`,其方法所在实例用法与 `get` 相同。 + +> The following example + +```kotlin +method { + // Your code here. +}.all(instance).forEach { instance -> + instance.call(...) +} +``` + +### give - method + +```kotlin:no-line-numbers +fun give(): Method? +``` + +**Change Records** + +`v1.0.67` `added` + +**Function Illustrate** + +> 得到 `Method` 本身。 + +若有多个 `Method` 结果只会返回第一个。 + +在查找条件找不到任何结果的时候将返回 `null`。 + +### giveAll - method + +```kotlin:no-line-numbers +fun giveAll(): HashSet +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 得到 `Method` 本身数组。 + +返回全部查找条件匹配的多个 `Method` 实例。 + +在查找条件找不到任何结果的时候将返回空的 `HashSet`。 + +### wait - method + +```kotlin:no-line-numbers +fun wait(instance: Any?, initiate: Instance.() -> Unit) +``` + +**Change Records** + +`v1.0.2` `added` + +**Function Illustrate** + +> 获得 `Method` 实例处理类,配合 `RemedyPlan` 使用。 + +若有多个 `Method` 结果只会返回第一个。 + +::: danger + +若你设置了 **remedys** 必须使用此方法才能获得结果。 + +若你没有设置 **remedys** 此方法将不会被回调。 + +::: + +### waitAll - method + +```kotlin:no-line-numbers +fun waitAll(instance: Any?, initiate: ArrayList.() -> Unit) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获得 `Method` 实例处理类数组,配合 `RemedyPlan` 使用。 + +返回全部查找条件匹配的多个 `Method` 实例结果。 + +::: danger + +若你设置了 **remedys** 必须使用此方法才能获得结果。 + +若你没有设置 **remedys** 此方法将不会被回调。 + +::: + +### remedys - method + +```kotlin:no-line-numbers +inline fun remedys(initiate: RemedyPlan.() -> Unit): Result +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 创建 `Method` 重查找功能。 + +**Function Example** + +当你遇到一种 `Method` 可能存在不同形式的存在时,可以使用 `RemedyPlan` 重新查找它,而没有必要使用 `onNoSuchMethod` 捕获异常二次查找 `Method`。 + +若第一次查找失败了,你还可以在这里继续添加此方法体直到成功为止。 + +> The following example + +```kotlin +method { + // Your code here. +}.remedys { + method { + // Your code here. + } + method { + // Your code here. + } +} +``` + +### onNoSuchMethod - method + +```kotlin:no-line-numbers +inline fun onNoSuchMethod(result: (Throwable) -> Unit): Result +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 监听找不到 `Method` 时。 + +只会返回第一次的错误信息,不会返回 `RemedyPlan` 的错误信息。 + +### ignored - method + +```kotlin:no-line-numbers +fun ignored(): Result +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 忽略异常并停止打印任何错误日志。 + +若 `isNotIgnoredHookingFailure` 为 `false` 则自动忽略。 + +::: warning + +此时若要监听异常结果,你需要手动实现 **onNoSuchMethod** 方法。 + +::: + +

ignoredError - method

+ +**Change Records** + +`v1.0.3` `added` + +`v1.1.0` `deprecated` + +请转移到新方法 `ignored()` + +### Instance - class + +```kotlin:no-line-numbers +inner class Instance internal constructor(private val instance: Any?, private val method: Method?) +``` + +**Change Records** + +`v1.0.2` `added` + +`v1.1.0` `modified` + +新增 `method` 参数 + +**Function Illustrate** + +> `Method` 实例处理类。 + +#### original - method + +```kotlin:no-line-numbers +fun original(): Instance +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 标识需要调用当前 `Method` 未经 Hook 的原始方法。 + +若当前 `Method` 并未 Hook 则会使用原始的 `Method.invoke` 方法调用。 + +::: danger + +你只能在 (Xposed) 宿主环境中使用此功能。 + +::: + +#### call - method + +```kotlin:no-line-numbers +fun call(vararg param: Any?): Any? +``` + +**Change Records** + +`v1.0.2` `added` + +**Function Illustrate** + +> 执行 `Method`,不指定返回值类型。 + +#### invoke - method + +```kotlin:no-line-numbers +fun invoke(vararg param: Any?): T? +``` + +**Change Records** + +`v1.0.2` `added` + +**Function Illustrate** + +> 执行 `Method`,指定 `T` 返回值类型。 + +#### byte - method + +```kotlin:no-line-numbers +fun byte(vararg param: Any?): Byte? +``` + +**Change Records** + +`v1.0.68` `added` + +**Function Illustrate** + +> 执行 `Method`,指定 Byte 返回值类型。 + +#### int - method + +```kotlin:no-line-numbers +fun int(vararg param: Any?): Int +``` + +**Change Records** + +`v1.0.65` `added` + +`v1.0.68` `modified` + +修改 ~~`callInt`~~ 为 `int` + +**Function Illustrate** + +> 执行 `Method`,指定 Int 返回值类型。 + +#### long - method + +```kotlin:no-line-numbers +fun long(vararg param: Any?): Long +``` + +**Change Records** + +`v1.0.65` `added` + +`v1.0.68` `modified` + +修改 ~~`callLong`~~ 为 `long` + +**Function Illustrate** + +> 执行 `Method`,指定 Long 返回值类型。 + +#### short - method + +```kotlin:no-line-numbers +fun short(vararg param: Any?): Short +``` + +**Change Records** + +`v1.0.65` `added` + +`v1.0.68` `modified` + +修改 ~~`callShort`~~ 为 `short` + +**Function Illustrate** + +> 执行 `Method`,指定 Short 返回值类型。 + +#### double - method + +```kotlin:no-line-numbers +fun double(vararg param: Any?): Double +``` + +**Change Records** + +`v1.0.65` `added` + +`v1.0.68` `modified` + +修改 ~~`callDouble`~~ 为 `double` + +**Function Illustrate** + +> 执行 `Method`,指定 Double 返回值类型。 + +#### float - method + +```kotlin:no-line-numbers +fun float(vararg param: Any?): Float +``` + +**Change Records** + +`v1.0.65` `added` + +`v1.0.68` `modified` + +修改 ~~`callFloat`~~ 为 `float` + +**Function Illustrate** + +> 执行 `Method`,指定 Float 返回值类型。 + +#### string - method + +```kotlin:no-line-numbers +fun string(vararg param: Any?): String +``` + +**Change Records** + +`v1.0.65` `added` + +`v1.0.68` `modified` + +修改 ~~`callString`~~ 为 `string` + +**Function Illustrate** + +> 执行 `Method`,指定 String 返回值类型。 + +#### char - method + +```kotlin:no-line-numbers +fun char(vararg param: Any?): Char +``` + +**Change Records** + +`v1.0.68` `added` + +**Function Illustrate** + +> 执行 `Method`,指定 Char 返回值类型。 + +#### boolean - method + +```kotlin:no-line-numbers +fun boolean(vararg param: Any?): Boolean +``` + +**Change Records** + +`v1.0.65` `added` + +`v1.0.68` `modified` + +修改 ~~`callBoolean`~~ 为 `boolean` + +**Function Illustrate** + +> 执行 `Method`,指定 Boolean 返回值类型。 + +### array - method + +```kotlin:no-line-numbers +inline fun array(vararg param: Any?): Array +``` + +**Change Records** + +`v1.0.68` `added` + +**Function Illustrate** + +> 执行 `Method`,指定 Array 返回值类型。 + +### list - method + +```kotlin:no-line-numbers +inline fun list(vararg param: Any?): List +``` + +**Change Records** + +`v1.0.68` `added` + +**Function Illustrate** + +> 执行 `Method`,指定 List 返回值类型。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/entity/YukiBaseHooker.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/entity/YukiBaseHooker.md new file mode 100644 index 00000000..ff146827 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/entity/YukiBaseHooker.md @@ -0,0 +1,39 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# YukiBaseHooker - class + +```kotlin:no-line-numbers +abstract class YukiBaseHooker : PackageParam() +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> `YukiHookAPI` 的子类 Hooker 实现。 + +## onHook - method + +```kotlin:no-line-numbers +fun onHook() +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 子类 Hook 开始。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.md new file mode 100644 index 00000000..8eab2d8c --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.md @@ -0,0 +1,745 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# ReflectionFactory - kt + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 这是自定义 `Member` 和 `Class` 相关功能的查找匹配以及 `invoke` 的封装类。 + +## MembersType - class + +```kotlin:no-line-numbers +enum class MembersType +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 定义一个 `Class` 中的 `Member` 类型 + +### ALL - enum + +```kotlin:no-line-numbers +ALL +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 全部 `Method` 与 `Constructor`。 + +### METHOD - enum + +```kotlin:no-line-numbers +METHOD +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 全部 `Method`。 + +### CONSTRUCTOR - enum + +```kotlin:no-line-numbers +CONSTRUCTOR +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 全部 `Constructor`。 + +## ClassLoader.searchClass - ext-method + +```kotlin:no-line-numbers +inline fun ClassLoader.searchClass(name: String, async: Boolean, initiate: ClassConditions): DexClassFinder.Result +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 通过当前 `ClassLoader` 按指定条件查找并得到 **Dex** 中的 `Class`。 + +::: danger + +此方法在 **Class** 数量过多及查找条件复杂时会非常耗时。 + +建议启用 **async** 或设置 **name** 参数,**name** 参数将在 Hook APP (宿主) 不同版本中自动进行本地缓存以提升效率。 + +此功能尚在试验阶段,性能与稳定性可能仍然存在问题,使用过程遇到问题请向我们报告并帮助我们改进。 + +::: + +## ClassLoader.onLoadClass - ext-method + +```kotlin:no-line-numbers +fun ClassLoader.onLoadClass(result: (Class<*>) -> Unit) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 监听当前 `ClassLoader` 的 `ClassLoader.loadClass` 方法装载。 + +::: danger + +只有当前 **ClassLoader** 有主动使用 **ClassLoader.loadClass** 事件时才能被捕获。 + +这是一个实验性功能,一般情况下不会用到此方法,不保证不会发生错误。 + +只能在 (Xposed) 宿主环境使用此功能,其它环境下使用将不生效且会打印警告信息。 + +::: + +**Function Example** + +针对一些使用特定 `ClassLoader` 装载 `Class` 的宿主应用,你可以使用此方法来监听 `Class` 加载情况。 + +::: warning + +为了防止发生问题,你需要**得到一个存在的 ClassLoader 实例**来使用此功能。 + +::: + +比如我们在 `PackageParam` 中使用 `appClassLoader`。 + +> The following example + +```kotlin +appClassLoader.onLoadClass { clazz -> + // 得到 clazz 即加载对象 + clazz... // 这里进行你需要的操作 +} +``` + +或使用你得到的存在的 `ClassLoader` 实例,可以通过 Hook 获取。 + +> The following example + +```kotlin +val customClassLoader: ClassLoader? = ... // 假设这个就是你的 ClassLoader +customClassLoader?.onLoadClass { clazz -> + // ... +} +``` + +在判断到这个 `Class` 被装载成功时,开始执行你的 Hook 功能。 + +> The following example + +```kotlin +val customClassLoader: ClassLoader? = ... // 假设这个就是你的 ClassLoader +customClassLoader?.onLoadClass { clazz -> + if(clazz.name == /** 你需要的 Class 名称 */) { + clazz.hook { + // ... + } + } +} +``` + +

hookClass - field

+ +**Change Records** + +`v1.0` `first` + +`v1.1.0` `removed` + +`HookClass` 相关功能不再对外开放 + +

normalClass - field

+ +**Change Records** + +`v1.0` `first` + +`v1.1.0` `removed` + +`HookClass` 相关功能不再对外开放 + +

hasClass - field

+ +**Change Records** + +`v1.0` `first` + +`v1.1.0` `removed` + +请直接使用 `hasClass()` 无参方法 + +## Class.hasExtends - ext-field + +```kotlin:no-line-numbers +val Class<*>.hasExtends: Boolean +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 当前 `Class` 是否有继承关系,父类是 `Any` 将被认为没有继承关系。 + +

classOf - method

+ +**Change Records** + +`v1.0` `first` + +`v1.1.0` `deprecated` + +请转到 `toClass(...)` 方法 + +## String.toClass - ext-method + +```kotlin:no-line-numbers +fun String.toClass(loader: ClassLoader?): Class<*> +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 通过字符串类名转换为 `loader` 中的实体类。 + +**Function Example** + +你可以直接填写你要查找的目标 `Class`,必须在默认 `ClassLoader` 下存在。 + +> The following example + +```kotlin +"com.example.demo.DemoClass".toClass() +``` + +你还可以自定义 `Class` 所在的 `ClassLoader`。 + +> The following example + +```kotlin +val customClassLoader: ClassLoader? = ... // 假设这个就是你的 ClassLoader +"com.example.demo.DemoClass".toClass(customClassLoader) +``` + +## String.toClassOrNull - ext-method + +```kotlin:no-line-numbers +fun String.toClassOrNull(loader: ClassLoader?): Class<*>? +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 通过字符串类名转换为 `loader` 中的实体类。 + +找不到 `Class` 会返回 `null`,不会抛出异常。 + +**Function Example** + +用法请参考 [String.toClass](#string-toclass-ext-method) 方法。 + +## classOf - method + +```kotlin:no-line-numbers +inline fun classOf(loader: ClassLoader?): Class<*> +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 通过 `T` 得到其 `Class` 实例并转换为实体类。 + +**Function Example** + +我们要获取一个 `Class` 在 `Kotlin` 下不通过反射时应该这样做。 + +> The following example +> +```kotlin +DemoClass::class.java +``` + +现在,你可以直接 `cast` 一个实例并获取它的 `Class` 对象,必须在当前 `ClassLoader` 下存在。 + +> The following example + +```kotlin +classOf() +``` + +若目标存在的 `Class` 为 `stub`,通过这种方式,你还可以自定义 `Class` 所在的 `ClassLoader`。 + +> The following example + +```kotlin +val customClassLoader: ClassLoader? = ... // 假设这个就是你的 ClassLoader +classOf(customClassLoader) +``` + +## String.hasClass - ext-method + +```kotlin:no-line-numbers +fun String.hasClass(loader: ClassLoader?): Boolean +``` + +**Change Records** + +`v1.0` `first` + +`v1.1.0` `modified` + +支持直接使用空参数方法使用默认 `ClassLoader` 进行判断 + +**Function Illustrate** + +> 通过字符串类名使用指定的 `ClassLoader` 查找是否存在。 + +**Function Example** + +你可以轻松的使用此方法判断字符串中的类是否存在,效果等同于直接使用 `Class.forName`。 + +> The following example + +```kotlin +if("com.example.demo.DemoClass".hasClass()) { + // Your code here. +} +``` + +填入方法中的 `loader` 参数可判断指定的 `ClassLoader` 中的 `Class` 是否存在。 + +> The following example + +```kotlin +val customClassLoader: ClassLoader? = ... // 假设这个就是你的 ClassLoader +if("com.example.demo.DemoClass".hasClass(customClassLoader)) { + // Your code here. +} +``` + +## Class.hasField - ext-method + +```kotlin:no-line-numbers +inline fun Class<*>.hasField(initiate: FieldConditions): Boolean +``` + +**Change Records** + +`v1.0.4` `added` + +`v1.0.67` `modified` + +合并到 `FieldFinder` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 查找变量是否存在。 + +## Class.hasMethod - ext-method + +```kotlin:no-line-numbers +inline fun Class<*>.hasMethod(initiate: MethodConditions): Boolean +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.1` `modified` + +新增 `returnType` 参数 + +`v1.0.67` `modified` + +合并到 `MethodFinder` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 查找方法是否存在。 + +## Class.hasConstructor - ext-method + +```kotlin:no-line-numbers +inline fun Class<*>.hasConstructor(initiate: ConstructorConditions): Boolean +``` + +**Change Records** + +`v1.0.2` `added` + +`v1.0.67` `modified` + +合并到 `ConstructorFinder` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 查找构造方法是否存在。 + +## Member.hasModifiers - ext-method + +```kotlin:no-line-numbers +inline fun Member.hasModifiers(conditions: ModifierConditions): Boolean +``` + +**Change Records** + +`v1.0.67` `added` + +`v1.0.80` `modified` + +将方法体进行 inline + +`v1.1.0` `modified` + +合并到 `ModifierConditions` + +**Function Illustrate** + +> 查找 `Member` 中匹配的描述符。 + +## Class.hasModifiers - ext-method + +```kotlin:no-line-numbers +inline fun Class<*>.hasModifiers(conditions: ModifierConditions): Boolean +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 查找 `Class` 中匹配的描述符。 + +

obtainStaticFieldAny - method

+ +**Change Records** + +`v1.0` `first` + +`v1.0.1` `removed` + +

obtainFieldAny - method

+ +**Change Records** + +`v1.0` `first` + +`v1.0.1` `removed` + +

modifyStaticField - method

+ +**Change Records** + +`v1.0` `first` + +`v1.0.1` `removed` + +

modifyField - method

+ +**Change Records** + +`v1.0` `first` + +`v1.0.1` `removed` + +## Class.field - ext-method + +```kotlin:no-line-numbers +inline fun Class<*>.field(initiate: FieldConditions): FieldFinder.Result +``` + +**Change Records** + +`v1.0.2` `added` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 查找并得到变量。 + +## Class.method - ext-method + +```kotlin:no-line-numbers +inline fun Class<*>.method(initiate: MethodConditions): MethodFinder.Result +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.1` `modified` + +~~`obtainMethod`~~ 更名为 `method` + +新增 `returnType` 参数 + +`v1.0.2` `modified` + +合并到 `MethodFinder` 方法体 + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 查找并得到方法。 + +## Class.constructor - ext-method + +```kotlin:no-line-numbers +inline fun Class<*>.constructor(initiate: ConstructorConditions): ConstructorFinder.Result +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.1` `modified` + +~~`obtainConstructor`~~ 更名为 `constructor` + +`v1.0.2` `modified` + +合并到 `ConstructorFinder` 方法体 + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 查找并得到构造方法。 + +

callStatic - method

+ +**Change Records** + +`v1.0` `first` + +`v1.0.1` `modified` + +~~`invokeStatic`~~ 更名为 `callStatic` + +`v1.0.2` `removed` + +

call - method

+ +**Change Records** + +`v1.0` `first` + +`v1.0.1` `modified` + +~~`invokeAny`~~ 更名为 `call` + +`v1.0.2` `removed` + +## Class.generic - ext-method + +```kotlin:no-line-numbers +fun Class<*>.generic(): GenericClass? +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获得当前 `Class` 的泛型父类。 + +如果当前实例不存在泛型将返回 `null`。 + +## Class.generic - ext-method + +```kotlin:no-line-numbers +inline fun Class<*>.generic(initiate: GenericClass.() -> Unit): GenericClass? +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获得当前 `Class` 的泛型父类。 + +如果当前实例不存在泛型将返回 `null`。 + +## Any.current - ext-method + +```kotlin:no-line-numbers +inline fun T.current(ignored: Boolean): CurrentClass +``` + +```kotlin:no-line-numbers +inline fun T.current(ignored: Boolean, initiate: CurrentClass.() -> Unit): T +``` + +**Change Records** + +`v1.0.70` `added` + +`v1.1.0` `added` + +新增 `ignored` 参数,可以忽略在 `CurrentClass` 中出现的异常 + +新增不使用 `current { ... }` 调用域直接使用 `current()` 得到实例的类操作对象 + +**Function Illustrate** + +> 获得当前实例的类操作对象。 + +

Class.buildOfAny - ext-method

+ +**Change Records** + +`v1.0.70` `added` + +`v1.0.80` `modified` + +将方法体进行 inline + +`v1.1.0` `deprecated` + +请转移到 `buildOf` 方法 + +## Class.buildOf - ext-method + +```kotlin:no-line-numbers +inline fun Class<*>.buildOf(vararg param: Any?, initiate: ConstructorConditions): Any? +``` + +```kotlin:no-line-numbers +inline fun Class<*>.buildOf(vararg param: Any?, initiate: ConstructorConditions): T? +``` + +**Change Records** + +`v1.0.70` `added` + +`v1.0.80` `modified` + +将方法体进行 inline + +`v1.1.0` `modified` + +加入无泛型方法 `buildOf` + +**Function Illustrate** + +> 通过构造方法创建新实例,指定类型 `T` 或任意类型 `Any`。 + +## Class.allMethods - ext-method + +```kotlin:no-line-numbers +inline fun Class<*>.allMethods(result: (index: Int, method: Method) -> Unit) +``` + +**Change Records** + +`v1.0.70` `added` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 遍历当前类中的所有方法。 + +## Class.allConstructors - ext-method + +```kotlin:no-line-numbers +inline fun Class<*>.allConstructors(result: (index: Int, constructor: Constructor<*>) -> Unit) +``` + +**Change Records** + +`v1.0.70` `added` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 遍历当前类中的所有构造方法。 + +## Class.allFields - ext-method + +```kotlin:no-line-numbers +inline fun Class<*>.allFields(result: (index: Int, field: Field) -> Unit) +``` + +**Change Records** + +`v1.0.70` `added` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 遍历当前类中的所有变量。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.md new file mode 100644 index 00000000..7cf0d4c0 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.md @@ -0,0 +1,249 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# YukiHookFactory - kt + +**Change Records** + +`v1.0` `first` + +`v1.0.80` `modified` + +合并到 `IYukiHookXposedInit`,将方法体进行 inline + +**Function Illustrate** + +> 这是 `YukiHookAPI` 相关 `lambda` 方法的封装类以及部分 API 用法。 + +## IYukiHookXposedInit.configs - ext-method + +```kotlin:no-line-numbers +inline fun IYukiHookXposedInit.configs(initiate: YukiHookAPI.Configs.() -> Unit) +``` + +**Change Records** + +`v1.0.1` `added` + +`v1.0.80` `modified` + +合并到 `IYukiHookXposedInit` + +**Function Illustrate** + +> 在 `IYukiHookXposedInit` 中配置 `Configs`。 + +## IYukiHookXposedInit.encase - ext-method + +```kotlin:no-line-numbers +fun IYukiHookXposedInit.encase(initiate: PackageParam.() -> Unit) +``` + +```kotlin:no-line-numbers +fun IYukiHookXposedInit.encase(vararg hooker: YukiBaseHooker) +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.80` `modified` + +合并到 `IYukiHookXposedInit` + +**Function Illustrate** + +> 在 `IYukiHookXposedInit` 中调用 `YukiHookAPI`。 + +## Context.modulePrefs - ext-field + +```kotlin:no-line-numbers +val Context.modulePrefs: YukiHookModulePrefs +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 获取模块的存取对象。 + +## Context.modulePrefs - ext-method + +```kotlin:no-line-numbers +fun Context.modulePrefs(name: String): YukiHookModulePrefs +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 获取模块的存取对象,可设置 `name` 为自定义 Sp 存储名称。 + +## Context.dataChannel - ext-method + +```kotlin:no-line-numbers +fun Context.dataChannel(packageName: String): YukiHookDataChannel.NameSpace +``` + +**Change Records** + +`v1.0.88` `added` + +**Function Illustrate** + +> 获取模块的数据通讯桥命名空间对象。 + +::: danger + +只能在模块环境使用此功能,其它环境下使用将不起作用。 + +::: + +## Context.processName - ext-field + +```kotlin:no-line-numbers +val Context.processName: String +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 获取当前进程名称。 + +## Context+Resources.injectModuleAppResources - ext-method + +```kotlin:no-line-numbers +fun Context.injectModuleAppResources() +``` + +```kotlin:no-line-numbers +fun Resources.injectModuleAppResources() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 向 Hook APP (宿主) `Context` 或 `Resources` 注入当前 Xposed 模块的资源。 + +注入成功后,你就可以直接使用例如 `ImageView.setImageResource` 或 `Resources.getString` 装载当前 Xposed 模块的资源 ID。 + +注入的资源作用域仅限当前 `Context` 或 `Resources`,你需要在每个用到宿主 `Context` 或 `Resources` 的地方重复调用此方法进行注入才能使用。 + +::: danger + +只能在 (Xposed) 宿主环境使用此功能,其它环境下使用将不生效且会打印警告信息。 + +::: + +## Context.registerModuleAppActivities - ext-method + +```kotlin:no-line-numbers +fun Context.registerModuleAppActivities(proxy: Any?) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 向 Hook APP (宿主) 注册当前 Xposed 模块的 `Activity`。 + +注册成功后,你就可以直接使用 `Context.startActivity` 来启动未在宿主中注册的 `Activity`。 + +使用此方法会在未注册的 `Activity` 在 Hook APP (宿主) 中启动时自动调用 `injectModuleAppResources` 注入当前 Xposed 模块的资源。 + +你要将需要在宿主启动的 `Activity` 继承于 `ModuleAppActivity` 或 `ModuleAppCompatActivity`。 + +::: danger + +只能在 (Xposed) 宿主环境使用此功能,其它环境下使用将不生效且会打印警告信息。 + +::: + +## Context.applyModuleTheme - ext-method + +```kotlin:no-line-numbers +fun Context.applyModuleTheme(theme: Int, configuration: Configuration?): ModuleContextThemeWrapper +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 生成一个 `ContextThemeWrapper` 代理以应用当前 Xposed 模块的主题资源。 + +在 Hook APP (宿主) 中使用此方法会自动调用 `injectModuleAppResources` 注入当前 Xposed 模块的资源。 + +如果在 Hook APP (宿主) 中使用此方法发生 `ClassCastException`,请手动设置 `configuration`。 + +

isSupportResourcesHook - field

+ +**Change Records** + +`v1.0.80` `added` + +`v1.0.91` `removed` + +请转移到 `YukiHookAPI.Status.isSupportResourcesHook` + +

isModuleActive - field

+ +**Change Records** + +`v1.0.6` `added` + +`v1.0.91` `removed` + +请转移到 `YukiHookAPI.Status.isModuleActive` + +

isXposedModuleActive - field

+ +**Change Records** + +`v1.0.6` `added` + +`v1.0.91` `removed` + +请转移到 `YukiHookAPI.Status.isXposedModuleActive` + +

isTaiChiModuleActive - field

+ +**Change Records** + +`v1.0` `first` + +`v1.0.91` `removed` + +请转移到 `YukiHookAPI.Status.isTaiChiModuleActive` + +

YukiHookModuleStatus - class

+ +**Change Records** + +`v1.0` `first` + +`v1.0.91` `deprecated` + +请转移到 `YukiHookAPI.Status` \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/log/LoggerFactory.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/log/LoggerFactory.md new file mode 100644 index 00000000..a952fa5c --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/log/LoggerFactory.md @@ -0,0 +1,447 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# LoggerFactory - kt + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 这是 `YukiHookAPI` 的日志封装类,可实现同时向 `Logcat` 和 `XposedBridge.log` 打印日志的功能。 + +## LoggerType - class + +```kotlin:no-line-numbers +enum class LoggerType +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 需要打印的日志类型。 + +决定于模块与 (Xposed) 宿主环境使用的打印方式。 + +### LOGD - enum + +```kotlin:no-line-numbers +LOGD +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 仅使用 `android.util.Log`。 + +### XPOSEDBRIDGE - enum + +```kotlin:no-line-numbers +XPOSEDBRIDGE +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 仅使用 `XposedBridge.log`。 + +::: danger + +只能在 (Xposed) 宿主环境中使用,模块环境将不生效。 + +::: + +### SCOPE - enum + +```kotlin:no-line-numbers +SCOPE +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 分区使用。 + +(Xposed) 宿主环境仅使用 `XPOSEDBRIDGE`。 + +模块环境仅使用 `LOGD`。 + +### BOTH - enum + +```kotlin:no-line-numbers +BOTH +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 同时使用。 + +(Xposed) 宿主环境使用 `LOGD` 与 `XPOSEDBRIDGE`。 + +模块环境仅使用 `LOGD`。 + +## YukiHookLogger - object + +```kotlin:no-line-numbers +object YukiHookLogger +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 调试日志实现类。 + +### contents - field + +```kotlin:no-line-numbers +val contents: String +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获取当前日志文件内容。 + +如果当前没有已记录的日志会返回空字符串。 + +### clear - method + +```kotlin:no-line-numbers +fun clear() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 清除全部已记录的日志。 + +### saveToFile - method + +```kotlin:no-line-numbers +fun saveToFile(fileName: String) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 保存当前日志到文件。 + +若当前未开启 `Configs.isRecord` 或记录为空则不会进行任何操作。 + +日志文件会追加到 `fileName` 的文件结尾,若文件不存在会自动创建。 + +::: danger + +文件读写权限取决于当前宿主已获取的权限。 + +::: + +### Configs - object + +```kotlin:no-line-numbers +object Configs +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 配置 `YukiHookLogger`。 + +#### TAG - field + +```kotlin:no-line-numbers +const val TAG: Int +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 标签。 + +#### PRIORITY - field + +```kotlin:no-line-numbers +const val PRIORITY: Int +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 优先级。 + +#### PACKAGE_NAME - field + +```kotlin:no-line-numbers +const val PACKAGE_NAME: Int +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 当前宿主的包名。 + +#### USER_ID - field + +```kotlin:no-line-numbers +const val USER_ID: Int +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 当前宿主的用户 ID (主用户不显示)。 + +#### isEnable - field + +```kotlin:no-line-numbers +var isEnable: Boolean +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 是否启用调试日志的输出功能。 + +关闭后将会停用 `YukiHookAPI` 对全部日志的输出。 + +但是不影响当你手动调用下面这些方法输出日志。 + +`loggerD`、`loggerI`、`loggerW`、`loggerE`。 + +当 `isEnable` 关闭后 `YukiHookAPI.Configs.isDebug` 也将同时关闭。 + +#### isRecord - field + +```kotlin:no-line-numbers +var isRecord: Boolean +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 是否启用调试日志的记录功能。 + +开启后将会在内存中记录全部可用的日志和异常堆栈。 + +需要同时启用 [isEnable](#isenable-field) 才能有效。 + +::: danger + +过量的日志可能会导致宿主运行缓慢或造成频繁 GC。 + +::: + +开启后你可以调用 [YukiHookLogger.saveToFile](#savetofile-method) 实时保存日志到文件或使用 [YukiHookLogger.contents](#contents-field) 获取实时日志文件。 + +#### tag - field + +```kotlin:no-line-numbers +var tag: String +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 这是一个调试日志的全局标识。 + +默认文案为 `YukiHookAPI`。 + +你可以修改为你自己的文案。 + +#### elements - method + +```kotlin:no-line-numbers +fun elements(vararg item: Int) +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 自定义调试日志对外显示的元素。 + +只对日志记录和 `XposedBridge.log` 生效。 + +日志元素的排列将按照你在 `item` 中设置的顺序进行显示。 + +你还可以留空 `item` 以不显示除日志内容外的全部元素。 + +可用的元素有:`TAG`、`PRIORITY`、`PACKAGE_NAME`、`USER_ID`。 + +**Function Example** + +打印的日志样式将按照你设置的排列顺序和元素内容进行。 + +> The following example + +```kotlin +elements(TAG, PRIORITY, PACKAGE_NAME, USER_ID) +``` + +以上内容定义的日志将显示为如下样式。 + +> The following example + +```:no-line-numbers +[YukiHookAPI][D][com.demo.test][999]--> This is a log +``` + +如果我们调整元素顺序以及减少个数,那么结果又会不一样。 + +> The following example + +```kotlin +elements(PACKAGE_NAME, USER_ID, PRIORITY) +``` + +以上内容定义的日志将显示为如下样式。 + +> The following example + +```:no-line-numbers +[com.demo.test][999][D]--> This is a log +``` + +## loggerD - method + +```kotlin:no-line-numbers +fun loggerD(tag: String, msg: String, type: LoggerType) +``` + +**Change Records** + +`v1.0` `first` + +`v1.1.0` `modified` + +新增 `type` 参数 + +**Function Illustrate** + +> 向 `Logcat` 和 `XposedBridge` 打印日志,级别 `D`。 + +`tag` 的默认参数为 `YukiHookAPI.Configs.debugTag`,你可以进行自定义。 + +## loggerI - method + +```kotlin:no-line-numbers +fun loggerI(tag: String, msg: String, type: LoggerType) +``` + +**Change Records** + +`v1.0` `first` + +`v1.1.0` `modified` + +新增 `type` 参数 + +**Function Illustrate** + +> 向 `Logcat` 和 `XposedBridge` 打印日志,级别 `I`。 + +`tag` 的默认参数为 `YukiHookAPI.Configs.debugTag`,你可以进行自定义。 + +## loggerW - method + +```kotlin:no-line-numbers +fun loggerW(tag: String, msg: String, type: LoggerType) +``` + +**Change Records** + +`v1.0` `first` + +`v1.1.0` `modified` + +新增 `type` 参数 + +**Function Illustrate** + +> 向 `Logcat` 和 `XposedBridge` 打印日志,级别 `W`。 + +`tag` 的默认参数为 `YukiHookAPI.Configs.debugTag`,你可以进行自定义。 + +## loggerE - method + +```kotlin:no-line-numbers +fun loggerE(tag: String, msg: String, e: Throwable?, type: LoggerType) +``` + +**Change Records** + +`v1.0` `first` + +`v1.1.0` `modified` + +新增 `type` 参数 + +**Function Illustrate** + +> 向 `Logcat` 和 `XposedBridge` 打印日志,级别 `E`,可携带 `e` 异常信息,将打印异常堆栈。 + +`tag` 的默认参数为 `YukiHookAPI.Configs.debugTag`,你可以进行自定义。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/param/HookParam.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/param/HookParam.md new file mode 100644 index 00000000..6b428815 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/param/HookParam.md @@ -0,0 +1,886 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# HookParam - class + +```kotlin:no-line-numbers +class HookParam internal constructor(private val creatorInstance: YukiMemberHookCreator, private var param: YukiHookCallback.Param?) +``` + +**Change Records** + +`v1.0` `first` + +`v1.1.0` `modified` + +移动 `HookParamWrapper` 到 `YukiHookCallback.Param` + +修正拼写错误的 **creater** 命名到 **creator** + +**Function Illustrate** + +> Hook 方法、构造方法的目标对象实现类。 + +## args - field + +```kotlin:no-line-numbers +val args: Array +``` + +**Change Records** + +在 `v1.0` 添加 + +**Function Illustrate** + +> 获取当前 Hook 对象 `member` 或 `constructor` 的参数对象数组。 + +这里的数组每项类型默认为 `Any`,你可以使用 `args` 方法来实现 `ArgsModifyer.cast` 功能。 + +

firstArgs - field

+ +**Change Records** + +`v1.0` `first` + +`v1.0.75` `removed` + +请使用 `args(index = 0)` 或 `args().first()` + +

lastArgs - field

+ +**Change Records** + +`v1.0` `first` + +`v1.0.75` `removed` + +请使用 `args().last()` + +## instance - field + +```kotlin:no-line-numbers +val instance: Any +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 获取当前 Hook 实例的对象。 + +::: danger + +如果你当前 Hook 的对象是一个静态,那么它将不存在实例的对象。 + +::: + +## instanceClass - field + +```kotlin:no-line-numbers +val instanceClass: Class<*> +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 获取当前 Hook 实例的类对象。 + +## member - field + +```kotlin:no-line-numbers +val member: Member +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获取当前 Hook 对象的 `Member`。 + +在不确定 `Member` 类型为 `Method` 或 `Constructor` 时可以使用此方法。 + +## method - field + +```kotlin:no-line-numbers +val method: Method +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 获取当前 Hook 对象的方法。 + +## constructor - field + +```kotlin:no-line-numbers +val constructor: Constructor +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 获取当前 Hook 对象的构造方法。 + +## result - field + +```kotlin:no-line-numbers +var result: Any? +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 获取、设置当前 Hook 对象的 `method` 或 `constructor` 的返回值。 + +## hasThrowable - field + +```kotlin:no-line-numbers +val hasThrowable: Boolean +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 判断是否存在设置过的方法调用抛出异常。 + +## throwable - field + +```kotlin:no-line-numbers +val throwable: Throwable? +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获取设置的方法调用抛出异常。 + +## Throwable.throwToApp - i-ext-method + +```kotlin:no-line-numbers +fun Throwable.throwToApp() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 向 Hook APP 抛出异常。 + +使用 `hasThrowable` 判断当前是否存在被抛出的异常。 + +使用 `throwable` 获取当前设置的方法调用抛出异常。 + +仅会在回调方法的 `MemberHookCreator.beforeHook` 或 `MemberHookCreator.afterHook` 中生效。 + +::: danger + +设置后会同时执行 **resultNull** 方法并将异常抛出给当前 Hook APP。 + +::: + +**Function Example** + +Hook 过程中的异常仅会作用于 (Xposed) 宿主环境,目标 Hook APP 不会受到影响。 + +若想将异常抛给 Hook APP,可以直接使用如下方法。 + +> The following example + +```kotlin +injectMember { + method { + // ... + } + beforeHook { + RuntimeException("Test Exception").throwToApp() + } +} +``` + +::: danger + +向 Hook APP 抛出异常**会对其暴露被 Hook 的事实**,是不安全的,容易被检测,请按实际场景合理使用。 + +::: + +## result - method + +```kotlin:no-line-numbers +inline fun result(): T? +``` + +**Change Records** + +`v1.0.75` `added` + +**Function Illustrate** + +> 获取当前 Hook 对象的 `method` 或 `constructor` 的返回值 `T`。 + +

firstArg - method

+ +**Change Records** + +`v1.0.66` `added` + +`v1.0.75` `removed` + +

lastArgs - method

+ +**Change Records** + +`v1.0.66` `added` + +`v1.0.75` `removed` + +## instance - method + +```kotlin:no-line-numbers +inline fun instance(): T +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 获取当前 Hook 实例的对象 `T`。 + +**Function Example** + +你可以通过 `instance` 方法轻松使用泛型 `cast` 为目标对象的类型。 + +> The following example + +```kotlin +instance().finish() +``` + +## args - method + +```kotlin:no-line-numbers +fun args(): ArgsIndexCondition +``` + +**Change Records** + +`v1.0.75` `added` + +**Function Illustrate** + +> 获取当前 Hook 对象的 `method` 或 `constructor` 的参数数组下标实例化类。 + +## args - method + +```kotlin:no-line-numbers +fun args(index: Int): ArgsModifyer +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.75` `modified` + +默认值 `index = 0` 移动到新的使用方法 `args().first()` + +**Function Illustrate** + +> 获取当前 Hook 对象的 `method` 或 `constructor` 的参数实例化对象类。 + +**Function Example** + +你可以通过 `args` 方法修改当前 Hook 实例的方法、构造方法的参数内容。 + +你可以直接使用 `set` 方法设置 `param` 为你的目标实例,接受 `Any` 类型。 + +::: danger + +请确保 **param** 类型为你的目标实例类型。 + +::: + +> The following example + +```kotlin +args(index = 0).set("modify the value") +``` + +你可以这样直接设置第一位 `param` 的值。 + +> The following example + +```kotlin +args().first().set("modify the value") +``` + +你还可以直接设置最后一位 `param` 的值。 + +> The following example + +```kotlin +args().last().set("modify the value") +``` + +你还可以使用 `setNull` 方法设置 `param` 为空。 + +> The following example + +```kotlin +args(index = 1).setNull() +``` + +你还可以使用 `setTrue` 方法设置 `param` 为 `true`。 + +::: danger + +请确保 **param** 类型为 **Boolean**。 + +::: + +> The following example + +```kotlin +args(index = 1).setTrue() +``` + +你还可以使用 `setFalse` 方法设置 `param` 为 `false`。 + +::: danger + +请确保 **param** 类型为 **Boolean**。 + +::: + +> The following example + +```kotlin +args(index = 1).setFalse() +``` + +## callOriginal - method + +```kotlin:no-line-numbers +fun callOriginal(): Any? +``` + +```kotlin:no-line-numbers +fun callOriginal(): T? +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 执行原始 `Member`。 + +调用自身未进行 Hook 的原始 `Member` 并调用原始参数执行。 + +**功能实例** + +此方法可以 `invoke` 原始未经 Hook 的 `Member` 对象,取决于原始 `Member` 的参数。 + +调用自身原始的方法不会再经过当前 `beforeHook`、`afterHook` 以及 `replaceUnit`、`replaceAny`。 + +比如我们 Hook 的这个方法被这样调用 `test("test value")`,使用此方法会调用其中的 `"test value"` 作为参数。 + +> The following example + +```kotlin +injectMember { + method { + name = "test" + param(StringType) + returnType = StringType + } + afterHook { + // <方案1> 不使用泛型,不获取方法执行结果,调用将使用原方法传入的 args 自动传参 + callOriginal() + // <方案2> 使用泛型,已知方法执行结果参数类型进行 cast + // 假设返回值为 String,失败会返回 null,调用将使用原方法传入的 args 自动传参 + val value = callOriginal() + } +} +``` + +## invokeOriginal - method + +```kotlin:no-line-numbers +fun invokeOriginal(vararg args: Any?): Any? +``` + +```kotlin:no-line-numbers +fun invokeOriginal(vararg args: Any?): T? +``` + +**Change Records** + +`v1.0` `first` + +`v1.1.0` `modified` + +不再需要使用 `member.invokeOriginal` 进行调用 + +**Function Illustrate** + +> 执行原始 `Member`。 + +调用自身未进行 Hook 的原始 `Member` 并自定义 `args` 执行。 + +**功能实例** + +此方法可以 `invoke` 原始未经 Hook 的 `Member` 对象,可自定义需要调用的参数内容。 + +调用自身原始的方法不会再经过当前 `beforeHook`、`afterHook` 以及 `replaceUnit`、`replaceAny`。 + +比如我们 Hook 的这个方法被这样调用 `test("test value")`,使用此方法可自定义其中的 `args` 作为参数。 + +> The following example + +```kotlin +injectMember { + method { + name = "test" + param(StringType) + returnType = StringType + } + afterHook { + // <方案1> 不使用泛型,不获取方法执行结果 + invokeOriginal("test value") + // <方案2> 使用泛型,已知方法执行结果参数类型进行 cast,假设返回值为 String,失败会返回 null + val value = invokeOriginal("test value") + } +} +``` + +## resultTrue - method + +```kotlin:no-line-numbers +fun resultTrue() +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 设置当前 Hook 对象方法的 `result` 返回值为 `true`。 + +::: danger + +请确保 **result** 类型为 **Boolean**。 + +::: + +## resultFalse - method + +```kotlin:no-line-numbers +fun resultFalse() +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 设置当前 Hook 对象方法的 `result` 返回值为 `false`。 + +::: danger + +请确保 **result** 类型为 **Boolean**。 + +::: + +## resultNull - method + +```kotlin:no-line-numbers +fun resultNull() +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +::: warning + +此方法将强制设置 Hook 对象方法的 **result** 为 **null**。 + +::: + +## ArgsIndexCondition - class + +```kotlin:no-line-numbers +inner class ArgsIndexCondition internal constructor() +``` + +**Change Records** + +`v1.0.75` `added` + +**Function Illustrate** + +> 对方法参数的数组下标进行实例化类。 + +### first - method + +```kotlin:no-line-numbers +fun first(): ArgsModifyer +``` + +**Change Records** + +`v1.0.75` `added` + +**Function Illustrate** + +> 获取当前 Hook 对象的 `method` 或 `constructor` 的参数数组第一位。 + +### last - method + +```kotlin:no-line-numbers +fun last(): ArgsModifyer +``` + +**Change Records** + +`v1.0.75` `added` + +**Function Illustrate** + +> 获取当前 Hook 对象的 `method` 或 `constructor` 的参数数组最后一位。 + +## ArgsModifyer - class + +```kotlin:no-line-numbers +inner class ArgsModifyer internal constructor(private val index: Int) +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 对方法参数的修改进行实例化类。 + +### cast - method + +```kotlin:no-line-numbers +fun cast(): T? +``` + +**Change Records** + +`v1.0.66` `added` + +`v1.0.68` `modified` + +修改 ~~`of`~~ 为 `cast` + +**Function Illustrate** + +> 得到方法参数的实例对象 `T`。 + +### byte - method + +```kotlin:no-line-numbers +fun byte(): Byte? +``` + +**Change Records** + +`v1.0.68` `added` + +**Function Illustrate** + +> 得到方法参数的实例对象 Byte。 + +### int - method + +```kotlin:no-line-numbers +fun int(): Int +``` + +**Change Records** + +`v1.0.66` `added` + +`v1.0.68` `modified` + +修改 ~~`ofInt`~~ 为 `int` + +**Function Illustrate** + +> 得到方法参数的实例对象 Int。 + +### long - method + +```kotlin:no-line-numbers +fun long(): Long +``` + +**Change Records** + +`v1.0.66` `added` + +`v1.0.68` `modified` + +修改 ~~`ofLong`~~ 为 `long` + +**Function Illustrate** + +> 得到方法参数的实例对象 Long。 + +### short - method + +```kotlin:no-line-numbers +fun short(): Short +``` + +**Change Records** + +`v1.0.66` `added` + +`v1.0.68` `modified` + +修改 ~~`ofShort`~~ 为 `short` + +**Function Illustrate** + +> 得到方法参数的实例对象 Short。 + +### double - method + +```kotlin:no-line-numbers +fun double(): Double +``` + +**Change Records** + +`v1.0.66` `added` + +`v1.0.68` `modified` + +修改 ~~`ofDouble`~~ 为 `double` + +**Function Illustrate** + +> 得到方法参数的实例对象 Double。 + +### float - method + +```kotlin:no-line-numbers +fun float(): Float +``` + +**Change Records** + +`v1.0.66` `added` + +`v1.0.68` `modified` + +修改 ~~`ofFloat`~~ 为 `float` + +**Function Illustrate** + +> 得到方法参数的实例对象 Float。 + +### string - method + +```kotlin:no-line-numbers +fun string(): String +``` + +**Change Records** + +`v1.0.66` `added` + +`v1.0.68` `modified` + +修改 ~~`ofString`~~ 为 `string` + +**Function Illustrate** + +> 得到方法参数的实例对象 String。 + +### char - method + +```kotlin:no-line-numbers +fun char(): Char +``` + +**Change Records** + +`v1.0.68` `added` + +**Function Illustrate** + +> 得到方法参数的实例对象 Char。 + +### boolean - method + +```kotlin:no-line-numbers +fun boolean(): Boolean +``` + +**Change Records** + +`v1.0.66` `added` + +`v1.0.68` `modified` + +修改 ~~`ofBoolean`~~ 为 `boolean` + +**Function Illustrate** + +> 得到方法参数的实例对象 Boolean。 + +### any - method + +```kotlin:no-line-numbers +fun any(): Any? +``` + +**Change Records** + +`v1.0.77` `added` + +**Function Illustrate** + +> 得到方法参数的实例对象 Any。 + +### array - method + +```kotlin:no-line-numbers +inline fun array(): Array +``` + +**Change Records** + +`v1.0.68` `added` + +**Function Illustrate** + +> 得到方法参数的实例对象 Array。 + +### list - method +```kotlin:no-line-numbers +inline fun list(): List +``` + +**Change Records** + +`v1.0.68` `added` + +**Function Illustrate** + +> 得到方法参数的实例对象 List。 + +### set - method + +```kotlin:no-line-numbers +fun set(any: T?) +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 设置方法参数的实例对象。 + +### setNull - method + +```kotlin:no-line-numbers +fun setNull() +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 设置方法参数的实例对象为 `null`。 + +### setTrue - method + +```kotlin:no-line-numbers +fun setTrue() +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 设置方法参数的实例对象为 `true`。 + +::: danger + +请确保目标对象的类型是 **Boolean**。 + +::: + +### setFalse - method + +```kotlin:no-line-numbers +fun setFalse() +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 设置方法参数的实例对象为 `false`。 + +::: danger + +请确保目标对象的类型是 **Boolean**。 + +::: \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/param/PackageParam.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/param/PackageParam.md new file mode 100644 index 00000000..7da870d0 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/param/PackageParam.md @@ -0,0 +1,996 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# PackageParam - class + +```kotlin:no-line-numbers +open class PackageParam internal constructor(internal var wrapper: PackageParamWrapper?) +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 装载 Hook 的目标 APP 入口对象实现类。 + +## appClassLoader - field + +```kotlin:no-line-numbers +val appClassLoader:ClassLoader +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 获取当前 Hook APP 的 `ClassLoader`。 + +## appInfo - field + +```kotlin:no-line-numbers +val appInfo: ApplicationInfo +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 获取当前 Hook APP 的 `ApplicationInfo`。 + +## appUserId - field + +```kotlin:no-line-numbers +val appUserId: Int +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获取当前 Hook APP 的用户 ID。 + +机主为 `0`,应用双开 (分身) 或工作资料因系统环境不同 ID 也各不相同。 + +## appContext - field + +```kotlin:no-line-numbers +val appContext: Application? +``` + +**Change Records** + +`v1.0.72` `added` + +`v1.1.0` `modified` + +加入可空类型 (空安全) + +**Function Illustrate** + +> 获取当前 Hook APP 的 `Application`。 + +::: danger + +首次装载可能是空的,请延迟一段时间再获取或使用 **onAppLifecycle** 监听来完成。 + +::: + +## appResources - field + +```kotlin:no-line-numbers +val appResources:Resources? +``` + +**Change Records** + +`v1.0.80` `added` + +`v1.1.0` `modified` + +加入可空类型 (空安全) + +**Function Illustrate** + +> 获取当前 Hook APP 的 Resources。 + +::: danger + +你只能在 **HookResources.hook** 方法体内或 **appContext** 装载完毕时进行调用。 + +::: + +## systemContext - field + +```kotlin:no-line-numbers +val systemContext: Context +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 获取当前系统框架的 `Context`。 + +## processName - field + +```kotlin:no-line-numbers +val processName: String +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 获取当前 Hook APP 的进程名称。 + +## packageName - field + +```kotlin:no-line-numbers +val packageName: String +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 获取当前 Hook APP 的包名。 + +## isFirstApplication - field + +```kotlin:no-line-numbers +val isFirstApplication: Boolean +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 获取当前 Hook APP 是否为第一个 `Application`。 + +## mainProcessName - field + +```kotlin:no-line-numbers +val mainProcessName: String +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 获取当前 Hook APP 的主进程名称。 + +其对应的就是 `packageName`。 + +## moduleAppFilePath - field + +```kotlin:no-line-numbers +val moduleAppFilePath: String +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 获取当前 Xposed 模块自身 APK 文件路径。 + +::: danger + +作为 Hook API 装载时无法使用,会获取到空字符串。 + +::: + +## moduleAppResources - field + +```kotlin:no-line-numbers +val moduleAppResources: YukiModuleResources +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 获取当前 Xposed 模块自身 `Resources`。 + +::: danger + +作为 Hook API 或不支持的 Hook Framework 装载时无法使用,会抛出异常。 + +::: + +## prefs - field + +```kotlin:no-line-numbers +val prefs: YukiHookModulePrefs +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 获得当前使用的存取数据对象缓存实例。 + +::: danger + +作为 Hook API 装载时无法使用,会抛出异常。 + +::: + +## prefs - method + +```kotlin:no-line-numbers +fun prefs(name: String): YukiHookModulePrefs +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 获得当前使用的存取数据对象缓存实例。 + +你可以通过 `name` 来自定义 Sp 存储的名称。 + +::: danger + +作为 Hook API 装载时无法使用,会抛出异常。 + +::: + +## dataChannel - field + +```kotlin:no-line-numbers +val dataChannel: YukiHookDataChannel.NameSpace +``` + +**Change Records** + +`v1.0.88` `added` + +**Function Illustrate** + +> 获得当前使用的数据通讯桥命名空间对象。 + +::: danger + +作为 Hook API 装载时无法使用,会抛出异常。 + +::: + +## resources - method + +```kotlin:no-line-numbers +fun resources(): HookResources +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 获得当前 Hook APP 的 `YukiResources` 对象。 + +请调用 `HookResources.hook` 方法开始 Hook。 + +## refreshModuleAppResources - method + +```kotlin:no-line-numbers +fun refreshModuleAppResources() +``` + +**Change Records** + +`v1.0.87` `added` + +**Function Illustrate** + +> 刷新当前 Xposed 模块自身 `Resources`。 + +## onAppLifecycle - method + +```kotlin:no-line-numbers +inline fun onAppLifecycle(initiate: AppLifecycle.() -> Unit) +``` + +**Change Records** + +`v1.0.88` `added` + +**Function Illustrate** + +> 监听当前 Hook APP 生命周期装载事件。 + +::: warning + +在 **loadZygote** 中不会被装载,仅会在 **loadSystem**、**loadApp** 中装载。 + +作为 Hook API 装载时请使用原生的 **Application** 实现生命周期监听。 + +::: + +## loadApp - method + +```kotlin:no-line-numbers +inline fun loadApp(name: String, initiate: PackageParam.() -> Unit) +``` + +```kotlin:no-line-numbers +fun loadApp(name: String, hooker: YukiBaseHooker) +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.80` `modified` + +将方法体进行 inline + +**Function Illustrate** + +> 装载并 Hook 指定包名的 APP。 + +`name` 为 APP 的包名,后方的两个参数一个可作为 `lambda` 方法体使用,一个可以直接装载子 Hooker。 + +装载并 Hook 指定、全部包名的 APP。 + +若要装载 APP Zygote 事件,请使用 `loadZygote`。 + +若要 Hook 系统框架,请使用 `loadSystem`。 + +**Function Example** + +你可以使用 `loadApp` 的 `lambda` 方法体形式或直接装载一个 Hooker。 + +> The following example + +```kotlin +// 使用 lambda +loadApp(name = "com.example.test") { + // Your code here. +} +// 使用 Hooker +loadApp(name = "com.example.test", CustomHooker) +``` + +若不指定 `name` 参数,则此方法体默认会过滤当前系统中全部可被 Hook 的 APP。 + +> The following example + +```kotlin +// 使用 lambda +loadApp { + // Your code here. +} +// 使用 Hooker +loadApp(hooker = CustomHooker) +``` + +## loadZygote - method + +```kotlin:no-line-numbers +inline fun loadZygote(initiate: PackageParam.() -> Unit) +``` + +```kotlin:no-line-numbers +fun loadZygote(hooker: YukiBaseHooker) +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 装载 APP Zygote 事件。 + +方法中的两个参数一个可作为 `lambda` 方法体使用,一个可以直接装载子 Hooker。 + +## loadSystem - method + +```kotlin:no-line-numbers +inline fun loadSystem(initiate: PackageParam.() -> Unit) +``` + +```kotlin:no-line-numbers +fun loadSystem(hooker: YukiBaseHooker) +``` + +**Change Records** + +`v1.0.82` `added` + +**Function Illustrate** + +> 装载并 Hook 系统框架。 + +方法中的两个参数一个可作为 `lambda` 方法体使用,一个可以直接装载子 Hooker。 + +## withProcess - method + +```kotlin:no-line-numbers +inline fun withProcess(name: String, initiate: PackageParam.() -> Unit) +``` + +```kotlin:no-line-numbers +fun withProcess(name: String, hooker: YukiBaseHooker) +``` + +**Change Records** + +`v1.0.70` `added` + +**Function Illustrate** + +> 装载并 Hook APP 的指定进程。 + +`name` 为 APP 的进程名称,后方的两个参数一个可作为 `lambda` 方法体使用,一个可以直接装载子 Hooker。 + +## loadHooker - method + +```kotlin:no-line-numbers +fun loadHooker(hooker: YukiBaseHooker) +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 装载 Hook 子类。 + +你可以填入 `hooker` 在 Hooker 中继续装载 Hooker。 + +## searchClass - method + +```kotlin:no-line-numbers +inline fun searchClass(name: String, async: Boolean, initiate: ClassConditions): DexClassFinder.Result +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 通过 `appClassLoader` 按指定条件查找并得到当前 Hook APP **Dex** 中的 `Class`。 + +::: danger + +此方法在 **Class** 数量过多及查找条件复杂时会非常耗时。 + +建议启用 **async** 或设置 **name** 参数,**name** 参数将在 Hook APP (宿主) 不同版本中自动进行本地缓存以提升效率。 + +此功能尚在试验阶段,性能与稳定性可能仍然存在问题,使用过程遇到问题请向我们报告并帮助我们改进。 + +::: + +

String+VariousClass.clazz - i-ext-field

+ +**Change Records** + +`v1.0` `first` + +`v1.1.0` `deprecated` + +请转移到 `toClass(...)` 方法 + +

String.hasClass - i-ext-field

+ +**Change Records** + +`v1.0` `first` + +`v1.1.0` `deprecated` + +请转移到 `hasClass(...)` 方法 + +## String+VariousClass.toClass - i-ext-method + +```kotlin:no-line-numbers +fun String.toClass(loader: ClassLoader?): Class<*> +``` + +```kotlin:no-line-numbers +fun VariousClass.toClass(loader: ClassLoader?): Class<*> +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 通过字符串类名、`VariousClass` 转换为 `loader` 中的实体类。 + +默认使用当前 `appClassLoader` 装载目标 `Class`。 + +**Function Example** + +你可以轻松地将 `String` 类型的 `Class` 包名转为 `Class` 实例。 + +> The following example + +```kotlin +"com.example.demo.DemoClass".toClass() +``` + +你还可以向 `loader` 参数传入你自定义的 `ClassLoader`。 + +> The following example + +```kotlin +val customClassLoader: ClassLoader? = ... // 假设这个就是你的 ClassLoader +"com.example.demo.DemoClass".toClass(customClassLoader) +``` + +你还可以创建一个 `VariousClass`,并转换为实体类。 + +`VariousClass` 会枚举所有设置的 `Class` 并最终获得第一个存在的 `Class`。 + +> The following example + +```kotlin +VariousClass("com.example.demo.DemoClass1", "com.example.demo.DemoClass2").toClass() +``` + +同样地,你还可以向 `loader` 参数传入你自定义的 `ClassLoader`。 + +> The following example + +```kotlin +val customClassLoader: ClassLoader? = ... // 假设这个就是你的 ClassLoader +VariousClass("com.example.demo.DemoClass1", "com.example.demo.DemoClass2").toClass(customClassLoader) +``` + +## String+VariousClass.toClassOrNull - i-ext-method + +```kotlin:no-line-numbers +fun String.toClassOrNull(loader: ClassLoader?): Class<*>? +``` + +```kotlin:no-line-numbers +fun VariousClass.toClassOrNull(loader: ClassLoader?): Class<*>? +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 通过字符串类名、`VariousClass` 转换为 `loader` 中的实体类。 + +默认使用当前 `appClassLoader` 装载目标 `Class`。 + +找不到 `Class` 会返回 `null`,不会抛出异常。 + +**Function Example** + +用法请参考 [String+VariousClass.toClass](#string-variousclass-toclass-i-ext-method) 方法。 + +## String.hasClass - i-ext-method + +```kotlin:no-line-numbers +fun String.hasClass(loader: ClassLoader?): Boolean +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 通过字符串类名查找是否存在。 + +默认使用当前 `appClassLoader` 装载目标 `Class`。 + +**Function Example** + +你可以轻松的使用此方法判断字符串中的类是否存在。 + +> The following example + +```kotlin +if("com.example.demo.DemoClass".hasClass()) { + // Your code here. +} +``` + +你还可以自定义其中的 `loader` 参数,默认为 `appClassLoader`。 + +> The following example + +```kotlin +val customClassLoader: ClassLoader? = ... // 假设这个就是你的 ClassLoader +if("com.example.demo.DemoClass".hasClass(customClassLoader)) { + // Your code here. +} +``` + +## findClass - method + +```kotlin:no-line-numbers +fun findClass(name: String, loader: ClassLoader?): HookClass +``` + +```kotlin:no-line-numbers +fun findClass(vararg name: String, loader: ClassLoader?): VariousClass +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.1` `modified` + +移除了 ~~`findClass(various: VariousClass)`~~ 方法 + +`v1.1.0` `modified` + +新增 `loader` 参数 + +**Function Illustrate** + +> 通过完整包名+名称查找需要被 Hook 的 `Class`。 + +::: warning + +使用此方法会得到一个 **HookClass** 仅用于 Hook,若想查找 **Class** 请使用 [toClass](#string-variousclass-toclass-i-ext-method) 功能。 + +::: + +**Function Example** + +你可以使用三种方式查找你需要 Hook 的目标 `Class`。 + +你可以直接将被查找的 `Class` 完整包名+名称填入 `name` 中。 + +> The following example + +```kotlin +findClass(name = "com.example.demo.DemoClass") +``` + +若你不确定多个版本的 `Class` 以及不同名称,你可以将多个完整包名+名称填入 `name` 中。 + +> The following example + +```kotlin +findClass("com.example.demo.DemoClass1", "com.example.demo.DemoClass2", "com.example.demo.DemoClass3") +``` + +你还可以创建一个 `VariousClass`,将 `Class` 的完整包名+名称填入 `VariousClass` 的 `name` 中并填入 `various` 参数中。 + +> The following example + +```kotlin +val variousClass = VariousClass("com.example.demo.DemoClass1", "com.example.demo.DemoClass2", "com.example.demo.DemoClass3") +``` + +若你当前需要查找的 `Class` 不属于 `appClassLoader`,你可以使用 `loader` 参数指定你要装载的 `ClassLoader`。 + +> The following example + +```kotlin +val outsideLoader: ClassLoader? = ... // 假设这就是你的 ClassLoader +findClass(name = "com.example.demo.OutsideClass", loader = outsideLoader) +``` + +同样地,在不确定多个版本的 `Class` 以及不同名称时,也可以使用 `loader` 参数指定你要装载的 `ClassLoader`。 + +> The following example + +```kotlin +val outsideLoader: ClassLoader? = ... // 假设这就是你的 ClassLoader +findClass("com.example.demo.OutsideClass1", "com.example.demo.OutsideClass2", "com.example.demo.OutsideClass3", loader = outsideLoader) +``` + +## String+Class+VariousClass+HookClass.hook - i-ext-method + +```kotlin:no-line-numbers +inline fun String.hook(initiate: YukiMemberHookCreator.() -> Unit): YukiMemberHookCreator.Result +``` + +```kotlin:no-line-numbers +inline fun Class<*>.hook(isForceUseAbsolute: Boolean, initiate: YukiMemberHookCreator.() -> Unit): YukiMemberHookCreator.Result +``` + +```kotlin:no-line-numbers +inline fun VariousClass.hook(initiate: YukiMemberHookCreator.() -> Unit): YukiMemberHookCreator.Result +``` + +```kotlin:no-line-numbers +inline fun HookClass.hook(initiate: YukiMemberHookCreator.() -> Unit): YukiMemberHookCreator.Result +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.1` `modified` + +新增 `VariousClass` 的直接调用 `hook` 方法 + +`v1.0.2` `modified` + +新增 `String` 的直接调用 `hook` 方法 + +`v1.0.3` `modified` + +新增 `YukiMemberHookCreator.Result` 返回值 + +`v1.0.70` `modified` + +新增 `isUseAppClassLoader` 参数 + +`v1.0.80` `modified` + +将方法体进行 inline + +`v1.1.0` `modified` + +移除了 ~~`isUseAppClassLoader`~~ 参数 + +添加了 `isForceUseAbsolute` 参数到 `Class.hook` 方法 + +**Function Illustrate** + +> 这是一切 Hook 的入口创建方法,Hook 方法、构造方法。 + +**Function Example** + +如你所见,Hook 方法体的创建可使用 4 种方式。 + +通过字符串类名得到 `HookClass` 实例进行创建。 + +> The following example + +```kotlin +"com.example.demo.DemoClass".hook { + // Your code here. +} + +``` +通过 `findClass` 得到 `HookClass` 实例进行创建。 + +> The following example + +```kotlin +findClass(name = "com.example.demo.DemoClass").hook { + // Your code here. +} +``` + +使用 `stub` 或直接拿到 `Class` 实例进行创建。 + +默认情况下 API 会将 `Class` 实例转换为类名并绑定到 `appClassLoader`,若失败,则会使用原始 `Class` 实例直接进行 Hook。 + +> The following example + +```kotlin +Stub::class.java.hook { + // Your code here. +} +``` + +若当前 `Class` 不在 `appClassLoader` 且自动匹配无法找到该 `Class`,请启用 `isForceUseAbsolute`。 + +> The following example + +```kotlin +YourClass::class.java.hook(isForceUseAbsolute = true) { + // Your code here. +} +``` + +使用 `VariousClass` 实例进行创建。 + +> The following example + +```kotlin +VariousClass("com.example.demo.DemoClass1", "com.example.demo.DemoClass2").hook { + // Your code here. +} +``` + +或者直接使用可变字符串数组进行创建。 + +> The following example + +```kotlin +findClass("com.example.demo.DemoClass1", "com.example.demo.DemoClass2").hook { + // Your code here. +} +``` + +## HookResources.hook - i-ext-method + +```kotlin:no-line-numbers +inline fun HookResources.hook(initiate: YukiResourcesHookCreator.() -> Unit) +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> Hook APP 的 Resources。 + +::: danger + +请注意你需要确保当前 Hook Framework 支持且 **InjectYukiHookWithXposed.isUsingResourcesHook** 已启用。 + +::: + +**Function Example** + +Resources Hook 为固定用法,获取 `resources` 对象,然后调用 `hook` 方法开始 Hook。 + +> The following example + +```kotlin +resources().hook { + // Your code here. +} +``` + +::: danger + +这是固定用法,为了防止发生问题,你不可手动实现任何 **HookResources** 实例执行 **hook** 调用。 + +::: + +将 Resources 的 Hook 设置为这样是为了与 `findClass(...).hook` 做到统一,使得调用起来逻辑不会混乱。 + +## AppLifecycle - class + +```kotlin:no-line-numbers +inner class AppLifecycle internal constructor() +``` + +**Change Records** + +`v1.0.88` `added` + +**Function Illustrate** + +> 当前 Hook APP 的生命周期实例处理类。 + +### attachBaseContext - method + +```kotlin:no-line-numbers +fun attachBaseContext(result: (baseContext: Context, hasCalledSuper: Boolean) -> Unit) +``` + +**Change Records** + +`v1.0.88` `added` + +**Function Illustrate** + +> 监听当前 Hook APP 装载 `Application.attachBaseContext`。 + +### onCreate - method + +```kotlin:no-line-numbers +fun onCreate(initiate: Application.() -> Unit) +``` + +**Change Records** + +`v1.0.88` `added` + +**Function Illustrate** + +> 监听当前 Hook APP 装载 `Application.onCreate`。 + +### onTerminate - method + +```kotlin:no-line-numbers +fun onTerminate(initiate: Application.() -> Unit) +``` + +**Change Records** + +`v1.0.88` `added` + +**Function Illustrate** + +> 监听当前 Hook APP 装载 `Application.onTerminate`。 + +### onLowMemory - method + +```kotlin:no-line-numbers +fun onLowMemory(initiate: Application.() -> Unit) +``` + +**Change Records** + +`v1.0.88` `added` + +**Function Illustrate** + +> 监听当前 Hook APP 装载 `Application.onLowMemory`。 + +### onTrimMemory - method + +```kotlin:no-line-numbers +fun onTrimMemory(result: (self: Application, level: Int) -> Unit) +``` + +**Change Records** + +`v1.0.88` `added` + +**Function Illustrate** + +> 监听当前 Hook APP 装载 `Application.onTrimMemory`。 + +### onConfigurationChanged - method + +```kotlin:no-line-numbers +fun onConfigurationChanged(result: (self: Application, config: Configuration) -> Unit) +``` + +**Change Records** + +`v1.0.88` `added` + +**Function Illustrate** + +> 监听当前 Hook APP 装载 `Application.onConfigurationChanged`。 + +### registerReceiver - method + +```kotlin:no-line-numbers +fun registerReceiver(vararg action: String, result: (context: Context, intent: Intent) -> Unit) +``` + +**Change Records** + +`v1.0.88` `added` + +**Function Illustrate** + +> 注册系统广播监听。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.md new file mode 100644 index 00000000..93e905c4 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.md @@ -0,0 +1,23 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# ComponentTypeFactory - kt + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 这是一个预置 Hook 类型的常量类,主要为 `Android` 相关组件的 `Class` 内容,跟随版本更新会逐一进行增加。 + +详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.kt) 进行查看。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.md new file mode 100644 index 00000000..61fe4517 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.md @@ -0,0 +1,23 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# GraphicsTypeFactory - kt + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 这是一个预置 Hook 类型的常量类,主要为 `Android` 相关 `Graphics` 的 `Class` 内容,跟随版本更新会逐一进行增加。 + +详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.kt) 进行查看。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.md new file mode 100644 index 00000000..363009a0 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.md @@ -0,0 +1,23 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# ViewTypeFactory - kt + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 这是一个预置 Hook 类型的常量类,主要为 `Android` 相关 `Widget` 的 `Class` 内容,跟随版本更新会逐一进行增加。 + +详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.kt) 进行查看。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/defined/DefinedTypeFactory.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/defined/DefinedTypeFactory.md new file mode 100644 index 00000000..cd43f6da --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/defined/DefinedTypeFactory.md @@ -0,0 +1,35 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# DefinedTypeFactory - kt + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 这是一个内部类型的定义常量类,主要用于反射 API 相关用法的延伸。 + +## VagueType - field + +```kotlin:no-line-numbers +val VagueType: Class<*> +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 得到模糊类型。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.md new file mode 100644 index 00000000..04a89266 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.md @@ -0,0 +1,23 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# VariableTypeFactory - kt + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 这是一个预置 Hook 类型的常量类,主要为 `Java` 相关基本变量类型的 `Class` 内容,跟随版本更新会逐一进行增加。 + +详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.kt) 进行查看。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/application/ModuleApplication.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/application/ModuleApplication.md new file mode 100644 index 00000000..24d7a67d --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/application/ModuleApplication.md @@ -0,0 +1,92 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# ModuleApplication - class + +```kotlin:no-line-numbers +open class ModuleApplication: Application() +``` + +**Change Records** + +`v1.0.77` `added` + +**Function Illustrate** + +> 这是对使用 `YukiHookAPI` Xposed 模块实现中的一个扩展功能。 + +在你的 Xposed 模块的 `Application` 中继承此类。 + +或在 `AndroidManifest.xml` 的 `application` 标签中指定此类。 + +目前可实现功能如下 + +- 全局共享模块中静态的 `appContext` + +- 在模块与宿主中装载 `YukiHookAPI.Config` 以确保 `YukiHookAPI.Configs.debugTag` 不需要重复定义 + +- 在模块与宿主中使用 `YukiHookDataChannel` 进行通讯 + +- 在模块中使用系统隐藏 API,核心技术引用了开源项目 [FreeReflection](https://github.com/tiann/FreeReflection) + +- 在模块中使用 `YukiHookAPI.Status.isTaiChiModuleActive` 判断太极、无极激活状态 + +**Function Example** + +将此类继承到你的自定义 `Application` 上。 + +> The following example + +```kotlin +package com.demo + +class MyApplication: ModuleApplication() { + + override fun onCreate() { + super.onCreate() + } +} +``` + +在 `AndroidManifest.xml` 的 `application` 标签中指定自定义的 `Application`。 + +> The following example + +```xml + +``` + +如果你不需要自定义 `Application` 可以直接将 `ModuleApplication` 设置到 `AndroidManifest.xml` 的 `application` 标签中。 + +> The following example + +```xml + +``` + +## appContext - field + +```kotlin:no-line-numbers +val appContext: ModuleApplication +``` + +**Change Records** + +`v1.0.77` `added` + +**Function Illustrate** + +> 获取全局静态 `Application` 实例。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/dummy/YukiModuleResources.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/dummy/YukiModuleResources.md new file mode 100644 index 00000000..1dbb1775 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/dummy/YukiModuleResources.md @@ -0,0 +1,41 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# YukiModuleResources - class + +```kotlin:no-line-numbers +class YukiModuleResources private constructor(private val baseInstance: XModuleResources) : Resources +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 对接 `XModuleResources` 的中间层实例。 + +## fwd - method + +```kotlin:no-line-numbers +fun fwd(resId: Int): YukiResForwarder +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 对接 `XModuleResources.fwd` 方法。 + +创建 `YukiResForwarder` 与 `XResForwarder` 实例。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/dummy/YukiResForwarder.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/dummy/YukiResForwarder.md new file mode 100644 index 00000000..d642bdd3 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/dummy/YukiResForwarder.md @@ -0,0 +1,63 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# YukiResForwarder - class + +```kotlin:no-line-numbers +class YukiResForwarder private constructor(private val baseInstance: XResForwarder) +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 对接 `XResForwarder` 的中间层实例。 + +

instance - field

+ +**Change Records** + +`v1.0.80` `added` + +`v1.1.0` `deprecated` + +不再对外公开 `instance` 参数 + +## id - field + +```kotlin:no-line-numbers +val id: Int +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 获得当前 APP 的 Resources Id。 + +## resources - field + +```kotlin:no-line-numbers +val resources: Resources +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 获得当前 APP 的 Resources。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/dummy/YukiResources.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/dummy/YukiResources.md new file mode 100644 index 00000000..72e78b5c --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/dummy/YukiResources.md @@ -0,0 +1,89 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# YukiResources - class + +```kotlin:no-line-numbers +class YukiResources private constructor(private val baseInstance: XResources) : Resources +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 对接 `XResources` 的中间层实例。 + +## LayoutInflatedParam - class + +```kotlin:no-line-numbers +class LayoutInflatedParam(internal val baseParam: XC_LayoutInflated.LayoutInflatedParam) +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 装载 Hook APP 的目标布局 Resources 实现类。 + +### variantName - field + +```kotlin:no-line-numbers +val variantName: String +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 获取当前被 Hook 的布局装载目录名称。 + +例如:`layout`、`layout-land`、`layout-sw600dp`。 + +### currentView - field + +```kotlin:no-line-numbers +val currentView: View +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 获取当前被 Hook 的布局实例。 + +### findViewByIdentifier - method + +```kotlin:no-line-numbers +inline fun View.findViewByIdentifier(name: String): T? +``` + +```kotlin:no-line-numbers +inline fun findViewByIdentifier(name: String): T? +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 使用 Identifier 查找 Hook APP 指定 Id 的 `View`。 + +扩展方法可以使用 Identifier 查找 Hook APP 当前装载布局中指定 Id 的 `View`。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/event/YukiXposedEvent.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/event/YukiXposedEvent.md new file mode 100644 index 00000000..59b46666 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/event/YukiXposedEvent.md @@ -0,0 +1,81 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# YukiXposedEvent - object + +```kotlin:no-line-numbers +object YukiXposedEvent +``` + +**Change Records** + +`v1.0.80` `first` + +**Function Illustrate** + +> 实现对原生 Xposed API 的装载事件监听。 + +## events - method + +```kotlin:no-line-numbers +inline fun events(initiate: YukiXposedEvent.() -> Unit) +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 对 `YukiXposedEvent` 创建一个方法体。 + +## onInitZygote - method + +```kotlin:no-line-numbers +fun onInitZygote(result: (StartupParam) -> Unit) +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 设置 initZygote 事件监听。 + +## onHandleLoadPackage - method + +```kotlin:no-line-numbers +fun onHandleLoadPackage(result: (LoadPackageParam) -> Unit) +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 设置 handleLoadPackage 事件监听。 + +## onHandleInitPackageResources - method + +```kotlin:no-line-numbers +fun onHandleInitPackageResources(result: (InitPackageResourcesParam) -> Unit) +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 设置 handleInitPackageResources 事件监听。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.md new file mode 100644 index 00000000..292fa505 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.md @@ -0,0 +1,161 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# YukiHookDataChannel - class + +```kotlin:no-line-numbers +class YukiHookDataChannel private constructor() +``` + +**Change Records** + +`v1.0.88` `added` + +**Function Illustrate** + +> 实现 Xposed 模块的数据通讯桥。 + +通过模块与宿主相互注册 `BroadcastReceiver` 来实现数据的交互。 + +模块需要将 `Application` 继承于 `ModuleApplication` 来实现此功能。 + +::: danger + +模块与宿主需要保持存活状态,否则无法建立通讯。 + +::: + +## NameSpace - class + +```kotlin:no-line-numbers +inner class NameSpace internal constructor(private val context: Context?, private val packageName: String, private val isSecure: Boolean) +``` + +**Change Records** + +`v1.0.88` `added` + +`v1.0.90` `modified` + +新增 `isSecure` 参数 + +**Function Illustrate** + +> `YukiHookDataChannel` 命名空间。 + +### with - method + +```kotlin:no-line-numbers +inline fun with(initiate: NameSpace.() -> Unit): NameSpace +``` + +**Change Records** + +`v1.0.88` `added` + +**Function Illustrate** + +> 创建一个调用空间。 + +### put - method + +```kotlin:no-line-numbers +fun put(key: String, value: T) +``` + +```kotlin:no-line-numbers +fun put(data: ChannelData, value: T?) +``` + +```kotlin:no-line-numbers +fun put(vararg data: ChannelData<*>) +``` + +**Change Records** + +`v1.0.88` `added` + +**Function Illustrate** + +> 发送键值数据。 + +### put - method + +```kotlin:no-line-numbers +fun put(key: String) +``` + +**Change Records** + +`v1.0.88` `added` + +**Function Illustrate** + +> 仅发送键值监听,使用默认值 `VALUE_WAIT_FOR_LISTENER` 发送键值数据。 + +### wait - method + +```kotlin:no-line-numbers +fun wait(key: String, result: (value: T) -> Unit) +``` + +```kotlin:no-line-numbers +fun wait(data: ChannelData, result: (value: T) -> Unit) +``` + +**Change Records** + +`v1.0.88` `added` + +`v1.0.90` `modified` + +移除默认值 `value` + +**Function Illustrate** + +> 获取键值数据。 + +### wait - method + +```kotlin:no-line-numbers +fun wait(key: String, callback: () -> Unit) +``` + +**Change Records** + +`v1.0.88` `added` + +**Function Illustrate** + +> 仅获取监听结果,不获取键值数据。 + +::: danger + +仅限使用 **VALUE_WAIT_FOR_LISTENER** 发送的监听才能被接收。 + +::: + +### checkingVersionEquals - method + +```kotlin:no-line-numbers +fun checkingVersionEquals(result: (Boolean) -> Unit) +``` + +**Change Records** + +`v1.0.88` `added` + +**Function Illustrate** + +> 获取模块与宿主的版本是否匹配。 + +通过此方法可原生判断 Xposed 模块更新后宿主并未重新装载造成两者不匹配的情况。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/channel/data/ChannelData.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/channel/data/ChannelData.md new file mode 100644 index 00000000..56a23e97 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/channel/data/ChannelData.md @@ -0,0 +1,76 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# ChannelData - class + +```kotlin:no-line-numbers +data class ChannelData(var key: String, var value: T?) +``` + +**Change Records** + +`v1.0.88` `added` + +**Function Illustrate** + +> 数据通讯桥键值构造类。 + +这个类是对 `YukiHookDataChannel` 的一个扩展用法。 + +**Function Example** + +建立一个模板类定义模块与宿主需要发送的键值数据。 + +> The following example + +```kotlin +object DataConst { + + val TEST_KV_DATA_1 = ChannelData("test_data_1", "defalut value") + val TEST_KV_DATA_2 = ChannelData("test_data_2", 0) +} +``` + +键值数据定义后,你就可以方便地在模块和宿主中调用所需要发送的数据。 + +> 模块示例如下 + +```kotlin +// 从指定包名的宿主获取 +dataChannel(packageName = "com.example.demo").wait(DataConst.TEST_KV_DATA_1) { value -> + // Your code here. +} +// 发送给指定包名的宿主 - 未填写 value 时将使用模板提供的默认值 +dataChannel(packageName = "com.example.demo").put(DataConst.TEST_KV_DATA_1, value = "sending value") +``` + +> 宿主示例如下 + +```kotlin +// 从模块获取 +dataChannel.wait(DataConst.TEST_KV_DATA_1) { value -> + // Your code here. +} +// 发送给模块 - 未填写 value 时将使用模板提供的默认值 +dataChannel.put(DataConst.TEST_KV_DATA_1, value = "sending value") +``` + +你依然可以不使用模板定义的默认值,随时修改你的默认值。 + +> The following example + +```kotlin +// 获取 - 此时 value 取到的默认值将会是 2 - 并不是模板提供的 0 +dataChannel.wait(DataConst.TEST_KV_DATA_2, value = 2) { value -> + // Your code here. +} +``` \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppActivity.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppActivity.md new file mode 100644 index 00000000..cfd08655 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppActivity.md @@ -0,0 +1,29 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# ModuleAppActivity - class + +```kotlin:no-line-numbers +open class ModuleAppActivity : Activity() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 代理 `Activity`。 + +继承于此类的 `Activity` 可以同时在宿主与模块中启动。 + +在 (Xposed) 宿主环境需要在宿主启动时调用 `Context.registerModuleAppActivities` 进行注册。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppCompatActivity.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppCompatActivity.md new file mode 100644 index 00000000..50ace5f6 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppCompatActivity.md @@ -0,0 +1,45 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# ModuleAppCompatActivity - class + +```kotlin:no-line-numbers +open class ModuleAppCompatActivity : AppCompatActivity() +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 代理 `AppCompatActivity`。 + +继承于此类的 `Activity` 可以同时在宿主与模块中启动。 + +在 (Xposed) 宿主环境需要在宿主启动时调用 `Context.registerModuleAppActivities` 进行注册。 + +在 (Xposed) 宿主环境需要重写 `moduleTheme` 设置 AppCompat 主题,否则会无法启动。 + +## moduleTheme - field + +```kotlin:no-line-numbers +open val moduleTheme: Int +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置当前代理的 `Activity` 主题。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/context/wrapper/ModuleContextThemeWrapper.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/context/wrapper/ModuleContextThemeWrapper.md new file mode 100644 index 00000000..4700385c --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/context/wrapper/ModuleContextThemeWrapper.md @@ -0,0 +1,43 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# ModuleContextThemeWrapper - class + +```kotlin:no-line-numbers +class ModuleContextThemeWrapper private constructor(baseContext: Context, theme: Int, configuration: Configuration?) : ContextThemeWrapper +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 代理 `ContextThemeWrapper`。 + +通过包装,你可以轻松在 (Xposed) 宿主环境使用来自模块的主题资源。 + +## applyConfiguration - method + +```kotlin:no-line-numbers +fun applyConfiguration(initiate: Configuration.() -> Unit): ModuleContextThemeWrapper +``` + +**Change Records** + +`v1.1.0` `added` + +**Function Illustrate** + +> 设置当前 `ModuleContextThemeWrapper` 的 `Configuration`。 + +设置后会自动调用 `Resources.updateConfiguration`。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookModulePrefs.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookModulePrefs.md new file mode 100644 index 00000000..341c52ef --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookModulePrefs.md @@ -0,0 +1,499 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# YukiHookModulePrefs - class + +```kotlin:no-line-numbers +class YukiHookModulePrefs private constructor(private var context: Context?) +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 实现 Xposed 模块的数据存取,对接 `SharedPreferences` 和 `XSharedPreferences`。 + +在不同环境智能选择存取使用的对象。 + +::: danger + +此功能为实验性功能,仅在 LSPosed 环境测试通过,EdXposed 理论也可以使用但不再推荐。 + +::: + +使用 LSPosed 环境请在 `AndroidManifests.xml` 中将 `xposedminversion` 最低设置为 `93`。 + +详见 [New XSharedPreferences](https://github.com/LSPosed/LSPosed/wiki/New-XSharedPreferences#for-the-module)。 + +若你在按照规定配置后依然无法使用或出现文件权限错误问题,可以参考 [isEnableHookSharedPreferences](../../../YukiHookAPI#isenablehooksharedpreferences-field)。 + +未使用 LSPosed 环境请将你的模块 `API` 降至 `26` 以下,`YukiHookAPI` 将会尝试使用 `makeWorldReadable` 但仍有可能不成功。 + +太极请参阅 [文件权限/配置/XSharedPreference](https://taichi.cool/zh/doc/for-xposed-dev.html#文件权限-配置-xsharedpreference)。 + +::: danger + +当你在 Xposed 模块中存取数据的时候 **context** 必须不能是空的。 + +::: + +若你正在使用 `PreferenceFragmentCompat`,请迁移到 `ModulePreferenceFragment` 以适配上述功能特性。 + +**可选配置** + +若你不想将你的模块的 `xposedminversion` 最低设置为 `93`,你可以在 `AndroidManifest.xml` 中添加 `xposedsharedprefs` 来实现支持。 + +详见 [New XSharedPreferences](https://github.com/LSPosed/LSPosed/wiki/New-XSharedPreferences#for-the-module)。 + +> The following example + +```xml + +``` + +## isXSharePrefsReadable - field + +```kotlin:no-line-numbers +val isXSharePrefsReadable: Boolean +``` + +**Change Records** + +`v1.0.90` `added` + +**Function Illustrate** + +> 获取 `XSharedPreferences` 是否可读。 + +::: danger + +只能在 (Xposed) 宿主环境中使用,模块环境中始终返回 false。 + +::: + +## isRunInNewXShareMode - field + +```kotlin:no-line-numbers +val isRunInNewXShareMode: Boolean +``` + +**Change Records** + +`v1.0.78` `added` + +**Function Illustrate** + +> 获取 `YukiHookModulePrefs` 是否正处于 EdXposed/LSPosed 的最高权限运行。 + +前提条件为当前 Xposed 模块已被激活。 + +::: danger + +只能在模块环境中使用,(Xposed) 宿主环境中始终返回 false。 + +::: + +## name - method + +```kotlin:no-line-numbers +fun name(name: String): YukiHookModulePrefs +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 自定义 Sp 存储名称。 + +**Function Example** + +在 `Activity` 中的使用方法。 + +> The following example + +```kotlin +modulePrefs("custom_name").getString("custom_key") +``` + +在 (Xposed) 宿主环境 `PackageParam` 中的使用方法。 + +> The following example + +```kotlin +prefs("custom_name").getString("custom_key") +``` + +## direct - method + +```kotlin:no-line-numbers +fun direct(): YukiHookModulePrefs +``` + +**Change Records** + +`v1.0.5` `added` + +**Function Illustrate** + +> 忽略缓存直接读取键值。 + +无论是否开启 `YukiHookAPI.Configs.isEnableModulePrefsCache`。 + +仅在 `XSharedPreferences` 下生效。 + +## getString - method + +```kotlin:no-line-numbers +fun getString(key: String, value: String): String +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 获取 `String` 键值。 + +## getStringSet - method + +```kotlin:no-line-numbers +fun getStringSet(key: String, value: Set): Set +``` + +**Change Records** + +`v1.0.77` `added` + +**Function Illustrate** + +> 获取 `Set` 键值。 + +## getBoolean - method + +```kotlin:no-line-numbers +fun getBoolean(key: String, value: Boolean): Boolean +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 获取 `Boolean` 键值。 + +## getInt - method + +```kotlin:no-line-numbers +fun getInt(key: String, value: Int): Int +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 获取 `Int` 键值。 + +## getLong - method + +```kotlin:no-line-numbers +fun getLong(key: String, value: Long): Long +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 获取 `Long` 键值。 + +## getFloat - method + +```kotlin:no-line-numbers +fun getFloat(key: String, value: Float): Float +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 获取 `Float` 键值。 + +## all - method + +```kotlin:no-line-numbers +fun all(): HashMap +``` + +**Change Records** + +`v1.0.77` `added` + +**Function Illustrate** + +> 获取全部存储的键值数据。 + +智能识别对应环境读取键值数据。 + +::: danger + +每次调用都会获取实时的数据,不受缓存控制,请勿在高并发场景中使用。 + +::: + +## remove - method + +```kotlin:no-line-numbers +fun remove(key: String) +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 移除全部包含 `key` 的存储数据。 + +::: warning + +在 (Xposed) 宿主环境下只读,无法使用。 + +::: + +## remove - method + +```kotlin:no-line-numbers +inline fun remove(prefs: PrefsData) +``` + +**Change Records** + +`v1.0.67` `added` + +**Function Illustrate** + +> 移除 `PrefsData.key` 的存储数据。 + +::: warning + +在 (Xposed) 宿主环境下只读,无法使用。 + +::: + +## clear - method + +```kotlin:no-line-numbers +fun clear() +``` + +**Change Records** + +`v1.0.77` `added` + +**Function Illustrate** + +> 移除全部存储数据。 + +::: warning + +在 (Xposed) 宿主环境下只读,无法使用。 + +::: + +## putString - method + +```kotlin:no-line-numbers +fun putString(key: String, value: String) +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 存储 `String` 键值。 + +::: warning + +在 (Xposed) 宿主环境下只读,无法使用。 + +::: + +## putStringSet - method + +```kotlin:no-line-numbers +fun putStringSet(key: String, value: Set) +``` + +**Change Records** + +`v1.0.77` `added` + +**Function Illustrate** + +> 存储 `Set` 键值。 + +::: warning + +在 (Xposed) 宿主环境下只读,无法使用。 + +::: + +## putBoolean - method + +```kotlin:no-line-numbers +fun putBoolean(key: String, value: Boolean) +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 存储 `Boolean` 键值。 + +::: warning + +在 (Xposed) 宿主环境下只读,无法使用。 + +::: + +## putInt - method + +```kotlin:no-line-numbers +fun putInt(key: String, value: Int) +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 存储 `Int` 键值。 + +::: warning + +在 (Xposed) 宿主环境下只读,无法使用。 + +::: + +## putLong - method + +```kotlin:no-line-numbers +fun putLong(key: String, value: Long) +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 存储 `Long` 键值。 + +::: warning + +在 (Xposed) 宿主环境下只读,无法使用。 + +::: + +## putFloat - method + +```kotlin:no-line-numbers +fun putFloat(key: String, value: Float) +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> 存储 `Float` 键值。 + +::: warning + +在 (Xposed) 宿主环境下只读,无法使用。 + +::: + +## get - method + +```kotlin:no-line-numbers +inline fun get(prefs: PrefsData, value: T): T +``` + +**Change Records** + +`v1.0.67` `added` + +**Function Illustrate** + +> 智能获取指定类型的键值。 + +## put - method + +```kotlin:no-line-numbers +inline fun put(prefs: PrefsData, value: T) +``` + +**Change Records** + +`v1.0.67` `added` + +**Function Illustrate** + +> 智能存储指定类型的键值。 + +::: warning + +在 (Xposed) 宿主环境下只读,无法使用。 + +::: + +## clearCache - method + +```kotlin:no-line-numbers +fun clearCache() +``` + +**Change Records** + +`v1.0.5` `added` + +**Function Illustrate** + +> 清除 `XSharedPreferences` 中缓存的键值数据。 + +无论是否开启 `YukiHookAPI.Configs.isEnableModulePrefsCache`。 + +调用此方法将清除当前存储的全部键值缓存。 + +下次将从 `XSharedPreferences` 重新读取。 + +在 (Xposed) 宿主环境中使用。 \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/data/PrefsData.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/data/PrefsData.md new file mode 100644 index 00000000..39708cbe --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/data/PrefsData.md @@ -0,0 +1,71 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# PrefsData - class + +```kotlin:no-line-numbers +data class PrefsData(var key: String, var value: T) +``` + +**Change Records** + +`v1.0.67` `added` + +**Function Illustrate** + +> 键值对存储构造类。 + +这个类是对 `YukiHookModulePrefs` 的一个扩展用法。 + +**Function Example** + +建立一个模板类定义模块与宿主需要使用的键值数据。 + +> The following example + +```kotlin +object DataConst { + + val TEST_KV_DATA_1 = PrefsData("test_data_1", "defalut value") + val TEST_KV_DATA_2 = PrefsData("test_data_2", false) + val TEST_KV_DATA_3 = PrefsData("test_data_3", 0) +} +``` + +键值数据定义后,你就可以方便地在模块和宿主中调用所需要的数据。 + +> 模块示例如下 + +```kotlin +// 读取 +val data = modulePrefs.get(DataConst.TEST_KV_DATA_1) +// 写入 +modulePrefs.put(DataConst.TEST_KV_DATA_1, "written value") +``` + +> 宿主示例如下 + +```kotlin +// 读取 String +val dataString = prefs.get(DataConst.TEST_KV_DATA_1) +// 读取 Boolean +val dataBoolean = prefs.get(DataConst.TEST_KV_DATA_2) +``` + +你依然可以不使用模板定义的默认值,随时修改你的默认值。 + +> The following example + +```kotlin +// 读取 - 此时 data 取到的默认值将会是 2 - 并不是模板提供的 0 +val data = prefs.get(DataConst.TEST_KV_DATA_3, 2) +``` \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/ui/ModulePreferenceFragment.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/ui/ModulePreferenceFragment.md new file mode 100644 index 00000000..58b903db --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/ui/ModulePreferenceFragment.md @@ -0,0 +1,101 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# ModulePreferenceFragment - class + +```kotlin:no-line-numbers +abstract class ModulePreferenceFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedPreferenceChangeListener +``` + +**Change Records** + +`v1.0.78` `added` + +**Function Illustrate** + +> 这是对使用 `YukiHookAPI` Xposed 模块实现中的一个扩展功能。 + +此类接管了 `PreferenceFragmentCompat` 并对其实现了 Sp 存储在 Xposed 模块中的全局可读可写。 + +在你使用 `PreferenceFragmentCompat` 的实例中,将继承对象换成此类。 + +然后请将重写方法由 `onCreatePreferences` 替换为 `onCreatePreferencesInModuleApp` 即可。 + +**Function Example** + +使用 `ModulePreferenceFragment` 创建一个 `PreferenceFragmentCompat` 对象。 + +> The following example + +```kotlin +class SettingsFragment : ModulePreferenceFragment() { + + override fun onCreatePreferencesInModuleApp(savedInstanceState: Bundle?, rootKey: String?) { + setPreferencesFromResource(R.xml.settings_preferences, rootKey) + // Your code here. + } +} +``` + +其余用法与 `PreferenceFragmentCompat` 保持一致。 + +## onCreatePreferencesInModuleApp - method + +```kotlin:no-line-numbers +abstract fun onCreatePreferencesInModuleApp(savedInstanceState: Bundle?, rootKey: String?) +``` + +**Change Records** + +`v1.0.78` `added` + +**Function Illustrate** + +> 对接原始方法 `onCreatePreferences`。 + +## onSharedPreferenceChanged - method + +```kotlin:no-line-numbers +override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) +``` + +**Change Records** + +`v1.0.78` `added` + +**Function Illustrate** + +> 实现了 `SharedPreferences.OnSharedPreferenceChangeListener` 的原生监听功能。 + +**Function Example** + +::: warning + +在使用 **onSharedPreferenceChanged** 时请保留 super 方法。 + +::: + +> The following example + +```kotlin +class SettingsFragment : ModulePreferenceFragment() { + + override fun onCreatePreferencesInModuleApp(savedInstanceState: Bundle?, rootKey: String?) { + // ... + } + + override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) { + super.onSharedPreferenceChanged(sharedPreferences, key) + // Your code here. + } +} +``` \ No newline at end of file diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/proxy/IYukiHookXposedInit.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/proxy/IYukiHookXposedInit.md new file mode 100644 index 00000000..aa454166 --- /dev/null +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/proxy/IYukiHookXposedInit.md @@ -0,0 +1,109 @@ +--- +pageClass: code-page +--- + +::: warning + +The English translation of this page has not been completed, you are welcome to contribute translations to us. + +You can use the **Chrome Translation Plugin** to translate entire pages for reference. + +::: + +# IYukiHookXposedInit - interface + +```kotlin:no-line-numbers +interface IYukiHookXposedInit +``` + +**Change Records** + +`v1.0` `first` + +`v1.0.80` `modified` `deprecated` + +作废了 ~~`YukiHookXposedInitProxy`~~ 名称但保留接口 + +转移到 `IYukiHookXposedInit` 新名称 + +**Function Illustrate** + +> YukiHookAPI 的 Xposed 装载 API 调用接口。 + +## onInit - method + +```kotlin:no-line-numbers +fun onInit() +``` + +**Change Records** + +`v1.0.5` `added` + +**Function Illustrate** + +> 配置 `YukiHookAPI.Configs` 的初始化方法。 + +::: danger + +在这里只能进行初始化配置,不能进行 Hook 操作。 + +::: + +此方法可选,你也可以选择不对 [YukiHookAPI.Configs](../../../YukiHookAPI#configs-object) 进行配置。 + +## onHook - method + +```kotlin:no-line-numbers +fun onHook() +``` + +**Change Records** + +`v1.0` `first` + +**Function Illustrate** + +> Xposed API 的模块装载调用入口方法。 + +## onXposedEvent - method + +```kotlin:no-line-numbers +fun onXposedEvent() +``` + +**Change Records** + +`v1.0.80` `added` + +**Function Illustrate** + +> 监听 Xposed 原生装载事件。 + +若你的 Hook 事件中存在需要兼容的原生 Xposed 功能,可在这里实现。 + +请在这里使用 [YukiXposedEvent](../bridge/event/YukiXposedEvent) 创建回调事件监听。 + +可监听的事件如下: + +`YukiXposedEvent.onInitZygote` + +`YukiXposedEvent.onHandleLoadPackage` + +`YukiXposedEvent.onHandleInitPackageResources` + +::: danger + +此接口仅供监听和实现原生 Xposed API 的功能,请不要在这里操作 **YukiHookAPI**。 + +::: + +

YukiHookXposedInitProxy - interface

+ +**Change Records** + +`v1.0` `first` + +`v1.0.80` `deprecated` + +请转移到 `IYukiHookXposedInit` \ No newline at end of file