Search in sources :

Example 1 with ResourceFileContent

use of jadx.api.ResourceFileContent in project jadx by skylot.

the class JResource method addSubFiles.

protected void addSubFiles(ResContainer rc, JResource root, int depth) {
    CodeWriter cw = rc.getContent();
    if (cw != null) {
        if (depth == 0) {
            root.lineMapping = cw.getLineMapping();
            root.content = cw.toString();
        } else {
            String name = rc.getName();
            String[] path = name.split("/");
            String shortName = path.length == 0 ? name : path[path.length - 1];
            ResourceFileContent fileContent = new ResourceFileContent(shortName, ResourceType.XML, cw);
            addPath(path, root, new JResource(fileContent, name, shortName, JResType.FILE));
        }
    }
    List<ResContainer> subFiles = rc.getSubFiles();
    if (!subFiles.isEmpty()) {
        for (ResContainer subFile : subFiles) {
            addSubFiles(subFile, root, depth + 1);
        }
    }
}
Also used : ResContainer(jadx.core.xmlgen.ResContainer) ResourceFileContent(jadx.api.ResourceFileContent) CodeWriter(jadx.core.codegen.CodeWriter)

Aggregations

ResourceFileContent (jadx.api.ResourceFileContent)1 CodeWriter (jadx.core.codegen.CodeWriter)1 ResContainer (jadx.core.xmlgen.ResContainer)1