Modify move Result to Process for Hooker in MethodFinder, ConstructorFinder and YukiMemberHookCreater

This commit is contained in:
2022-08-28 22:39:45 +08:00
parent 0f0bd40916
commit c93e6a563e
8 changed files with 506 additions and 149 deletions

View File

@@ -228,6 +228,115 @@ constructor {
}
```
### Process *- class*
```kotlin
inner class Process internal constructor(internal val isNoSuch: Boolean, internal val throwable: Throwable?) : BaseResult
```
**变更记录**
`v1.0.93` `新增`
**功能描述**
> `Constructor` 查找结果处理类,为 `hookInstance` 提供。
#### result *- method*
```kotlin
inline fun result(initiate: Process.() -> Unit): Process
```
**变更记录**
`v1.0.93` `新增`
**功能描述**
> 创建监听结果事件方法体。
**功能示例**
你可以使用 `lambda` 形式创建 `Result` 类。
> 示例如下
```kotlin
constructor {
// Your code here.
}.result {
all()
remedys {}
onNoSuchConstructor {}
}
```
#### all *- method*
```kotlin
fun all(): Process
```
**变更记录**
`v1.0.93` `新增`
**功能描述**
> 设置全部查询条件匹配的多个 `Constructor` 实例结果到 `hookInstance`。
#### remedys *- method*
```kotlin
inline fun remedys(initiate: RemedyPlan.() -> Unit): Result
```
**变更记录**
`v1.0.93` `新增`
**功能描述**
> 创建 `Constructor` 重查找功能。
**功能示例**
当你遇到一种 `Constructor` 可能存在不同形式的存在时,可以使用 `RemedyPlan` 重新查找它,而没有必要使用 `onNoSuchConstructor` 捕获异常二次查找 `Constructor`
若第一次查找失败了,你还可以在这里继续添加此方法体直到成功为止。
> 示例如下
```kotlin
constructor {
// Your code here.
}.remedys {
constructor {
// Your code here.
}
constructor {
// Your code here.
}
}
```
#### onNoSuchConstructor *- method*
```kotlin
inline fun onNoSuchConstructor(result: (Throwable) -> Unit): Result
```
**变更记录**
`v1.0.93` `新增`
**功能描述**
> 监听找不到 `Constructor` 时。
只会返回第一次的错误信息,不会返回 `RemedyPlan` 的错误信息。
### Result *- class*
```kotlin
@@ -345,7 +454,7 @@ fun all(): ArrayList<Instance>
> 获得 `Constructor` 实例处理类数组。
返回全部查询条件匹配的多个 `Constructor` 实例结果并在 `isBindToHooker` 时设置到 `hookInstance`
返回全部查询条件匹配的多个 `Constructor` 实例结果。
**功能示例**