add ignoredError function

This commit is contained in:
2022-03-02 02:34:04 +08:00
parent d8f722fa57
commit 4ccd4069fa
4 changed files with 37 additions and 1 deletions

View File

@@ -262,6 +262,17 @@ class ConstructorFinder(
return this
}
/**
* 忽略任何错误发出的警告
*
* - 若 [isNotIgnoredHookingFailure] 为 false 则自动忽略
* @return [Result] 可继续向下监听
*/
fun ignoredError(): Result {
isShutErrorPrinting = true
return this
}
/**
* [Constructor] 实例处理类
*

View File

@@ -152,6 +152,17 @@ class FieldFinder(
return this
}
/**
* 忽略任何错误发出的警告
*
* - 若 [isNotIgnoredHookingFailure] 为 false 则自动忽略
* @return [Result] 可继续向下监听
*/
fun ignoredError(): Result {
isShutErrorPrinting = true
return this
}
/**
* [Field] 实例变量处理类
* @param instance 当前 [Field] 所在类的实例对象

View File

@@ -290,6 +290,17 @@ class MethodFinder(
return this
}
/**
* 忽略任何错误发出的警告
*
* - 若 [isNotIgnoredHookingFailure] 为 false 则自动忽略
* @return [Result] 可继续向下监听
*/
fun ignoredError(): Result {
isShutErrorPrinting = true
return this
}
/**
* [Method] 实例处理类
* @param instance 当前 [Method] 所在类的实例对象

View File

@@ -47,6 +47,9 @@ abstract class BaseFinder(
open val classSet: Class<*>? = null
) {
/** 是否开启忽略错误警告功能 */
internal var isShutErrorPrinting = false
/** 是否使用了重查找功能 */
internal var isUsingRemedyPlan = false
@@ -76,7 +79,7 @@ abstract class BaseFinder(
if (isAlwaysPrint) print()
else Thread {
SystemClock.sleep(10)
if (isNotIgnoredHookingFailure && !isUsingRemedyPlan) print()
if (isNotIgnoredHookingFailure && !isUsingRemedyPlan && !isShutErrorPrinting) print()
}.start()
}