API Update

This commit is contained in:
Konloch 2021-07-11 05:37:13 -07:00
parent 21fe12b4a7
commit 64bce4c201

View file

@ -45,75 +45,6 @@ import static the.bytecode.club.bytecodeviewer.Constants.*;
public class KrakatauDisassembler extends InternalDecompiler
{
public String decompileClassNode(File krakatauTempJar, File krakatauTempDir, ClassNode cn) {
if (Configuration.python2.isEmpty()) {
BytecodeViewer.showMessage("You need to set your Python (or PyPy for speed) 2.7 executable path.");
ExternalResources.getSingleton().selectPython2();
}
if (Configuration.python2.isEmpty()) {
BytecodeViewer.showMessage("You need to set Python!");
return "Set your paths";
}
String s = "Bytecode Viewer Version: " + VERSION + nl + nl +
"Please send this to konloch@gmail.com. " + nl + nl;
BytecodeViewer.sm.pauseBlocking();
try {
ProcessBuilder pb = new ProcessBuilder(
Configuration.python2,
"-O", //love you storyyeller <3
krakatauWorkingDirectory + fs + "disassemble.py",
"-path",
krakatauTempJar.getAbsolutePath(),
"-out",
krakatauTempDir.getAbsolutePath(),
cn.name + ".class"
);
Process process = pb.start();
BytecodeViewer.createdProcesses.add(process);
//Read out dir output
InputStream is = process.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
StringBuilder log = new StringBuilder("Process:" + nl + nl);
String line;
while ((line = br.readLine()) != null) {
log.append(nl).append(line);
}
br.close();
log.append(nl).append(nl).append("Error:").append(nl)
.append(nl);
is = process.getErrorStream();
isr = new InputStreamReader(is);
br = new BufferedReader(isr);
while ((line = br.readLine()) != null) {
log.append(nl).append(line);
}
br.close();
int exitValue = process.waitFor();
log.append(nl).append(nl).append("Exit Value is ").append(exitValue);
s = log.toString();
//if the motherfucker failed this'll fail, aka wont set.
s = DiskReader.loadAsString(krakatauTempDir.getAbsolutePath() + fs + cn.name + ".j");
} catch (Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
s += nl + "Bytecode Viewer Version: " + VERSION + nl + nl + sw;
} finally {
BytecodeViewer.sm.resumeBlocking();
}
return s;
}
@Override
public String decompileClassNode(ClassNode cn, byte[] b) {
if (Configuration.python2.isEmpty()) {