-----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)
This commit is contained in:
Konloch 2015-07-02 18:07:35 -06:00
parent 13e52bb494
commit 858f3ea76c
30 changed files with 1611 additions and 90 deletions

View file

@ -350,3 +350,11 @@ Changelog:
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)
-----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)

View file

@ -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

View file

@ -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.

View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<launch4jConfig>
<dontWrapJar>false</dontWrapJar>
<headerType>gui</headerType>
<jar>H:\Repo\BCV\bytecode-viewer\BytecodeViewer 2.9.6.jar</jar>
<outfile>H:\Repo\BCV\bytecode-viewer\BytecodeViewer.exe</outfile>
<errTitle></errTitle>
<cmdLine></cmdLine>
<chdir>.</chdir>
<priority>normal</priority>
<downloadUrl>http://java.com/download</downloadUrl>
<supportUrl></supportUrl>
<stayAlive>false</stayAlive>
<restartOnCrash>false</restartOnCrash>
<manifest></manifest>
<icon>H:\Repo\BCV\bytecode-viewer\BCV Icon.ico</icon>
<jre>
<path></path>
<bundledJre64Bit>false</bundledJre64Bit>
<bundledJreAsFallback>false</bundledJreAsFallback>
<minVersion>1.7.0_00</minVersion>
<maxVersion></maxVersion>
<jdkPreference>preferJre</jdkPreference>
<runtimeBits>64/32</runtimeBits>
</jre>
<versionInfo>
<fileVersion>0.2.9.6</fileVersion>
<txtFileVersion>http://the.bytecode.club</txtFileVersion>
<fileDescription>Bytecode Viewer</fileDescription>
<copyright>http://bytecodeviewer.com</copyright>
<productVersion>0.2.9.6</productVersion>
<txtProductVersion>http://the.bytecode.club</txtProductVersion>
<productName>Bytecode Viewer</productName>
<companyName></companyName>
<internalName>BCV</internalName>
<originalFilename>Bytecode_Viewer.exe</originalFilename>
</versionInfo>
</launch4jConfig>

54
src/jd/cli/Main.java Normal file
View file

@ -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();
}
}
}
}

View file

@ -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;
}
}

View file

@ -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();
}
}

View file

@ -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;
}
}

View file

@ -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<String, BaseLoader> map;
public LoaderManager()
{
this.map = new ConcurrentHashMap<String, BaseLoader>();
}
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));
}
}

View file

@ -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; }
}

View file

