mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-04 09:45:19 +08:00
Modify move FieldConditions, MethodConditions, ConstructorConditions, IntConditions to TypeAliasFactory (incorrectly added TODO to commit)
This commit is contained in:
@@ -31,8 +31,8 @@ package com.highcapable.yukihookapi.hook.bean
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.FieldFinder
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.MethodFinder
|
||||
import com.highcapable.yukihookapi.hook.factory.FieldConditions
|
||||
import com.highcapable.yukihookapi.hook.factory.MethodConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.FieldConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.MethodConditions
|
||||
import com.highcapable.yukihookapi.hook.factory.field
|
||||
import com.highcapable.yukihookapi.hook.factory.method
|
||||
|
||||
|
@@ -36,6 +36,9 @@ import com.highcapable.yukihookapi.hook.core.finder.base.MemberBaseFinder
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.ConstructorFinder
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.FieldFinder
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.MethodFinder
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ConstructorConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.FieldConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.MethodConditions
|
||||
import com.highcapable.yukihookapi.hook.factory.*
|
||||
import com.highcapable.yukihookapi.hook.log.yLoggerE
|
||||
import com.highcapable.yukihookapi.hook.log.yLoggerI
|
||||
|
@@ -37,13 +37,13 @@ import com.highcapable.yukihookapi.hook.core.finder.base.MemberBaseFinder
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.data.ConstructorRulesData
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.ModifierRules
|
||||
import com.highcapable.yukihookapi.hook.core.finder.tools.ReflectionTool
|
||||
import com.highcapable.yukihookapi.hook.factory.ConstructorConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ConstructorConditions
|
||||
import com.highcapable.yukihookapi.hook.factory.checkingInternal
|
||||
import com.highcapable.yukihookapi.hook.factory.hasExtends
|
||||
import com.highcapable.yukihookapi.hook.log.yLoggerW
|
||||
import com.highcapable.yukihookapi.hook.type.defined.UndefinedType
|
||||
import com.highcapable.yukihookapi.hook.type.defined.VagueType
|
||||
import com.highcapable.yukihookapi.hook.utils.IntConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.IntConditions
|
||||
import com.highcapable.yukihookapi.hook.utils.runBlocking
|
||||
import com.highcapable.yukihookapi.hook.utils.unit
|
||||
import java.lang.reflect.Constructor
|
||||
|
@@ -39,7 +39,7 @@ import com.highcapable.yukihookapi.hook.core.finder.members.data.FieldRulesData
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.ModifierRules
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.NameConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.tools.ReflectionTool
|
||||
import com.highcapable.yukihookapi.hook.factory.FieldConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.FieldConditions
|
||||
import com.highcapable.yukihookapi.hook.factory.checkingInternal
|
||||
import com.highcapable.yukihookapi.hook.factory.current
|
||||
import com.highcapable.yukihookapi.hook.factory.hasExtends
|
||||
|
@@ -38,13 +38,13 @@ import com.highcapable.yukihookapi.hook.core.finder.members.data.MethodRulesData
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.ModifierRules
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.NameConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.tools.ReflectionTool
|
||||
import com.highcapable.yukihookapi.hook.factory.MethodConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.MethodConditions
|
||||
import com.highcapable.yukihookapi.hook.factory.checkingInternal
|
||||
import com.highcapable.yukihookapi.hook.factory.hasExtends
|
||||
import com.highcapable.yukihookapi.hook.log.yLoggerW
|
||||
import com.highcapable.yukihookapi.hook.type.defined.UndefinedType
|
||||
import com.highcapable.yukihookapi.hook.type.defined.VagueType
|
||||
import com.highcapable.yukihookapi.hook.utils.IntConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.IntConditions
|
||||
import com.highcapable.yukihookapi.hook.utils.runBlocking
|
||||
import com.highcapable.yukihookapi.hook.utils.unit
|
||||
import com.highcapable.yukihookapi.hook.xposed.bridge.factory.YukiHookHelper
|
||||
|
@@ -27,7 +27,7 @@
|
||||
*/
|
||||
package com.highcapable.yukihookapi.hook.core.finder.members.data
|
||||
|
||||
import com.highcapable.yukihookapi.hook.utils.IntConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.IntConditions
|
||||
import java.lang.reflect.Constructor
|
||||
|
||||
/**
|
||||
|
@@ -28,7 +28,7 @@
|
||||
package com.highcapable.yukihookapi.hook.core.finder.members.data
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.finder.base.data.BaseRulesData
|
||||
import com.highcapable.yukihookapi.hook.utils.IntConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.IntConditions
|
||||
import java.lang.reflect.Member
|
||||
|
||||
/**
|
||||
|
@@ -28,7 +28,7 @@
|
||||
package com.highcapable.yukihookapi.hook.core.finder.members.data
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.NameConditions
|
||||
import com.highcapable.yukihookapi.hook.utils.IntConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.IntConditions
|
||||
import java.lang.reflect.Method
|
||||
|
||||
/**
|
||||
|
@@ -29,7 +29,7 @@
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.type
|
||||
|
||||
import com.highcapable.yukihookapi.hook.utils.IntConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.IntConditions
|
||||
import java.lang.reflect.Field
|
||||
import java.lang.reflect.Member
|
||||
import java.lang.reflect.Method
|
||||
|
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* YukiHookAPI - An efficient Kotlin version of the Xposed Hook API.
|
||||
* Copyright (C) 2019-2022 HighCapable
|
||||
* https://github.com/fankes/YukiHookAPI
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* This file is Created by fankes on 2022/9/14.
|
||||
*/
|
||||
package com.highcapable.yukihookapi.hook.core.finder.type.factory
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.ConstructorFinder
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.FieldFinder
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.MethodFinder
|
||||
|
||||
/** 定义 [FieldFinder] 方法体类型 */
|
||||
internal typealias FieldConditions = FieldFinder.() -> Unit
|
||||
|
||||
/** 定义 [MethodFinder] 方法体类型 */
|
||||
internal typealias MethodConditions = MethodFinder.() -> Unit
|
||||
|
||||
/** 定义 [ConstructorFinder] 方法体类型 */
|
||||
internal typealias ConstructorConditions = ConstructorFinder.() -> Unit
|
||||
|
||||
/** 定义 [Int] 方法体类型 */
|
||||
internal typealias IntConditions = (Int) -> Boolean
|
@@ -36,6 +36,9 @@ import com.highcapable.yukihookapi.hook.core.finder.members.FieldFinder
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.MethodFinder
|
||||
import com.highcapable.yukihookapi.hook.core.finder.tools.ReflectionTool
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.ModifierRules
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ConstructorConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.FieldConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.MethodConditions
|
||||
import com.highcapable.yukihookapi.hook.xposed.bridge.status.YukiHookModuleStatus
|
||||
import com.highcapable.yukihookapi.hook.xposed.parasitic.AppParasitics
|
||||
import java.lang.reflect.Constructor
|
||||
@@ -43,15 +46,6 @@ import java.lang.reflect.Field
|
||||
import java.lang.reflect.Member
|
||||
import java.lang.reflect.Method
|
||||
|
||||
/** 定义 [FieldFinder] 方法体类型 */
|
||||
internal typealias FieldConditions = FieldFinder.() -> Unit
|
||||
|
||||
/** 定义 [MethodFinder] 方法体类型 */
|
||||
internal typealias MethodConditions = MethodFinder.() -> Unit
|
||||
|
||||
/** 定义 [ConstructorFinder] 方法体类型 */
|
||||
internal typealias ConstructorConditions = ConstructorFinder.() -> Unit
|
||||
|
||||
/**
|
||||
* 定义一个 [Class] 中的 [Member] 类型
|
||||
*/
|
||||
@@ -144,6 +138,7 @@ inline fun Class<*>.hasConstructor(initiate: ConstructorConditions = { emptyPara
|
||||
* 查询 [Member] 中匹配的描述符
|
||||
* @param initiate 方法体
|
||||
* @return [Boolean] 是否存在
|
||||
* todo 这个也要改
|
||||
*/
|
||||
inline fun Member.hasModifiers(initiate: ModifierRules.() -> Unit) = ModifierRules().apply(initiate).contains(this)
|
||||
|
||||
@@ -151,6 +146,7 @@ inline fun Member.hasModifiers(initiate: ModifierRules.() -> Unit) = ModifierRul
|
||||
* 查询 [Class] 中匹配的描述符
|
||||
* @param initiate 方法体
|
||||
* @return [Boolean] 是否存在
|
||||
* todo 这个也要改
|
||||
*/
|
||||
inline fun Class<*>.hasModifiers(initiate: ModifierRules.() -> Unit) = ModifierRules().apply(initiate).contains(this)
|
||||
|
||||
|
@@ -31,9 +31,6 @@ import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/** 定义 [Int] 方法体类型 */
|
||||
internal typealias IntConditions = (Int) -> Boolean
|
||||
|
||||
/**
|
||||
* 创建当前线程池服务
|
||||
* @return [ExecutorService]
|
||||
|
Reference in New Issue
Block a user