use of jadx.api.ICodeInfo in project jadx by skylot.
the class ResXmlGen method makeResourcesXml.
public List<ResContainer> makeResourcesXml() {
Map<String, ICodeWriter> contMap = new HashMap<>();
for (ResourceEntry ri : resStorage.getResources()) {
if (SKIP_RES_TYPES.contains(ri.getTypeName())) {
continue;
}
String fn = getFileName(ri);
ICodeWriter cw = contMap.get(fn);
if (cw == null) {
cw = new SimpleCodeWriter();
cw.add("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
cw.startLine("<resources>");
cw.incIndent();
contMap.put(fn, cw);
}
addValue(cw, ri);
}
List<ResContainer> files = new ArrayList<>(contMap.size());
for (Map.Entry<String, ICodeWriter> entry : contMap.entrySet()) {
String fileName = entry.getKey();
ICodeWriter content = entry.getValue();
content.decIndent();
content.startLine("</resources>");
ICodeInfo codeInfo = content.finish();
files.add(ResContainer.textResource(fileName, codeInfo));
}
Collections.sort(files);
return files;
}
use of jadx.api.ICodeInfo in project jadx by skylot.
the class IntegrationTest method decompileAndCheck.
protected void decompileAndCheck(List<ClassNode> clsList) {
// keep error and warning attributes
clsList.forEach(cls -> cls.add(AFlag.DONT_UNLOAD_CLASS));
clsList.forEach(ClassNode::decompile);
for (ClassNode cls : clsList) {
System.out.println("-----------------------------------------------------------");
ICodeInfo code = cls.getCode();
if (printLineNumbers) {
printCodeWithLineNumbers(code);
} else if (printOffsets) {
printCodeWithOffsets(code);
} else {
System.out.println(code);
}
}
System.out.println("-----------------------------------------------------------");
if (printDisassemble) {
clsList.forEach(this::printDisasm);
}
runChecks(clsList);
}
use of jadx.api.ICodeInfo in project jadx by skylot.
the class ExportGradleTest method createResourceContainer.
protected ResContainer createResourceContainer(String filename) {
final ResContainer container = mock(ResContainer.class);
ICodeInfo codeInfo = mock(ICodeInfo.class);
when(codeInfo.getCodeStr()).thenReturn(loadFileContent(new File(MANIFEST_TESTS_DIR, filename)));
when(container.getText()).thenReturn(codeInfo);
return container;
}
use of jadx.api.ICodeInfo in project jadx by skylot.
the class JadxClassNodeAssertions method decompile.
public JadxCodeInfoAssertions decompile() {
isNotNull();
ICodeInfo codeInfo = actual.getCode();
Assertions.assertThat(codeInfo).isNotNull();
return new JadxCodeInfoAssertions(codeInfo);
}
use of jadx.api.ICodeInfo in project jadx by skylot.
the class CodePanel method canShowDebugLines.
private boolean canShowDebugLines() {
ICodeInfo codeInfo = codeArea.getNode().getCodeInfo();
if (codeInfo == null) {
return false;
}
Map<Integer, Integer> lineMapping = codeInfo.getLineMapping();
if (lineMapping.isEmpty()) {
return false;
}
Set<Integer> uniqueDebugLines = new HashSet<>(lineMapping.values());
return uniqueDebugLines.size() > 3;
}
Aggregations