@ -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("&lt;");
break;
case '>':
this.sbCode.append("&gt;");
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("<u>");
this.sbCode.append(s);
this.sbCode.append("</u>");
}
public void printString(String s, String scopeInternalName)
{
this.sbCode.append("<u>");
// Replace '<' by '&lt;'
int length = s.length();
if (length > 0)
{
for (int i=0; i<length; i++)
{
char c = s.charAt(i);
if (c == '<')
this.sbCode.append("&lt;");
else
this.sbCode.append(c);
}
}
this.sbCode.append("</u>");
}
public void printKeyword(String s)
{
if (this.commentJavadocErrorDepth == 0)
{
this.sbCode.append("<b>");
this.sbCode.append(s);
this.sbCode.append("</b>");
}
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("<var>");
this.sbCode.append(name);
this.sbCode.append("</var>");
}
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("<em>");
this.sbCode.append(name);
this.sbCode.append("</em>");
}
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("<samp>");
this.sbCode.append(name);
this.sbCode.append("</samp>");
}
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("<samp>");
this.sbCode.append(name);
this.sbCode.append("</samp>");
}
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<br>";
StringBuilder sb = new StringBuilder(digitCount + 7);
sb.append("%" + (digitCount+1) + "d:");
for (int i=0; i<digitCount; i++) sb.append(' ');
sb.append("<br>");
this.unknownLineNumberPrefix = sb.toString();
this.printStream.print(
"<html><head><style type='text/css'>" +
"body,html{font-family:Lucida Grande,Lucida Sans Unicode,Arial,sans-serif;font-size:90%}" +
"#demo .out{background-color:#FFFFFF}" +
"#demo .out .content{padding:0px;font-size:12px;font-family:courier new,courier;white-space:pre;border-radius:0 0 10px 10px}" +
"#demo .out .content .e{color:#FF0000;margin:10px}" +
"#linenumber{float:left;margin:0;padding:1px 8px 5px 1px;border-style:solid;border-color:#888888;border-width:0 1px 0 0;color:#888888}" +
"#linenumber s{text-decoration:none}" +
"#linenumber span{color:#FF0000;font-style:normal}" +
"#javacode{padding:0 0 5px 0;margin:1px 5px 1px 5px;color:black}" +
"#javacode i{color:#3f7f5f;font-style:normal}" +
"#javacode b{color:#7f0055;font-weight:bold;line-height:1}" +
"#javacode s{text-decoration:none}" +
"#javacode cite{color:#3F7F5F;font-style:normal}" +
"#javacode dfn{color:#3f5fbf;font-style:normal}" +
"#javacode dfn b{color:#3F5FBF}" +
"#javacode span{color:#FF0000;font-style:normal}" +
"#javacode del{color:#646464;text-decoration:none}" +
"#javacode kbd{font-family:courier new,courier}" +
"#javacode u{color:#2a00ff;text-decoration:none}" +
"#javacode var{color:#0000c0;font-style:normal}" +
"#javacode em{color:#0000c0;font-style:italic;line-height:1}" +
"#javacode samp{font-style:italic;line-height:1}" +
"#javacode .debuglayoutblock{color:#000000;background-color:#ccffff;border:1px solid #99eeee}" +
"#javacode .debugseparatorlayoutblock{color:#000000;background-color:#ccffcc;border:1px solid #99ee99}" +
"#javacode .debugstatementblocklayoutblock{color:#000000;background-color:#ffcccc;border:1px solid #ee9999}" +
"#javacode .debugenumblocklayoutblock{color:#000000;background-color:#ffffcc;border:1px solid #eeee99}" +
"#javacode .debugcommentdeprecatedlayoutblock{color:#000000;background-color:#fefefe;border:1px solid #e9e9e9}" +
"#javacode .debugmarker{color:#000000;background-color:#ffd2ff;border:1px solid #cfb2cf}" +
"#javacode .debugcaseblocklayoutblock{color:#000000;background-color:#ffde66;border:1px solid #ff9a11}" +
"#metadata{padding:5px;color:#444444;background-color:#EEEEEE;border-radius:0 0 10px 10px;font-size:11px}" +
"</style>" +
"</head><body>" +
"<h1>Preview</h1>" +
"<div id='demo'><div class='out'><div class='content'>");
}
public void end()
{
if (this.maxLineNumber > 0)
{
this.printStream.print("<div id='linenumber'>");
this.printStream.print(this.sbLineNumber.toString());
this.printStream.print("</div>");
}
this.printStream.print("<div id='javacode'>");
this.printStream.print(this.sbCode.toString());
this.printStream.print("</div>");
this.printStream.print("<div id='metadata'>");
this.printStream.print("Java Class Version: " + VersionUtil.getJDKVersion(this.majorVersion, this.minorVersion) + "<br>");
this.printStream.print("JD-CL Version: " + "0.1.0" + "<br>");
this.printStream.print("JD-Core Version: " + CoreConstants.JD_CORE_VERSION);
this.printStream.print("</div>");
this.printStream.print("</div></div></div></body></html>");
}
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("<span>");
this.sbLineNumber.append(String.format(
this.lineNumberFormatPrefix, lineNumber));
this.sbLineNumber.append("</span>");
}
}
}
for (int i=0; i<indentationCount; i++)
this.sbCode.append(" ");
}
public void endOfLine()
{
this.sbCode.append("<br>");
}
public void extraLine(int count)
{
if (this.maxLineNumber > 0)
{
this.sbLineNumber.append("<s>");
}
this.sbCode.append("<s>");
while (count-- > 0)
{
this.realLineNumber++;
if (this.maxLineNumber > 0)
{
this.sbLineNumber.append(String.format(
this.unknownLineNumberPrefix, this.realLineNumber));
}
this.sbCode.append("<br>");
}
if (this.maxLineNumber > 0)
{
this.sbLineNumber.append("</s>");
}
this.sbCode.append("</s>");
}
public void startOfComment()
{
this.sbCode.append("<cite>");
this.commentJavadocErrorDepth++;
}
public void endOfComment()
{
this.sbCode.append("</cite>");
this.commentJavadocErrorDepth--;
}
public void startOfJavadoc()
{
this.sbCode.append("<dfn>");
this.commentJavadocErrorDepth++;
}
public void endOfJavadoc()
{
this.sbCode.append("</dfn>");
this.commentJavadocErrorDepth--;
}
public void startOfXdoclet() { this.sbCode.append("<b>"); }
public void endOfXdoclet() { this.sbCode.append("</b>"); }
public void startOfError()
{
this.sbCode.append("<span>");
this.commentJavadocErrorDepth++;
}
public void endOfError()
{
this.sbCode.append("</span>");
this.commentJavadocErrorDepth--;
}
public void startOfImportStatements() {}
public void endOfImportStatements() {}
public void startOfTypeDeclaration(String internalPath) {}
public void endOfTypeDeclaration() {}
public void startOfAnnotationName()
{
this.sbCode.append("<del>");
}
public void endOfAnnotationName()
{
this.sbCode.append("</del>");
}
public void startOfOptionalPrefix()
{
this.sbCode.append("<kbd>");
}
public void endOfOptionalPrefix()
{
this.sbCode.append("</kbd>");
}
public void debugStartOfLayoutBlock()
{
if (DEBUG)
{
this.sbCode.append("<span class='debuglayoutblock' alt='block'>");
}
}
public void debugEndOfLayoutBlock()
{
if (DEBUG)
{
this.sbCode.append("</span>");
}
}
public void debugStartOfSeparatorLayoutBlock()
{
if (DEBUG)
{
this.sbCode.append("<span class='debugseparatorlayoutblock' alr='separator'>");
}
}
public void debugEndOfSeparatorLayoutBlock(int min, int value, int max)
{
if (DEBUG)
{
// DEBUG // this.sb.append(min);
// DEBUG // this.sb.append("&lt;=");
// DEBUG // this.sb.append(value);
// DEBUG // this.sb.append("&lt;=");
// DEBUG // this.sb.append(max);
this.sbCode.append("</span>");
}
}
public void debugStartOfStatementsBlockLayoutBlock()
{
if (DEBUG)
{
this.sbCode.append("<span class='debugstatementblocklayoutblock' alt='statement'>");
}
}
public void debugEndOfStatementsBlockLayoutBlock(int min, int value, int max)
{
if (DEBUG)
{
// DEBUG // this.sb.append(min);
// DEBUG // this.sb.append("&lt;=");
// DEBUG // this.sb.append(value);
// DEBUG // this.sb.append("&lt;=");
// DEBUG // this.sb.append(max);
this.sbCode.append("</span>");
}
}
public void debugStartOfInstructionBlockLayoutBlock()
{
if (DEBUG)
{
this.sbCode.append("<span class='debugenumblocklayoutblock' alt='numeric block'>");
}
}
public void debugEndOfInstructionBlockLayoutBlock()
{
if (DEBUG)
{
this.sbCode.append("</span>");
}
}
public void debugStartOfCommentDeprecatedLayoutBlock()
{
if (DEBUG)
{
this.sbCode.append("<span class='debugcommentdeprecatedlayoutblock' alt='comment deprecated'>");
}
}
public void debugEndOfCommentDeprecatedLayoutBlock()
{
if (DEBUG)
{
this.sbCode.append("</span>");
}
}
public void debugMarker(String marker)
{
if (DEBUG)
{
// DEBUG // this.sb.append("<span class='debugmarker'>");
// DEBUG // this.sb.append(marker);
// DEBUG // this.sb.append("</span>");
}
}
public void debugStartOfCaseBlockLayoutBlock()
{
if (DEBUG)
{
this.sbCode.append("<span class='debugcaseblocklayoutblock' alt='case block'>");
}
}
public void debugEndOfCaseBlockLayoutBlock()
{
if (DEBUG)
{
this.sbCode.append("</span>");
}
}
}

