类 ResourceMapping
java.lang.Object
io.github.amsonix.molt.internal.reschiper.bundle.ResourceMapping
The ResourceMapping class represents a mapping of resources, directories, and entry files
used for obfuscating resource-related data within Android apps.
It provides methods to manage and write these mapping rules to a file.
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidaddResourceNameAndId(String name, String id) Adds a resource name and its corresponding ID to the mapping.voidaddResourcePathAndId(String path, String id) Adds a resource path and its corresponding ID to the mapping.Gets the directory mapping.Gets the entry files mapping.Gets a list of simple names from the directory mapping.Gets the resource mapping.static StringgetResourceSimpleName(@NotNull String resourceName) Extracts the simple name from a resource path.voidputApkResourceMapping(String rawResource, String obfuscateResource) APK arsc 映射:key 为type/name,混淆名在不同 type 下可重复(与 AAB 全限定名不同)。voidputDirMapping(String rawPath, String obfuscatePath) Adds a directory mapping to the resource mapping.voidputEntryFileMapping(String rawPath, String obfuscatedPath) Adds an entry file mapping to the entry files mapping.voidputResourceMapping(String rawResource, String obfuscateResource) Adds a resource mapping to the resource mapping.voidwriteMappingToFile(@NotNull Path mappingPath) Writes the mapping rules to a file at the specified path.
-
构造器详细资料
-
ResourceMapping
public ResourceMapping()Constructs an empty ResourceMapping object.
-
-
方法详细资料
-
getResourceSimpleName
@Contract(pure=true) public static String getResourceSimpleName(@NotNull @NotNull String resourceName) Extracts the simple name from a resource path.- 参数:
resourceName- The resource name containing the path.- 返回:
- The simple name of the resource.
-
getDirMapping
Gets the directory mapping.- 返回:
- A map of raw directory paths to obfuscate directory paths.
-
getResourceMapping
Gets the resource mapping.- 返回:
- A map of raw resource names to obfuscate resource names.
-
getEntryFilesMapping
Gets the entry files mapping.- 返回:
- A map of raw entry file paths to obfuscated entry file paths.
-
putDirMapping
Adds a directory mapping to the resource mapping.- 参数:
rawPath- The raw directory path.obfuscatePath- The obfuscated directory path.
-
putResourceMapping
Adds a resource mapping to the resource mapping.- 参数:
rawResource- The raw resource name.obfuscateResource- The obfuscated resource name.- 抛出:
IllegalArgumentException- if the obfuscateResource already exists in the mapping.
-
putApkResourceMapping
APK arsc 映射:key 为type/name,混淆名在不同 type 下可重复(与 AAB 全限定名不同)。 -
putEntryFileMapping
Adds an entry file mapping to the entry files mapping.- 参数:
rawPath- The raw entry file path.obfuscatedPath- The obfuscated entry file path.
-
getPathMappingNameList
Gets a list of simple names from the directory mapping.- 返回:
- A list of simple names extracted from obfuscated directory paths.
-
addResourceNameAndId
Adds a resource name and its corresponding ID to the mapping.- 参数:
name- The resource name.id- The ID associated with the resource name.
-
addResourcePathAndId
Adds a resource path and its corresponding ID to the mapping.- 参数:
path- The resource path.id- The ID associated with the resource path.
-
writeMappingToFile
Writes the mapping rules to a file at the specified path.- 参数:
mappingPath- The path to the mapping file.- 抛出:
IOException- If there is an issue with file I/O.
-