Skip to content

Commit

Permalink
1.4 Released
Browse files Browse the repository at this point in the history
11/1/2014 - Fixed FernFlower save Java files on Unix.
11/1/2014 - FernFlower now uses the settings for save Java files.
11/1/2014 - Added Procyon save Java files (It uses the settings).
11/1/2014 - Updated CFR to cfr_0_89.
11/1/2014 - Added CFR save Java files (It uses the settings), however it
relies on the file system, because of this if there is heavy name
obfuscation, it could mess up for windows.
  • Loading branch information
Konloch committed Nov 2, 2014
1 parent 2175437 commit 9e2bfbc
Show file tree
Hide file tree
Showing 11 changed files with 214 additions and 68 deletions.
Binary file added BytecodeViewer Beta 1.4.jar
Binary file not shown.
10 changes: 8 additions & 2 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ Changelog:
10/29/2014 - Tried to fix the issue with JSyntaxPane by making it create the object in a background thread, it still freezes the UI. Changes kept for later implementation of another syntax highlighter.
10/29/2014 - Sped up start up time
--- Beta 1.3.1 ---:
10/29/2014 - Replaced JSyntaxPane with RSyntaxArea, this sadly removes the search feature inside of source/bytecode files, I'll implement a search function soon.
10/29/2014 - Replaced JSyntaxPane with RSyntaxArea, this sadly removes the search feature inside of source/bytecode files, I'll implement a search function soon. (This also fixes the JRE 1.8 issue)
10/29/2014 - Added a new decompiler option to append brackets to labels.
10/31/2014 - Fixed an issue with the decompiler still running when the source code pane isn't toggled.
10/31/2014 - Fixed an issue with the decompiler still running when the source code pane isn't toggled.
--- Beta 1.4 ---:
11/1/2014 - Fixed FernFlower save Java files on Unix.
11/1/2014 - FernFlower now uses the settings for save Java files.
11/1/2014 - Added Procyon save Java files (It uses the settings).
11/1/2014 - Updated CFR to cfr_0_89.
11/1/2014 - Added CFR save Java files (It uses the settings), however it relies on the file system, because of this if there is heavy name obfuscation, it could mess up for windows.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Beta 1.3.1
Beta 1.4
Binary file renamed libs/cfr_0_88.jar → libs/cfr_0_89.jar
Binary file not shown.
Binary file removed libs/jsyntaxpane-0.9.5-b29 (1).jar
Binary file not shown.
Binary file added libs/rsyntaxtextarea.jar
Binary file not shown.
12 changes: 9 additions & 3 deletions src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,15 @@
* 10/29/2014 - Tried to fix the issue with JSyntaxPane by making it create the object in a background thread, it still freezes the UI. Changes kept for later implementation of another syntax highlighter.
* 10/29/2014 - Sped up start up time.
* ----Beta 1.3.1-----:
* 10/29/2014 - Replaced JSyntaxPane with RSyntaxArea, this sadly removes the search feature inside of source/bytecode files, I'll implement a search function soon.
* 10/29/2014 - Replaced JSyntaxPane with RSyntaxArea, this sadly removes the search feature inside of source/bytecode files, I'll implement a search function soon. (This also fixes the JRE 1.8 issue)
* 10/29/2014 - Added a new decompiler option to append brackets to labels.
* 10/31/2014 - Fixed an issue with the decompiler still running when the source code pane isn't toggled.
* ----Beta 1.4-----:
* 11/1/2014 - Fixed FernFlower save Java files on Unix.
* 11/1/2014 - FernFlower now uses the settings for save Java files.
* 11/1/2014 - Added Procyon save Java files (It uses the settings).
* 11/1/2014 - Updated CFR to cfr_0_89.
* 11/1/2014 - Added CFR save Java files (It uses the settings), however it relies on the file system, because of this if there is heavy name obfuscation, it could mess up for windows.
*
* @author Konloch
*
Expand All @@ -156,10 +162,10 @@ public class BytecodeViewer {
private static ArrayList<String> recentFiles = DiskReader.loadArrayList(filesName, false);
private static ArrayList<String> recentPlugins = DiskReader.loadArrayList(pluginsName, false);
private static int maxRecentFiles = 25;
public static String tempDirectory = "bcv_temp";
public static String fs = System.getProperty("file.separator");
public static String nl = System.getProperty("line.separator");
public static String version = "Beta 1.3.1";
public static String tempDirectory = "bcv_temp";
public static String version = "Beta 1.4";

public static void main(String[] args) {
cleanup();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
package the.bytecode.club.bytecodeviewer.decompilers.java;

import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Deque;
import java.util.LinkedList;
import java.util.Random;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

import me.konloch.kontainer.io.DiskReader;

import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.ClassNode;

import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.JarUtils;

/**
*
Expand Down Expand Up @@ -168,29 +177,82 @@ public String[] generateMainMethod(String filePath, String outputPath) {
};
}

byte[] buffer = new byte[1024];
@Override
public void decompileToZip(String zipName) {
/*
File tempZip = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp.jar");
if(tempZip.exists())
tempZip.delete();

JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), tempZip.getAbsolutePath());

String fileStart = BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp";

String fuckery = fuckery(fileStart);
org.benf.cfr.reader.Main.main(generateMainMethod(tempZip.getAbsolutePath(), fuckery));

org.benf.cfr.reader.Main.main(generateMainMethod(tempZip.getAbsolutePath(), fuckery));

tempZip.delete();
for(File f : new File(fuckery).listFiles()) {
//put contents into a zipfile
}*/
BytecodeViewer.showMessage("CFRDecompiler currently doesn't decompile as zip, please wait till Beta 1.4 of Bytecode Viewer.");

File fuck = new File(fuckery);

try {
zip(fuck, new File(zipName));
} catch (IOException e) {
e.printStackTrace();
}

fuck.delete();
}

@SuppressWarnings("resource")
public void zip(File directory, File zipfile) throws IOException {
java.net.URI base = directory.toURI();
Deque<File> queue = new LinkedList<File>();
queue.push(directory);
OutputStream out = new FileOutputStream(zipfile);
Closeable res = out;
try {
ZipOutputStream zout = new ZipOutputStream(out);
res = zout;
while (!queue.isEmpty()) {
directory = queue.pop();
for (File kid : directory.listFiles()) {
String name = base.relativize(kid.toURI()).getPath();
if (kid.isDirectory()) {
queue.push(kid);
name = name.endsWith("/") ? name : name + "/";
zout.putNextEntry(new ZipEntry(name));
} else {
zout.putNextEntry(new ZipEntry(name));
copy(kid, zout);
zout.closeEntry();
}
}
}
} finally {
res.close();
out.close();
}
}

private static void copy(InputStream in, OutputStream out) throws IOException {
byte[] buffer = new byte[1024];
while (true) {
int readCount = in.read(buffer);
if (readCount < 0) {
break;
}
out.write(buffer, 0, readCount);
}
}

private static void copy(File file, OutputStream out) throws IOException {
InputStream in = new FileInputStream(file);
try {
copy(in, out);
} finally {
in.close();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ public void decompileToZip(String zipName) {
if(tempZip.exists())
tempZip.delete();

File f = new File(BytecodeViewer.tempDirectory + "./temp/");
File f = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs +"temp" + BytecodeViewer.fs);
f.mkdir();

JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), tempZip.getAbsolutePath());

org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler.main(new String[] {tempZip.getAbsolutePath(), BytecodeViewer.tempDirectory + "./temp/"});
org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler.main(generateMainMethod(tempZip.getAbsolutePath(), BytecodeViewer.tempDirectory + "./temp/"));
File tempZip2 = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + BytecodeViewer.fs +tempZip.getName());
if(tempZip2.exists())
tempZip2.renameTo(new File(zipName));
Expand Down

0 comments on commit 9e2bfbc

Please sign in to comment.