View file

@ -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<indentationCount; i++)
this.printStream.append(TAB);
}
public void endOfLine()
{
this.printStream.append(NEWLINE);
}
public void extraLine(int count)
{
if (this.preferences.isMergeEmptyLines() == false)
{
while (count-- > 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<length; i++)
{
char c = s.charAt(i);
if (c == '\t')
{
this.printStream.append(c);
}
else if (c < 32)
{
// Write octal format
this.printStream.append("\\0");
this.printStream.append((char)('0' + (c >> 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;
}
}

View file

@ -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<count; i++)
{
byte tag = dis.readByte();
switch (tag)
{
case ConstantConstant.CONSTANT_Class:
constants[i] = new ConstantClass(tag, dis.readUnsignedShort());
break;
case ConstantConstant.CONSTANT_Utf8:
constants[i] = new ConstantUtf8(tag, dis.readUTF());
break;
case ConstantConstant.CONSTANT_Long:
case ConstantConstant.CONSTANT_Double:
dis.read();
dis.read();
dis.read();
dis.read();
i++;
case ConstantConstant.CONSTANT_Fieldref:
case ConstantConstant.CONSTANT_Methodref:
case ConstantConstant.CONSTANT_InterfaceMethodref:
case ConstantConstant.CONSTANT_NameAndType:
case ConstantConstant.CONSTANT_Integer:
case ConstantConstant.CONSTANT_Float:
dis.read();
dis.read();
case ConstantConstant.CONSTANT_String:
dis.read();
dis.read();
break;
default:
//throw new ClassFormatException("Invalid constant pool entry");
return constants;
}
}
return constants;
}
}

View file

@ -0,0 +1,12 @@
package jd.cli.util;
import jd.core.util.TypeNameUtil;
public class CommonTypeNameUtil
{
public static String InternalPathToQualifiedTypeName(String internalPath)
{
String internalTypeName = internalPath.substring(0, internalPath.length()-6);
return TypeNameUtil.InternalTypeNameToQualifiedTypeName(internalTypeName);
}
}

View file

@ -0,0 +1,31 @@
package jd.cli.util;
public class VersionUtil
{
public static String getJDKVersion(int majorVersion, int minorVersion)
{
StringBuffer sb = new StringBuffer(20);
if (majorVersion >= 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();
}
}

View file

@ -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
*

View file

@ -0,0 +1,53 @@
package the.bytecode.club.bytecodeviewer;
import java.io.*;
/**
* Convert the various newline conventions to the local platform's
* newline convention. <p>
*
* 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]);
}
}
}

View file

@ -1,50 +1,38 @@
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
*
*/
@ -71,7 +59,60 @@ public class JDGUIDecompiler extends Decompiler {
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) {
}
}

View file

@ -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");
}

View file

@ -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);
}
}

View file

@ -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);

View file

@ -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
*/

View file

@ -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
*/

View file

@ -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
*/

View file

@ -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
*/

View file

@ -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;

View file

@ -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;