Search in sources :

Example 1 with ResTableParser

use of jadx.core.xmlgen.ResTableParser in project jadx by skylot.

the class RootNode method loadResources.

public void loadResources(List<ResourceFile> resources) {
    ResourceFile arsc = null;
    for (ResourceFile rf : resources) {
        if (rf.getType() == ResourceType.ARSC) {
            arsc = rf;
            break;
        }
    }
    if (arsc == null) {
        LOG.debug("'.arsc' file not found");
        return;
    }
    final ResTableParser parser = new ResTableParser();
    try {
        ResourcesLoader.decodeStream(arsc, new ResourcesLoader.ResourceDecoder() {

            @Override
            public ResContainer decode(long size, InputStream is) throws IOException {
                parser.decode(is);
                return null;
            }
        });
    } catch (JadxException e) {
        LOG.error("Failed to parse '.arsc' file", e);
        return;
    }
    ResourceStorage resStorage = parser.getResStorage();
    constValues.setResourcesNames(resStorage.getResourcesNames());
    appPackage = resStorage.getAppPackage();
}
Also used : JadxException(jadx.core.utils.exceptions.JadxException) ResourceFile(jadx.api.ResourceFile) ResourcesLoader(jadx.api.ResourcesLoader) ResTableParser(jadx.core.xmlgen.ResTableParser) ResContainer(jadx.core.xmlgen.ResContainer) InputStream(java.io.InputStream) ResourceStorage(jadx.core.xmlgen.ResourceStorage) IOException(java.io.IOException)

Aggregations

ResourceFile (jadx.api.ResourceFile)1 ResourcesLoader (jadx.api.ResourcesLoader)1 JadxException (jadx.core.utils.exceptions.JadxException)1 ResContainer (jadx.core.xmlgen.ResContainer)1 ResTableParser (jadx.core.xmlgen.ResTableParser)1 ResourceStorage (jadx.core.xmlgen.ResourceStorage)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1