diff --git a/BytecodeViewer 2.9.5.jar b/BytecodeViewer 2.9.6.jar similarity index 76% rename from BytecodeViewer 2.9.5.jar rename to BytecodeViewer 2.9.6.jar index af901d0e..4c42cc75 100644 Binary files a/BytecodeViewer 2.9.5.jar and b/BytecodeViewer 2.9.6.jar differ diff --git a/README.txt b/README.txt index c248b6fe..da3e93b9 100644 --- a/README.txt +++ b/README.txt @@ -349,4 +349,12 @@ Changelog: 04/21/2015 - The about pane now provides a lot more up to date information. 04/21/2015 - Changed 'View Panes' to simply 'View'. --- 2.9.5 ---: -05/01/2015 - Added 'pingback' for statistics (to track how many people globally use BCV) \ No newline at end of file +05/01/2015 - Added 'pingback' for statistics (to track how many people globally use BCV) +-----2.9.6-----: +05/05/2015 - Fixed a typo in the about window +05/28/2015 - Started importing JD-GUI Decompiler. +05/28/2015 - Compile on refresh and compile on save are now enabled by default. +05/28/2015 - Renamed the File>Save As options to be much more informative. +06/24/2015 - Fixed a logic error with the Field & Method searchers. +06/26/2015 - Updated Procyon & CFR to their latest versions. +07/02/2015 - Added JD-GUI Decompiler. - Huge thanks to the guys behind JD-GUI! <3 (FIVE DECOMPILERS NOW LOL) \ No newline at end of file diff --git a/install/_install BCV.64.bat b/install/_install BCV.64.bat deleted file mode 100644 index 33ef3088..00000000 --- a/install/_install BCV.64.bat +++ /dev/null @@ -1,14 +0,0 @@ -@echo off -assoc .class=BCV -assoc .apk=BCV -assoc .dex=BCV -ftype BCV="%CD%\BytecodeViewer.64.exe" "%%1" -echo. -echo. -echo Installed, .class, .apk and .dex will be associated with BytecodeViwer.64.exe -echo. -echo Note, if you move BytecodeViewer.64.exe -echo you'll need to re-run this program in the same directory as it. -echo. -echo. -pause \ No newline at end of file diff --git a/install/_install BCV.32.bat b/install/_install BCV.bat similarity index 65% rename from install/_install BCV.32.bat rename to install/_install BCV.bat index 249847b8..123a2700 100644 --- a/install/_install BCV.32.bat +++ b/install/_install BCV.bat @@ -2,12 +2,12 @@ assoc .class=BCV assoc .apk=BCV assoc .dex=BCV -ftype BCV="%CD%\BytecodeViewer.32.exe" "%%1" +ftype BCV="%CD%\BytecodeViewer.exe" "%%1" echo. echo. -echo Installed, .class, .apk and .dex will be associated with BytecodeViwer.32.exe +echo Installed, .class, .apk and .dex will be associated with BytecodeViwer.exe echo. -echo Note, if you move BytecodeViewer.32.exe +echo Note, if you move BytecodeViewer.exe echo you'll need to re-run this program in the same directory as it. echo. echo. diff --git a/install/launch4j_config.xml b/install/launch4j_config.xml new file mode 100644 index 00000000..4c0d5b40 --- /dev/null +++ b/install/launch4j_config.xml @@ -0,0 +1,38 @@ + + + false + gui + H:\Repo\BCV\bytecode-viewer\BytecodeViewer 2.9.6.jar + H:\Repo\BCV\bytecode-viewer\BytecodeViewer.exe + + + . + normal + http://java.com/download + + false + false + + H:\Repo\BCV\bytecode-viewer\BCV Icon.ico + + + false + false + 1.7.0_00 + + preferJre + 64/32 + + + 0.2.9.6 + http://the.bytecode.club + Bytecode Viewer + http://bytecodeviewer.com + 0.2.9.6 + http://the.bytecode.club + Bytecode Viewer + + BCV + Bytecode_Viewer.exe + + \ No newline at end of file diff --git a/libs/cfr_0_100.jar b/libs/cfr_0_101.jar similarity index 76% rename from libs/cfr_0_100.jar rename to libs/cfr_0_101.jar index 967f1551..977d9d3a 100644 Binary files a/libs/cfr_0_100.jar and b/libs/cfr_0_101.jar differ diff --git a/libs/procyon-decompiler-0.5.28.jar b/libs/procyon-decompiler-0.5.29.jar similarity index 83% rename from libs/procyon-decompiler-0.5.28.jar rename to libs/procyon-decompiler-0.5.29.jar index 9d639190..e7dccc91 100644 Binary files a/libs/procyon-decompiler-0.5.28.jar and b/libs/procyon-decompiler-0.5.29.jar differ diff --git a/src/jd/cli/Main.java b/src/jd/cli/Main.java new file mode 100644 index 00000000..11004a4f --- /dev/null +++ b/src/jd/cli/Main.java @@ -0,0 +1,54 @@ +package jd.cli; + +import java.io.File; +import java.io.PrintStream; + +import jd.cli.loader.DirectoryLoader; +import jd.cli.preferences.CommonPreferences; +import jd.cli.printer.text.PlainTextPrinter; +import jd.cli.util.ClassFileUtil; +import jd.core.Decompiler; +import jd.core.process.DecompilerImpl; + + +public class Main +{ + /** + * @param args Path to java class + */ + public static void main(String[] args) { + + if (args.length == 0) { + System.out.println("usage: ..."); + } else { + try { + String pathToClass = args[0].replace('/', File.separatorChar).replace('\\', File.separatorChar); + String directoryPath = ClassFileUtil.ExtractDirectoryPath(pathToClass); + + if (directoryPath == null) + return; + + String internalPath = ClassFileUtil.ExtractInternalPath(directoryPath, pathToClass); + + if (internalPath == null) + return; + + CommonPreferences preferences = new CommonPreferences(); + DirectoryLoader loader = new DirectoryLoader(new File(directoryPath)); + + //PrintStream ps = new PrintStream("test.html"); + //HtmlPrinter printer = new HtmlPrinter(ps); + PrintStream ps = new PrintStream("test.txt"); + PlainTextPrinter printer = new PlainTextPrinter(preferences, ps); + + Decompiler decompiler = new DecompilerImpl(); + decompiler.decompile(preferences, loader, printer, internalPath); + + System.out.println("done."); + + } catch (Exception e) { + e.printStackTrace(); + } + } + } +} diff --git a/src/jd/cli/loader/BaseLoader.java b/src/jd/cli/loader/BaseLoader.java new file mode 100644 index 00000000..67f6979a --- /dev/null +++ b/src/jd/cli/loader/BaseLoader.java @@ -0,0 +1,34 @@ +package jd.cli.loader; + +import java.io.File; + +import jd.core.loader.Loader; + +public abstract class BaseLoader implements Loader +{ + protected String codebase; + protected long lastModified; + protected boolean isFile; + + public BaseLoader(File file) + { + this.codebase = file.getAbsolutePath(); + this.lastModified = file.lastModified(); + this.isFile = file.isFile(); + } + + public String getCodebase() + { + return codebase; + } + + public long getLastModified() + { + return lastModified; + } + + public boolean isFile() + { + return isFile; + } +} diff --git a/src/jd/cli/loader/DirectoryLoader.java b/src/jd/cli/loader/DirectoryLoader.java new file mode 100644 index 00000000..1a85fcaf --- /dev/null +++ b/src/jd/cli/loader/DirectoryLoader.java @@ -0,0 +1,44 @@ +package jd.cli.loader; + +import java.io.BufferedInputStream; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; + +import jd.core.loader.LoaderException; + + +public class DirectoryLoader extends BaseLoader +{ + public DirectoryLoader(File file) throws LoaderException + { + super(file); + + if (! (file.exists() && file.isDirectory())) + throw new LoaderException("'" + codebase + "' is not a directory"); + } + + public DataInputStream load(String internalPath) + throws LoaderException + { + File file = new File(this.codebase, internalPath); + + try + { + return new DataInputStream( + new BufferedInputStream(new FileInputStream(file))); + } + catch (FileNotFoundException e) + { + throw new LoaderException( + "'" + file.getAbsolutePath() + "' not found."); + } + } + + public boolean canLoad(String internalPath) + { + File file = new File(this.codebase, internalPath); + return file.exists() && file.isFile(); + } +} diff --git a/src/jd/cli/loader/JarLoader.java b/src/jd/cli/loader/JarLoader.java new file mode 100644 index 00000000..695d4780 --- /dev/null +++ b/src/jd/cli/loader/JarLoader.java @@ -0,0 +1,59 @@ +package jd.cli.loader; + +import java.io.DataInputStream; +import java.io.File; +import java.io.IOException; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +import jd.core.loader.LoaderException; + + +public class JarLoader extends BaseLoader +{ + private ZipFile zipFile; + + public JarLoader(File file) throws LoaderException + { + super(file); + + if (! (file.exists() && file.isFile())) + { + throw new LoaderException("'" + codebase + "' is not a directory"); + } + + try + { + this.zipFile = new ZipFile(codebase); + } + catch (IOException e) + { + throw new LoaderException("Error reading from '" + codebase + "'"); + } + } + + public DataInputStream load(String internalPath) + throws LoaderException + { + ZipEntry zipEntry = this.zipFile.getEntry(internalPath); + + if (zipEntry == null) + { + throw new LoaderException("Can not read '" + internalPath + "'"); + } + + try + { + return new DataInputStream(this.zipFile.getInputStream(zipEntry)); + } + catch (IOException e) + { + throw new LoaderException("Error reading '" + internalPath + "'"); + } + } + + public boolean canLoad(String internalPath) + { + return this.zipFile.getEntry(internalPath) != null; + } +} diff --git a/src/jd/cli/loader/LoaderManager.java b/src/jd/cli/loader/LoaderManager.java new file mode 100644 index 00000000..6a9e949d --- /dev/null +++ b/src/jd/cli/loader/LoaderManager.java @@ -0,0 +1,79 @@ +package jd.cli.loader; + +import java.io.File; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import jd.core.loader.LoaderException; + +public class LoaderManager +{ + protected final static String JAR_SUFFIX = ".jar"; + protected final static String ZIP_SUFFIX = ".zip"; + + protected Map map; + + public LoaderManager() + { + this.map = new ConcurrentHashMap(); + } + + public BaseLoader getLoader(String codebase) throws LoaderException + { + File file = new File(codebase); + String key = file.getAbsolutePath(); + BaseLoader loader = map.get(key); + + if (loader == null) + { + if (file.exists()) + { + loader = newLoader(key, file); + } + } + else + { + if (file.exists()) + { + if ((file.lastModified() != loader.getLastModified()) || + (file.isFile() != loader.isFile())) + { + loader = newLoader(key, file); + } + } + else + { + map.remove(key); + } + } + + return loader; + } + + protected BaseLoader newLoader(String key, File file) throws LoaderException + { + BaseLoader loader = null; + + if (file.isFile()) + { + if (endsWithIgnoreCase(key, JAR_SUFFIX) || + endsWithIgnoreCase(key, ZIP_SUFFIX)) + { + this.map.put(key, loader = new JarLoader(file)); + } + } + else if (file.isDirectory()) + { + this.map.put(key, loader = new DirectoryLoader(file)); + } + + return loader; + } + + protected static boolean endsWithIgnoreCase(String s, String suffix) + { + int suffixLength = suffix.length(); + int index = s.length() - suffixLength; + return (s.regionMatches(true, index, suffix, 0, suffixLength)); + } +} diff --git a/src/jd/cli/preferences/CommonPreferences.java b/src/jd/cli/preferences/CommonPreferences.java new file mode 100644 index 00000000..37650a02 --- /dev/null +++ b/src/jd/cli/preferences/CommonPreferences.java @@ -0,0 +1,36 @@ +package jd.cli.preferences; + +import jd.core.preferences.Preferences; + +public class CommonPreferences extends Preferences +{ + protected boolean showPrefixThis; + protected boolean mergeEmptyLines; + protected boolean unicodeEscape; + protected boolean showLineNumbers; + + public CommonPreferences() + { + this.showPrefixThis = true; + this.mergeEmptyLines = false; + this.unicodeEscape = false; + this.showLineNumbers = true; + } + + public CommonPreferences( + boolean showDefaultConstructor, boolean realignmentLineNumber, + boolean showPrefixThis, boolean mergeEmptyLines, + boolean unicodeEscape, boolean showLineNumbers) + { + super(showDefaultConstructor, realignmentLineNumber); + this.showPrefixThis = showPrefixThis; + this.mergeEmptyLines = mergeEmptyLines; + this.unicodeEscape = unicodeEscape; + this.showLineNumbers = showLineNumbers; + } + + public boolean isShowPrefixThis() { return showPrefixThis; } + public boolean isMergeEmptyLines() { return mergeEmptyLines; } + public boolean isUnicodeEscape() { return unicodeEscape; } + public boolean isShowLineNumbers() { return showLineNumbers; } +} diff --git a/src/jd/cli/printer/html/HtmlPrinter.java b/src/jd/cli/printer/html/HtmlPrinter.java new file mode 100644 index 00000000..0a1b7393 --- /dev/null +++ b/src/jd/cli/printer/html/HtmlPrinter.java @@ -0,0 +1,544 @@ +package jd.cli.printer.html; + +import java.io.PrintStream; + +import jd.cli.util.VersionUtil; +import jd.core.CoreConstants; +import jd.core.printer.Printer; + +/* + * CSS + * .javacode{font-size:11px} + * .javacode .linenumber, .javacode .l, i{color:#3f7f5f} + * .javacode .keyword, .javacode .k, b{color:#7f0055;font-weight:bold} + * .javacode .comment, .javacode .t, cite{color:#3f7f5f} + * .javacode .javadoc, .javacode .d, dfn{color:#3f5fbf} + * .javacode .error, .javacode .e, span{color:#ff0000} + * .javacode .annotationname, .javacode .a, del{color:#646464} + * .javacode .constant, .javacode .c, u{color:#2a00ff} + * .javacode .field, .javacode .f, var{color:#0000c0} + * .javacode .staticfield, .javacode .g, em{color:#0000c0;font-style:italic} + * .javacode .staticmethod, .javacode .n, samp{font-style:italic} + * .javacode .debuglayoutblock{background-color:#ccffff;border:1px solid #99eeee} + * .javacode .debugseparatorlayoutblock{background-color:#ccffcc;border:1px solid #99ee99} + * .javacode .debugstatementblocklayoutblock{background-color:#ffcccc;border:1px solid #ee9999} + * .javacode .debugenumblocklayoutblock{background-color:#ffffcc;border:1px solid #eeee99} + * .javacode .debugcommentdeprecatedlayoutblock{background-color:#fefefe;border:1px solid #e9e9e9} + * .javacode .debugmarker{background-color:#ffd2ff;border:1px solid #cfb2cf} + * .javacode .extraline, .javacode .x, s + * .javacode .optionalthisprefix, .javacode .o, kbd + * .javacode .metadata, .javacode .m, ins + */ +public class HtmlPrinter implements Printer +{ + private final static boolean DEBUG = true; + + private PrintStream printStream; + private StringBuffer sbLineNumber; + private StringBuffer sbCode; + private int maxLineNumber; + private int majorVersion; + private int minorVersion; + private int realLineNumber; + private String realLineNumberFormatPrefix; + private String lineNumberFormatPrefix; + private String unknownLineNumberPrefix; + private int indentationCount; + private int commentJavadocErrorDepth; + + public HtmlPrinter(PrintStream printStream) + { + this.printStream = printStream; + this.sbLineNumber = new StringBuffer(10*1024); + this.sbCode = new StringBuffer(30*1024); + } + + public void print(byte b) { this.sbCode.append(String.valueOf(b)); } + public void print(char c) + { + switch (c) + { + case '<': + this.sbCode.append("<"); + break; + case '>': + this.sbCode.append(">"); + break; + default: + this.sbCode.append(String.valueOf(c)); + break; + } + } + public void print(int i) { this.sbCode.append(String.valueOf(i)); } + public void print(String s) { this.sbCode.append(s); } + + public void printNumeric(String s) + { + this.sbCode.append(""); + this.sbCode.append(s); + this.sbCode.append(""); + } + + public void printString(String s, String scopeInternalName) + { + this.sbCode.append(""); + + // Replace '<' by '<' + int length = s.length(); + + if (length > 0) + { + for (int i=0; i"); + } + + public void printKeyword(String s) + { + if (this.commentJavadocErrorDepth == 0) + { + this.sbCode.append(""); + this.sbCode.append(s); + this.sbCode.append(""); + } + else + { + this.sbCode.append(s); + } + } + + public void printJavaWord(String s) { printKeyword(s); } + + public void printType(String internalName, String name, String scopeInternalName) + { + this.sbCode.append(name); + } + public void printTypeDeclaration(String internalName, String name) + { + this.sbCode.append(name); + } + public void printTypeImport(String internalName, String name) + { + this.sbCode.append(name); + } + + public void printField( + String internalName, String name, + String descriptor, String scopeInternalName) + { + printFieldDeclaration(internalName, name, descriptor); + } + public void printFieldDeclaration( + String internalName, String name, String descriptor) + { + this.sbCode.append(""); + this.sbCode.append(name); + this.sbCode.append(""); + } + + public void printStaticField( + String internalName, String name, + String descriptor, String scopeInternalName) + { + printStaticFieldDeclaration(internalName, name, descriptor); + } + public void printStaticFieldDeclaration( + String internalName, String name, String descriptor) + { + this.sbCode.append(""); + this.sbCode.append(name); + this.sbCode.append(""); + } + + public void printConstructor( + String internalName, String name, + String descriptor, String scopeInternalName) + { + this.sbCode.append(name); + } + public void printConstructorDeclaration( + String internalName, String name, String descriptor) + { + this.sbCode.append(name); + } + + public void printStaticConstructorDeclaration( + String internalName, String name) + { + this.sbCode.append(""); + this.sbCode.append(name); + this.sbCode.append(""); + } + + public void printMethod( + String internalName, String name, + String descriptor, String scopeInternalName) + { + this.sbCode.append(name); + } + public void printMethodDeclaration( + String internalName, String name, String descriptor) + { + this.sbCode.append(name); + } + + public void printStaticMethod( + String internalName, String name, + String descriptor, String scopeInternalName) + { + printStaticMethodDeclaration(internalName, name, descriptor); + } + public void printStaticMethodDeclaration( + String internalName, String name, String descriptor) + { + this.sbCode.append(""); + this.sbCode.append(name); + this.sbCode.append(""); + } + + public void start(int maxLineNumber, int majorVersion, int minorVersion) + { + this.maxLineNumber = maxLineNumber; + this.majorVersion = majorVersion; + this.minorVersion = minorVersion; + this.realLineNumber = 0; + this.indentationCount = 0; + this.commentJavadocErrorDepth = 0; + + int digitCount = 1; + int maximum = 9; + + while (maximum < maxLineNumber) + { + digitCount++; + maximum = maximum*10 + 9; + } + + this.realLineNumberFormatPrefix = "%" + (digitCount+1) + "d:"; + this.lineNumberFormatPrefix = "%" + digitCount + "d
"; + + StringBuilder sb = new StringBuilder(digitCount + 7); + sb.append("%" + (digitCount+1) + "d:"); + for (int i=0; i"); + this.unknownLineNumberPrefix = sb.toString(); + + this.printStream.print( + "" + + "" + + "

Preview

" + + "
"); + } + + public void end() + { + if (this.maxLineNumber > 0) + { + this.printStream.print("
"); + this.printStream.print(this.sbLineNumber.toString()); + this.printStream.print("
"); + } + + this.printStream.print("
"); + this.printStream.print(this.sbCode.toString()); + this.printStream.print("
"); + + this.printStream.print("
"); + this.printStream.print("Java Class Version: " + VersionUtil.getJDKVersion(this.majorVersion, this.minorVersion) + "
"); + this.printStream.print("JD-CL Version: " + "0.1.0" + "
"); + this.printStream.print("JD-Core Version: " + CoreConstants.JD_CORE_VERSION); + this.printStream.print("
"); + + this.printStream.print("
"); + } + + public void indent() + { + this.indentationCount++; + } + public void desindent() + { + if (this.indentationCount > 0) + this.indentationCount--; + } + + public void startOfLine(int lineNumber) + { + this.realLineNumber++; + + if (this.maxLineNumber > 0) + { + if (lineNumber == UNKNOWN_LINE_NUMBER) + { + this.sbLineNumber.append(String.format( + this.unknownLineNumberPrefix, this.realLineNumber)); + } + else + { + this.sbLineNumber.append(String.format( + this.realLineNumberFormatPrefix, this.realLineNumber)); + + if (this.realLineNumber == lineNumber) + { + this.sbLineNumber.append(String.format( + this.lineNumberFormatPrefix, lineNumber)); + } + else + { + this.sbLineNumber.append(""); + this.sbLineNumber.append(String.format( + this.lineNumberFormatPrefix, lineNumber)); + this.sbLineNumber.append(""); + } + } + } + + for (int i=0; i"); + } + + public void extraLine(int count) + { + if (this.maxLineNumber > 0) + { + this.sbLineNumber.append(""); + } + this.sbCode.append(""); + + while (count-- > 0) + { + this.realLineNumber++; + + if (this.maxLineNumber > 0) + { + this.sbLineNumber.append(String.format( + this.unknownLineNumberPrefix, this.realLineNumber)); + } + + this.sbCode.append("
"); + } + + if (this.maxLineNumber > 0) + { + this.sbLineNumber.append("
"); + } + this.sbCode.append("
"); + } + + public void startOfComment() + { + this.sbCode.append(""); + this.commentJavadocErrorDepth++; + } + public void endOfComment() + { + this.sbCode.append(""); + this.commentJavadocErrorDepth--; + } + + public void startOfJavadoc() + { + this.sbCode.append(""); + this.commentJavadocErrorDepth++; + } + public void endOfJavadoc() + { + this.sbCode.append(""); + this.commentJavadocErrorDepth--; + } + + public void startOfXdoclet() { this.sbCode.append(""); } + public void endOfXdoclet() { this.sbCode.append(""); } + + public void startOfError() + { + this.sbCode.append(""); + this.commentJavadocErrorDepth++; + } + public void endOfError() + { + this.sbCode.append(""); + this.commentJavadocErrorDepth--; + } + + public void startOfImportStatements() {} + public void endOfImportStatements() {} + + public void startOfTypeDeclaration(String internalPath) {} + public void endOfTypeDeclaration() {} + + public void startOfAnnotationName() + { + this.sbCode.append(""); + } + public void endOfAnnotationName() + { + this.sbCode.append(""); + } + + public void startOfOptionalPrefix() + { + this.sbCode.append(""); + } + public void endOfOptionalPrefix() + { + this.sbCode.append(""); + } + + public void debugStartOfLayoutBlock() + { + if (DEBUG) + { + this.sbCode.append(""); + } + } + public void debugEndOfLayoutBlock() + { + if (DEBUG) + { + this.sbCode.append(""); + } + } + + public void debugStartOfSeparatorLayoutBlock() + { + if (DEBUG) + { + this.sbCode.append(""); + } + } + public void debugEndOfSeparatorLayoutBlock(int min, int value, int max) + { + if (DEBUG) + { + // DEBUG // this.sb.append(min); + // DEBUG // this.sb.append("<="); + // DEBUG // this.sb.append(value); + // DEBUG // this.sb.append("<="); + // DEBUG // this.sb.append(max); + this.sbCode.append(""); + } + } + + public void debugStartOfStatementsBlockLayoutBlock() + { + if (DEBUG) + { + this.sbCode.append(""); + } + } + public void debugEndOfStatementsBlockLayoutBlock(int min, int value, int max) + { + if (DEBUG) + { + // DEBUG // this.sb.append(min); + // DEBUG // this.sb.append("<="); + // DEBUG // this.sb.append(value); + // DEBUG // this.sb.append("<="); + // DEBUG // this.sb.append(max); + this.sbCode.append(""); + } + } + + public void debugStartOfInstructionBlockLayoutBlock() + { + if (DEBUG) + { + this.sbCode.append(""); + } + } + public void debugEndOfInstructionBlockLayoutBlock() + { + if (DEBUG) + { + this.sbCode.append(""); + } + } + + public void debugStartOfCommentDeprecatedLayoutBlock() + { + if (DEBUG) + { + this.sbCode.append(""); + } + } + public void debugEndOfCommentDeprecatedLayoutBlock() + { + if (DEBUG) + { + this.sbCode.append(""); + } + } + + public void debugMarker(String marker) + { + if (DEBUG) + { + // DEBUG // this.sb.append(""); + // DEBUG // this.sb.append(marker); + // DEBUG // this.sb.append(""); + } + } + + public void debugStartOfCaseBlockLayoutBlock() + { + if (DEBUG) + { + this.sbCode.append(""); + } + } + public void debugEndOfCaseBlockLayoutBlock() + { + if (DEBUG) + { + this.sbCode.append(""); + } + } +} diff --git a/src/jd/cli/printer/text/PlainTextPrinter.java b/src/jd/cli/printer/text/PlainTextPrinter.java new file mode 100644 index 00000000..ae9f6da7 --- /dev/null +++ b/src/jd/cli/printer/text/PlainTextPrinter.java @@ -0,0 +1,378 @@ +package jd.cli.printer.text; + +import java.io.PrintStream; + +import jd.cli.preferences.CommonPreferences; +import jd.core.model.instruction.bytecode.instruction.Instruction; +import jd.core.printer.Printer; + +public class PlainTextPrinter implements Printer +{ + protected static final String TAB = " "; + protected static final String NEWLINE = "\n"; + + protected CommonPreferences preferences; + protected PrintStream printStream; + protected int maxLineNumber; + protected int majorVersion; + protected int minorVersion; + protected int digitCount; + protected String lineNumberBeginPrefix; + protected String lineNumberEndPrefix; + protected String unknownLineNumberPrefix; + protected int indentationCount; + protected boolean display; + + public PlainTextPrinter( + CommonPreferences preferences, PrintStream printStream) + { + this.preferences = preferences; + this.printStream = printStream; + this.maxLineNumber = 0; + this.majorVersion = 0; + this.minorVersion = 0; + this.indentationCount = 0; + } + + public int getMajorVersion() { return majorVersion; } + public int getMinorVersion() { return minorVersion; } + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // + + public void print(byte b) { this.printStream.append(String.valueOf(b)); } + public void print(int i) { this.printStream.append(String.valueOf(i)); } + + public void print(char c) + { + if (this.display) + this.printStream.append(String.valueOf(c)); + } + + public void print(String s) + { + if (this.display) + printEscape(s); + } + + public void printNumeric(String s) { this.printStream.append(s); } + + public void printString(String s, String scopeInternalName) { this.printStream.append(s); } + + public void printKeyword(String s) + { + if (this.display) + this.printStream.append(s); + } + + public void printJavaWord(String s) { this.printStream.append(s); } + + public void printType(String internalName, String name, String scopeInternalName) + { + if (this.display) + printEscape(name); + } + + public void printTypeDeclaration(String internalName, String name) + { + printEscape(name); + } + + public void printTypeImport(String internalName, String name) + { + printEscape(name); + } + + public void printField( + String internalName, String name, + String descriptor, String scopeInternalName) + { + printEscape(name); + } + public void printFieldDeclaration( + String internalName, String name, String descriptor) + { + printEscape(name); + } + + public void printStaticField( + String internalName, String name, + String descriptor, String scopeInternalName) + { + printEscape(name); + } + public void printStaticFieldDeclaration( + String internalName, String name, String descriptor) + { + printEscape(name); + } + + public void printConstructor( + String internalName, String name, + String descriptor, String scopeInternalName) + { + printEscape(name); + } + public void printConstructorDeclaration( + String internalName, String name, String descriptor) + { + printEscape(name); + } + + public void printStaticConstructorDeclaration( + String internalName, String name) + { + this.printStream.append(name); + } + + public void printMethod( + String internalName, String name, + String descriptor, String scopeInternalName) + { + printEscape(name); + } + public void printMethodDeclaration( + String internalName, String name, String descriptor) + { + printEscape(name); + } + + public void printStaticMethod( + String internalName, String name, + String descriptor, String scopeInternalName) + { + printEscape(name); + } + public void printStaticMethodDeclaration( + String internalName, String name, String descriptor) + { + printEscape(name); + } + + public void start(int maxLineNumber, int majorVersion, int minorVersion) + { + this.majorVersion = majorVersion; + this.minorVersion = minorVersion; + this.indentationCount = 0; + this.display = true; + + if (this.preferences.isShowLineNumbers()) + { + this.maxLineNumber = maxLineNumber; + + if (maxLineNumber > 0) + { + this.digitCount = 1; + this.unknownLineNumberPrefix = " "; + int maximum = 9; + + while (maximum < maxLineNumber) + { + this.digitCount++; + this.unknownLineNumberPrefix += ' '; + maximum = maximum*10 + 9; + } + + this.lineNumberBeginPrefix = "/* "; + this.lineNumberEndPrefix = " */ "; + } + else + { + this.unknownLineNumberPrefix = ""; + this.lineNumberBeginPrefix = ""; + this.lineNumberEndPrefix = ""; + } + } + else + { + this.maxLineNumber = 0; + this.unknownLineNumberPrefix = ""; + this.lineNumberBeginPrefix = ""; + this.lineNumberEndPrefix = ""; + } + } + + public void end() {} + + public void indent() + { + this.indentationCount++; + } + public void desindent() + { + if (this.indentationCount > 0) + this.indentationCount--; + } + + public void startOfLine(int lineNumber) + { + if (this.maxLineNumber > 0) + { + this.printStream.append(this.lineNumberBeginPrefix); + + if (lineNumber == Instruction.UNKNOWN_LINE_NUMBER) + { + this.printStream.append(this.unknownLineNumberPrefix); + } + else + { + int left = 0; + + left = printDigit(5, lineNumber, 10000, left); + left = printDigit(4, lineNumber, 1000, left); + left = printDigit(3, lineNumber, 100, left); + left = printDigit(2, lineNumber, 10, left); + this.printStream.append((char)('0' + (lineNumber-left))); + } + + this.printStream.append(this.lineNumberEndPrefix); + } + + for (int i=0; i 0) + { + if (this.maxLineNumber > 0) + { + this.printStream.append(this.lineNumberBeginPrefix); + this.printStream.append(this.unknownLineNumberPrefix); + this.printStream.append(this.lineNumberEndPrefix); + } + + this.printStream.append(NEWLINE); + } + } + } + + public void startOfComment() {} + public void endOfComment() {} + + public void startOfJavadoc() {} + public void endOfJavadoc() {} + + public void startOfXdoclet() {} + public void endOfXdoclet() {} + + public void startOfError() {} + public void endOfError() {} + + public void startOfImportStatements() {} + public void endOfImportStatements() {} + + public void startOfTypeDeclaration(String internalPath) {} + public void endOfTypeDeclaration() {} + + public void startOfAnnotationName() {} + public void endOfAnnotationName() {} + + public void startOfOptionalPrefix() + { + if (this.preferences.isShowPrefixThis() == false) + this.display = false; + } + + public void endOfOptionalPrefix() + { + this.display = true; + } + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // + + public void debugStartOfLayoutBlock() {} + public void debugEndOfLayoutBlock() {} + + public void debugStartOfSeparatorLayoutBlock() {} + public void debugEndOfSeparatorLayoutBlock(int min, int value, int max) {} + + public void debugStartOfStatementsBlockLayoutBlock() {} + public void debugEndOfStatementsBlockLayoutBlock(int min, int value, int max) {} + + public void debugStartOfInstructionBlockLayoutBlock() {} + public void debugEndOfInstructionBlockLayoutBlock() {} + + public void debugStartOfCommentDeprecatedLayoutBlock() {} + public void debugEndOfCommentDeprecatedLayoutBlock() {} + + public void debugMarker(String marker) {} + + public void debugStartOfCaseBlockLayoutBlock() {} + public void debugEndOfCaseBlockLayoutBlock() {} + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // + + protected void printEscape(String s) + { + if (this.preferences.isUnicodeEscape()) + { + int length = s.length(); + + for (int i=0; i> 3))); + this.printStream.append((char)('0' + (c & 0x7))); + } + else if (c > 127) + { + // Write octal format + this.printStream.append("\\u"); + + int z = (c >> 12); + this.printStream.append((char)((z <= 9) ? ('0' + z) : (('A' - 10) + z))); + z = ((c >> 8) & 0xF); + this.printStream.append((char)((z <= 9) ? ('0' + z) : (('A' - 10) + z))); + z = ((c >> 4) & 0xF); + this.printStream.append((char)((z <= 9) ? ('0' + z) : (('A' - 10) + z))); + z = (c & 0xF); + this.printStream.append((char)((z <= 9) ? ('0' + z) : (('A' - 10) + z))); + } + else + { + this.printStream.append(c); + } + } + } + else + { + this.printStream.append(s); + } + } + + protected int printDigit(int dcv, int lineNumber, int divisor, int left) + { + if (this.digitCount >= dcv) + { + if (lineNumber < divisor) + { + this.printStream.append(' '); + } + else + { + int e = (lineNumber-left) / divisor; + this.printStream.append((char)('0' + e)); + left += e*divisor; + } + } + + return left; + } +} diff --git a/src/jd/cli/util/ClassFileUtil.java b/src/jd/cli/util/ClassFileUtil.java new file mode 100644 index 00000000..1a1914cc --- /dev/null +++ b/src/jd/cli/util/ClassFileUtil.java @@ -0,0 +1,147 @@ +package jd.cli.util; + +import java.io.BufferedInputStream; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; + +import jd.core.CoreConstants; +import jd.core.model.classfile.constant.Constant; +import jd.core.model.classfile.constant.ConstantClass; +import jd.core.model.classfile.constant.ConstantConstant; +import jd.core.model.classfile.constant.ConstantUtf8; +import jd.core.process.deserializer.ClassFormatException; +import jd.core.util.StringConstants; + + +public class ClassFileUtil +{ + /* + * Lecture rapide de la structure de la classe et extraction du nom du + * repoertoire de base. + */ + public static String ExtractDirectoryPath(String pathToClass) + { + DataInputStream dis = null; + String directoryPath = null; + + try + { + dis = new DataInputStream( + new BufferedInputStream( + new FileInputStream(pathToClass))); + + int magic = dis.readInt(); + if(magic != CoreConstants.JAVA_MAGIC_NUMBER) + throw new ClassFormatException("Invalid Java .class file"); + + /* int minor_version = */ dis.readUnsignedShort(); + /* int major_version = */ dis.readUnsignedShort(); + + Constant[] constants = DeserializeConstants(dis); + + /* int access_flags = */ dis.readUnsignedShort(); + int this_class = dis.readUnsignedShort(); + + Constant c = constants[this_class]; + if ((c == null) || (c.tag != ConstantConstant.CONSTANT_Class)) + throw new ClassFormatException("Invalid contant pool"); + + c = constants[((ConstantClass)c).name_index]; + if ((c == null) || (c.tag != ConstantConstant.CONSTANT_Utf8)) + throw new ClassFormatException("Invalid contant pool"); + + String internalClassName = ((ConstantUtf8)c).bytes; + String pathSuffix = internalClassName.replace( + StringConstants.INTERNAL_PACKAGE_SEPARATOR, File.separatorChar) + + StringConstants.CLASS_FILE_SUFFIX; + + int index = pathToClass.indexOf(pathSuffix); + + if (index < 0) + throw new ClassFormatException("Invalid internal class name"); + + directoryPath = pathToClass.substring(0, index); + } + catch (FileNotFoundException e) + { + directoryPath = null; + e.printStackTrace(); + } + catch (IOException e) + { + directoryPath = null; + e.printStackTrace(); + } + finally + { + if (dis != null) + try { dis.close(); } catch (IOException e) { } + } + + return directoryPath; + } + + public static String ExtractInternalPath( + String directoryPath, String pathToClass) + { + if ((directoryPath == null) || (pathToClass == null) || + !pathToClass.startsWith(directoryPath)) + return null; + + String s = pathToClass.substring(directoryPath.length()); + + return s.replace(File.separatorChar, StringConstants.INTERNAL_PACKAGE_SEPARATOR); + } + + private static Constant[] DeserializeConstants(DataInputStream dis) + throws IOException + { + int count = dis.readUnsignedShort(); + if (count == 0) + return null; + + Constant[] constants = new Constant[count]; + + for (int i=1; i= 49) + { + sb.append(majorVersion - (49-5)); + sb.append(" ("); + sb.append(majorVersion); + sb.append('.'); + sb.append(minorVersion); + sb.append(')'); + } + else if (majorVersion >= 45) + { + sb.append("1."); + sb.append(majorVersion - (45-1)); + sb.append(" ("); + sb.append(majorVersion); + sb.append('.'); + sb.append(minorVersion); + sb.append(')'); + } + + return sb.toString(); + } +} diff --git a/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java b/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java index 80bbffd7..e3968ebc 100644 --- a/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java +++ b/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java @@ -92,11 +92,16 @@ import the.bytecode.club.bytecodeviewer.plugin.PluginManager; * make ez-injection plugin console show all sys.out calls * edit then save issues? * + * Search open doesnt append .class + * * -----2.9.6-----: * 05/05/2015 - Fixed a typo in the about window * 05/28/2015 - Started importing JD-GUI Decompiler. * 05/28/2015 - Compile on refresh and compile on save are now enabled by default. * 05/28/2015 - Renamed the File>Save As options to be much more informative. + * 06/24/2015 - Fixed a logic error with the Field & Method searchers. + * 06/26/2015 - Updated Procyon & CFR to their latest versions. + * 07/02/2015 - Added JD-GUI Decompiler. - Huge thanks to the guys behind JD-GUI! <3 * * @author Konloch * diff --git a/src/the/bytecode/club/bytecodeviewer/NewlineOutputStream.java b/src/the/bytecode/club/bytecodeviewer/NewlineOutputStream.java new file mode 100644 index 00000000..69e4e65f --- /dev/null +++ b/src/the/bytecode/club/bytecodeviewer/NewlineOutputStream.java @@ -0,0 +1,53 @@ +package the.bytecode.club.bytecodeviewer; + +import java.io.*; + +/** + * Convert the various newline conventions to the local platform's + * newline convention.

+ * + * This stream can be used with the Message.writeTo method to + * generate a message that uses the local plaform's line terminator + * for the purpose of (e.g.) saving the message to a local file. + */ +public class NewlineOutputStream extends FilterOutputStream { + private int lastb = -1; + private static byte[] newline; + + public NewlineOutputStream(OutputStream os) { + super(os); + if (newline == null) { + String s = System.getProperty("line.separator"); + if (s == null || s.length() <= 0) + s = "\n"; + try { + newline = s.getBytes("iso-8859-1"); // really us-ascii + } catch (UnsupportedEncodingException ex) { + // should never happen + newline = new byte[] { (byte)'\n' }; + } + } + } + + public void write(int b) throws IOException { + if (b == '\r') { + out.write(newline); + } else if (b == '\n') { + if (lastb != '\r') + out.write(newline); + } else { + out.write(b); + } + lastb = b; + } + + public void write(byte b[]) throws IOException { + write(b, 0, b.length); + } + + public void write(byte b[], int off, int len) throws IOException { + for (int i = 0 ; i < len ; i++) { + write(b[off + i]); + } + } +} \ No newline at end of file diff --git a/src/the/bytecode/club/bytecodeviewer/decompilers/JDGUIDecompiler.java b/src/the/bytecode/club/bytecodeviewer/decompilers/JDGUIDecompiler.java index 34262db1..866755a6 100644 --- a/src/the/bytecode/club/bytecodeviewer/decompilers/JDGUIDecompiler.java +++ b/src/the/bytecode/club/bytecodeviewer/decompilers/JDGUIDecompiler.java @@ -1,55 +1,43 @@ package the.bytecode.club.bytecodeviewer.decompilers; -import java.io.BufferedOutputStream; +import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.io.OutputStreamWriter; +import java.io.InputStreamReader; +import java.io.PrintStream; import java.io.PrintWriter; import java.io.StringWriter; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; -import java.util.zip.ZipException; -import java.util.zip.ZipOutputStream; +import jd.cli.loader.DirectoryLoader; +import jd.cli.loader.JarLoader; +import jd.cli.preferences.CommonPreferences; +import jd.cli.util.ClassFileUtil; +import jd.core.loader.Loader; +import jd.core.process.DecompilerImpl; +import me.konloch.kontainer.io.DiskReader; import me.konloch.kontainer.io.DiskWriter; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.tree.ClassNode; -import com.strobel.core.StringUtilities; -import com.strobel.decompiler.DecompilationOptions; -import com.strobel.decompiler.DecompilerSettings; -import com.strobel.decompiler.PlainTextOutput; -import com.strobel.decompiler.languages.java.JavaFormattingOptions; -import com.strobel.assembler.InputTypeLoader; -import com.strobel.assembler.metadata.Buffer; -import com.strobel.assembler.metadata.ITypeLoader; -import com.strobel.assembler.metadata.JarTypeLoader; -import com.strobel.assembler.metadata.MetadataSystem; -import com.strobel.assembler.metadata.TypeDefinition; -import com.strobel.assembler.metadata.TypeReference; - import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.JarUtils; import the.bytecode.club.bytecodeviewer.MiscUtils; +import the.bytecode.club.bytecodeviewer.ZipUtils; +import jd.cli.printer.text.PlainTextPrinter; /** * JDCore Decompiler Wrapper * * @author Konloch + * @author JD-Core developers * */ public class JDGUIDecompiler extends Decompiler { - + @Override public void decompileToClass(String className, String classNameSaved) { ClassNode cn = BytecodeViewer.getClassNode(className); @@ -66,12 +54,65 @@ public class JDGUIDecompiler extends Decompiler { String contents = decompileClassNode(cn, cw.toByteArray()); DiskWriter.replaceFile(classNameSaved, contents, false); } - + @Override public String decompileClassNode(ClassNode cn, byte[] b) { String exception = ""; try { - String decompiledSource = "dicks WIP"; + final File tempDirectory = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs); + tempDirectory.mkdir(); + final File tempClass = new File(tempDirectory.getAbsolutePath() + BytecodeViewer.fs + cn.name + ".class"); + final File tempJava = new File(tempDirectory.getAbsolutePath() + BytecodeViewer.fs + cn.name + ".java"); + + if(cn.name.contains("/")) { + String[] raw = cn.name.split("/"); + String path = tempDirectory.getAbsolutePath() + BytecodeViewer.fs; + for(int i = 0; i < raw.length-1; i++) { + path += raw[i] + BytecodeViewer.fs; + File f = new File(path); + f.mkdir(); + } + } + + try { + final FileOutputStream fos = new FileOutputStream(tempClass); + + fos.write(b); + + fos.close(); + } catch (final IOException e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + + + String pathToClass = tempClass.getAbsolutePath().replace('/', File.separatorChar).replace('\\', File.separatorChar); + String directoryPath = ClassFileUtil.ExtractDirectoryPath(pathToClass); + + String internalPath = ClassFileUtil.ExtractInternalPath(directoryPath, pathToClass); + + CommonPreferences preferences = new CommonPreferences() { + @Override + public boolean isShowLineNumbers() { + return false; + } + @Override + public boolean isMergeEmptyLines() { + return true; + } + }; + + DirectoryLoader loader = new DirectoryLoader(new File(directoryPath)); + + //PrintStream ps = new PrintStream("test.html"); + //HtmlPrinter printer = new HtmlPrinter(ps); + PrintStream ps = new PrintStream(tempJava.getAbsolutePath()); + PlainTextPrinter printer = new PlainTextPrinter(preferences, ps); + + jd.core.Decompiler decompiler = new DecompilerImpl(); + decompiler.decompile(preferences, loader, printer, internalPath); + + String decompiledSource = "Error with decompilation."; + decompiledSource = DiskReader.loadAsString(tempJava.getAbsolutePath()); return decompiledSource; } catch (Exception e) { @@ -86,6 +127,5 @@ public class JDGUIDecompiler extends Decompiler { @Override public void decompileToZip(String zipName) { - } } \ No newline at end of file diff --git a/src/the/bytecode/club/bytecodeviewer/gui/AboutWindow.java b/src/the/bytecode/club/bytecodeviewer/gui/AboutWindow.java index 32c88958..0756965b 100644 --- a/src/the/bytecode/club/bytecodeviewer/gui/AboutWindow.java +++ b/src/the/bytecode/club/bytecodeviewer/gui/AboutWindow.java @@ -55,7 +55,7 @@ public class AboutWindow extends JFrame { "CTRL + T: Compile"+BytecodeViewer.nl+ "CTRL + S: Save classes as zip"+BytecodeViewer.nl+ "CTRL + R: Run (EZ-Inject) - dynamically load the classes and invoke a main class"+ - "\r\n\r\nIt uses code from the following:\r\n J-RET by WaterWolf\r\n JHexPane by Sam Koivu\r\n RSynaxPane by Robert Futrell\r\n Commons IO by Apache\r\n ASM by OW2\r\n FernFlower by Stiver\r\n Procyon by Mstrobel\r\n CFR by Lee Benfield\r\n CFIDE by Bibl\r\n Smali by JesusFreke\r\n Dex2Jar by pxb1..?\r\n Krakatau by Storyyeller\r\n\r\nIf you're interested in Java Reverse Engineering, join The Bytecode Club\r\nhttps://the.bytecode.club"); + "\r\n\r\nIt uses code from the following:\r\n J-RET by WaterWolf\r\n JHexPane by Sam Koivu\r\n RSynaxPane by Robert Futrell\r\n Commons IO by Apache\r\n ASM by OW2\r\n FernFlower by Stiver\r\n Procyon by Mstrobel\r\n CFR by Lee Benfield\r\n CFIDE by Bibl\r\n Smali by JesusFreke\r\n Dex2Jar by pxb1..?\r\n Krakatau by Storyyeller\r\n JD-GUI + JD-Core by The Java-Decompiler Team\r\n\r\nIf you're interested in Java Reverse Engineering, join The Bytecode Club\r\nhttps://the.bytecode.club"); } diff --git a/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java b/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java index 7cde247d..d6264ab2 100644 --- a/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java +++ b/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java @@ -826,7 +826,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier { JOptionPane pane = new JOptionPane( "What decompiler will you use?"); Object[] options = new String[] { "Procyon", "CFR", - "Fernflower", "Krakatau", "JD-GUI", "Cancel" }; + "Fernflower", "Krakatau", "Cancel" }; pane.setOptions(options); JDialog dialog = pane.createDialog(BytecodeViewer.viewer, "Bytecode Viewer - Select Decompiler"); @@ -895,22 +895,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier { t.start(); } - if (result == 4) { - Thread t = new Thread() { - @Override - public void run() { - try { - Decompiler.jdgui.decompileToZip(path); - BytecodeViewer.viewer.setIcon(false); - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - } - }; - t.start(); - } - - if(result == 5) { + if(result == 4) { BytecodeViewer.viewer.setIcon(false); } } @@ -963,7 +948,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier { JOptionPane pane = new JOptionPane( "What decompiler will you use?"); Object[] options = new String[] { "Procyon", "CFR", - "Fernflower", "Krakatau", "DJ GUI", "Cancel" }; + "Fernflower", "Krakatau", "Cancel" }; pane.setOptions(options); JDialog dialog = pane.createDialog(BytecodeViewer.viewer, "Bytecode Viewer - Select Decompiler"); @@ -1034,23 +1019,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier { }; t.start(); } - if (result == 4) { - Thread t = new Thread() { - @Override - public void run() { - try { - Decompiler.jdgui.decompileToClass(s,path); - BytecodeViewer.viewer.setIcon(false); - } catch (Exception e) { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI( - e); - } - } - }; - t.start(); - } - - if(result == 5) { + if(result == 4) { BytecodeViewer.viewer.setIcon(false); } } diff --git a/src/the/bytecode/club/bytecodeviewer/gui/SearchingPane.java b/src/the/bytecode/club/bytecodeviewer/gui/SearchingPane.java index 2d1bc5a8..f30f4b8c 100644 --- a/src/the/bytecode/club/bytecodeviewer/gui/SearchingPane.java +++ b/src/the/bytecode/club/bytecodeviewer/gui/SearchingPane.java @@ -191,7 +191,7 @@ public class SearchingPane extends VisibleComponent { final ClassNode fN = BytecodeViewer.getClassNode(className); if (fN != null) { MainViewerGUI.getComponent(FileNavigationPane.class) - .openClassFileToWorkSpace(className, fN); + .openClassFileToWorkSpace(className+".class", fN); } System.out.println(className); diff --git a/src/the/bytecode/club/bytecodeviewer/plugin/strategies/GroovyPluginLaunchStrategy.java b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/GroovyPluginLaunchStrategy.java index debadc07..e405d8bd 100644 --- a/src/the/bytecode/club/bytecodeviewer/plugin/strategies/GroovyPluginLaunchStrategy.java +++ b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/GroovyPluginLaunchStrategy.java @@ -11,6 +11,7 @@ import the.bytecode.club.bytecodeviewer.api.Plugin; import the.bytecode.club.bytecodeviewer.plugin.PluginLaunchStrategy; /** + * @author Konloch * @author Bibl (don't ban me pls) * @created 1 Jun 2015 */ diff --git a/src/the/bytecode/club/bytecodeviewer/plugin/strategies/JavaPluginLaunchStrategy.java b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/JavaPluginLaunchStrategy.java index 262085b5..3198483e 100644 --- a/src/the/bytecode/club/bytecodeviewer/plugin/strategies/JavaPluginLaunchStrategy.java +++ b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/JavaPluginLaunchStrategy.java @@ -10,6 +10,7 @@ import the.bytecode.club.bytecodeviewer.api.Plugin; import the.bytecode.club.bytecodeviewer.plugin.PluginLaunchStrategy; /** + * @author Konloch * @author Bibl (don't ban me pls) * @created 1 Jun 2015 */ diff --git a/src/the/bytecode/club/bytecodeviewer/plugin/strategies/PythonPluginLaunchStrategy.java b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/PythonPluginLaunchStrategy.java index df886914..391080c6 100644 --- a/src/the/bytecode/club/bytecodeviewer/plugin/strategies/PythonPluginLaunchStrategy.java +++ b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/PythonPluginLaunchStrategy.java @@ -11,6 +11,7 @@ import the.bytecode.club.bytecodeviewer.api.Plugin; import the.bytecode.club.bytecodeviewer.plugin.PluginLaunchStrategy; /** + * @author Konloch * @author Bibl (don't ban me pls) * @created 1 Jun 2015 */ diff --git a/src/the/bytecode/club/bytecodeviewer/plugin/strategies/RubyPluginLaunchStrategy.java b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/RubyPluginLaunchStrategy.java index 536d697a..0fb03443 100644 --- a/src/the/bytecode/club/bytecodeviewer/plugin/strategies/RubyPluginLaunchStrategy.java +++ b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/RubyPluginLaunchStrategy.java @@ -11,6 +11,7 @@ import the.bytecode.club.bytecodeviewer.api.Plugin; import the.bytecode.club.bytecodeviewer.plugin.PluginLaunchStrategy; /** + * @author Konloch * @author Bibl (don't ban me pls) * @created 1 Jun 2015 */ diff --git a/src/the/bytecode/club/bytecodeviewer/searching/FieldCallSearch.java b/src/the/bytecode/club/bytecodeviewer/searching/FieldCallSearch.java index bee98dd3..83daf219 100644 --- a/src/the/bytecode/club/bytecodeviewer/searching/FieldCallSearch.java +++ b/src/the/bytecode/club/bytecodeviewer/searching/FieldCallSearch.java @@ -103,13 +103,13 @@ public class FieldCallSearch implements SearchTypeDetails { .toLowerCase()); } else { - if (name != null && !name.contains(min.name)) { + if (name != null && !min.name.contains(name)) { continue; } - if (owner != null && !owner.contains(min.owner)) { + if (owner != null && !min.owner.contains(owner)) { continue; } - if (desc != null && !desc.contains(min.desc)) { + if (desc != null && !min.desc.contains(desc)) { continue; } String desc2 = method.desc; diff --git a/src/the/bytecode/club/bytecodeviewer/searching/MethodCallSearch.java b/src/the/bytecode/club/bytecodeviewer/searching/MethodCallSearch.java index 7312f876..27f5edc8 100644 --- a/src/the/bytecode/club/bytecodeviewer/searching/MethodCallSearch.java +++ b/src/the/bytecode/club/bytecodeviewer/searching/MethodCallSearch.java @@ -102,13 +102,13 @@ public class MethodCallSearch implements SearchTypeDetails { + OpcodeInfo.OPCODES.get(insnNode.opcode()) .toLowerCase()); } else { - if (name != null && !name.contains(min.name)) { + if (name != null && !min.name.contains(name)) { continue; } - if (owner != null && !owner.contains(min.owner)) { + if (owner != null && !min.owner.contains(owner)) { continue; } - if (desc != null && !desc.contains(min.desc)) { + if (desc != null && !min.desc.contains(desc)) { continue; } String desc2 = method.desc;