Merge code

This commit is contained in:
2022-04-05 21:01:32 +08:00
parent 111618112d
commit 5296e8078e
6 changed files with 12 additions and 12 deletions

View File

@@ -99,7 +99,7 @@ class YukiHookCreater(private val packageParam: PackageParam, private val hookCl
@YukiPrivateApi
fun hook(): Result {
if (YukiHookAPI.hasXposedBridge.not()) return Result()
return if (hookMembers.isEmpty()) error("Hook Members is empty,hook aborted")
return if (hookMembers.isEmpty()) error("Hook Members is empty, hook aborted")
else Result().also {
Thread {
/** 延迟使得方法取到返回值 */

View File

@@ -230,7 +230,7 @@ class ConstructorFinder(
)
remedyPlans.clear()
}
} else yLoggerW(msg = "RemedyPlan is empty,forgot it? [${hookTag}]")
} else yLoggerW(msg = "RemedyPlan is empty, forgot it? [${hookTag}]")
}
/**

View File

@@ -279,7 +279,7 @@ class MethodFinder(
)
remedyPlans.clear()
}
} else yLoggerW(msg = "RemedyPlan is empty,forgot it? [${hookTag}]")
} else yLoggerW(msg = "RemedyPlan is empty, forgot it? [${hookTag}]")
}
/**

View File

@@ -69,7 +69,7 @@ class HookParam(private val createrInstance: YukiHookCreater, private val wrappe
* @return [Any]
* @throws IllegalStateException 如果对象为空
*/
val instance get() = wrapper.instance ?: error("HookParam instance got null,Is this a static member?")
val instance get() = wrapper.instance ?: error("HookParam instance got null! Is this a static member?")
/**
* 获取当前 Hook 实例的类对象
@@ -271,8 +271,8 @@ class HookParam(private val createrInstance: YukiHookCreater, private val wrappe
* @throws IllegalStateException 如果目标方法参数对象数组为空或 [index] 下标不存在
*/
fun <T> set(any: T?) {
if (args.isEmpty()) error("HookParam method args is empty,mabe not has args")
if (index > args.lastIndex) error("HookParam method args index out of bounds,max is ${args.lastIndex}")
if (args.isEmpty()) error("HookParam method args is empty, mabe not has args")
if (index > args.lastIndex) error("HookParam method args index out of bounds, max is ${args.lastIndex}")
wrapper.setArgs(index, any)
}

View File

@@ -85,7 +85,7 @@ class YukiHookModulePrefs(private val context: Context? = null) {
private fun checkApi() {
if (YukiHookAPI.isLoadedFromBaseContext) error("YukiHookModulePrefs not allowed in Custom Hook API")
if (YukiHookAPI.hasXposedBridge && YukiHookXposedBridge.modulePackageName.isBlank())
error("Xposed modulePackageName load failed,please reset and rebuild it")
error("Xposed modulePackageName load failed, please reset and rebuild it")
}
/**
@@ -107,11 +107,11 @@ class YukiHookModulePrefs(private val context: Context? = null) {
get() = try {
checkApi()
context?.getSharedPreferences(prefsName, Context.MODE_WORLD_READABLE)
?: error("If you want to use module prefs,you must set the context instance first")
?: error("If you want to use module prefs, you must set the context instance first")
} catch (_: Throwable) {
checkApi()
context?.getSharedPreferences(prefsName, Context.MODE_PRIVATE)
?: error("If you want to use module prefs,you must set the context instance first")
?: error("If you want to use module prefs, you must set the context instance first")
}
/** 设置全局可读可写 */