Skip to content

Commit

Permalink
Rename main class
Browse files Browse the repository at this point in the history
  • Loading branch information
rcx committed Jun 14, 2016
1 parent 23215b0 commit 7f46409
Show file tree
Hide file tree
Showing 28 changed files with 223 additions and 223 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>the.bytecode.club.jda.BytecodeViewer</mainClass>
<mainClass>the.bytecode.club.jda.JDA</mainClass>
</transformer>
</transformers>
</configuration>
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/the/bytecode/club/jda/CommandLineInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public CommandLineInput(String[] args) throws ParseException
static
{
options.addOption(new Option("help", null, false, "prints the help menu."));
options.addOption(new Option("list", null, false, "lists all the available decompilers for JDA " + BytecodeViewer.version + "."));
options.addOption(new Option("list", null, false, "lists all the available decompilers for JDA " + JDA.version + "."));
options.addOption(new Option("decompiler", null, true, "sets the decompiler, procyon by default."));
options.addOption(new Option("i", null, true, "sets the input."));
options.addOption(new Option("o", null, true, "sets the output."));
Expand Down Expand Up @@ -166,8 +166,8 @@ else if ((use = Decompiler.getByName(parsed.getOptionValue("decompiler"))) == nu
}

System.out.println("Decompiling " + input.getAbsolutePath() + " with " + use.getName());
BytecodeViewer.openFiles(new File[] { input }, false);
String containerName = BytecodeViewer.files.get(0).name;
JDA.openFiles(new File[] { input }, false);
String containerName = JDA.files.get(0).name;
Thread.sleep(5 * 1000);
if (target.equalsIgnoreCase("all"))
{
Expand All @@ -177,8 +177,8 @@ else if ((use = Decompiler.getByName(parsed.getOptionValue("decompiler"))) == nu
{
try
{
ClassNode cn = BytecodeViewer.getClassNode(containerName, target);
byte[] bytes = BytecodeViewer.getClassBytes(containerName, target);
ClassNode cn = JDA.getClassNode(containerName, target);
byte[] bytes = JDA.getClassBytes(containerName, target);
String contents = use.decompileClassNode(cn, bytes);
FileUtils.writeStringToFile(output, contents, "UTF-8");
}
Expand All @@ -188,7 +188,7 @@ else if ((use = Decompiler.getByName(parsed.getOptionValue("decompiler"))) == nu
}
}
System.out.println("Finished.");
System.out.println("Java DisAssembler CLI v" + BytecodeViewer.version);
System.out.println("Java DisAssembler CLI v" + JDA.version);
System.exit(0);
}
catch (Exception e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
import java.util.List;
import java.util.Map;

public class BytecodeViewer
public class JDA
{

/*per version*/
public static final String version = "0.0.1";
public static final boolean previewCopy = false;
Expand Down Expand Up @@ -92,11 +91,11 @@ public static void main(String[] args)
Settings.loadGUI();
viewer = new MainViewerGUI();
Boot.boot();
BytecodeViewer.BOOT(args, false);
JDA.BOOT(args, false);
}
else
{
BytecodeViewer.BOOT(args, true);
JDA.BOOT(args, true);
input.executeCommandLine();
}
}
Expand Down Expand Up @@ -300,9 +299,9 @@ public static void openFiles(final File[] files, boolean recentFiles)
if (recentFiles)
for (File f : files)
if (f.exists())
BytecodeViewer.addRecentFile(f);
JDA.addRecentFile(f);

BytecodeViewer.viewer.setIcon(true);
JDA.viewer.setIcon(true);
update = true;

Thread t = new Thread()
Expand Down Expand Up @@ -360,7 +359,7 @@ public void run()
}
}
container.files = files;
BytecodeViewer.files.add(container);
JDA.files.add(container);
}
else
{
Expand Down Expand Up @@ -390,7 +389,7 @@ else if (fn.endsWith(".class"))
FileContainer container = new FileContainer(f);
container.files.put(cn.name + ".class", bytes);
container.add(cn);
BytecodeViewer.files.add(container);
JDA.files.add(container);
}
else
{
Expand All @@ -413,7 +412,7 @@ else if (fn.endsWith(".class"))

FileContainer container = new FileContainer(f);
container.files = files;
BytecodeViewer.files.add(container);
JDA.files.add(container);
}
}
}
Expand All @@ -425,7 +424,7 @@ else if (fn.endsWith(".class"))
}
finally
{
BytecodeViewer.viewer.setIcon(false);
JDA.viewer.setIcon(false);
if (update)
try
{
Expand Down Expand Up @@ -701,7 +700,7 @@ public static void checkHotKey(KeyEvent e)
JFileChooser fc = new JFileChooser();
try
{
fc.setSelectedFile(new File(BytecodeViewer.lastDirectory));
fc.setSelectedFile(new File(JDA.lastDirectory));
}
catch (Exception e2)
{
Expand Down Expand Up @@ -731,16 +730,16 @@ public String getDescription()
});
fc.setFileHidingEnabled(false);
fc.setAcceptAllFileFilterUsed(false);
int returnVal = fc.showOpenDialog(BytecodeViewer.viewer);
int returnVal = fc.showOpenDialog(JDA.viewer);

if (returnVal == JFileChooser.APPROVE_OPTION)
{
BytecodeViewer.lastDirectory = fc.getSelectedFile().getAbsolutePath();
JDA.lastDirectory = fc.getSelectedFile().getAbsolutePath();
try
{
BytecodeViewer.viewer.setIcon(true);
BytecodeViewer.openFiles(new File[] { fc.getSelectedFile() }, true);
BytecodeViewer.viewer.setIcon(false);
JDA.viewer.setIcon(true);
JDA.openFiles(new File[] { fc.getSelectedFile() }, true);
JDA.viewer.setIcon(false);
}
catch (Exception e1)
{
Expand All @@ -751,7 +750,7 @@ public String getDescription()
else if ((e.getKeyCode() == KeyEvent.VK_N) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0))
{
last = System.currentTimeMillis();
BytecodeViewer.resetWorkSpace(true);
JDA.resetWorkSpace(true);
}
else if ((e.getKeyCode() == KeyEvent.VK_R) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0))
{
Expand All @@ -762,9 +761,9 @@ else if ((e.getKeyCode() == KeyEvent.VK_S) && ((e.getModifiers() & KeyEvent.CTRL
{
last = System.currentTimeMillis();

if (BytecodeViewer.getLoadedClasses().isEmpty())
if (JDA.getLoadedClasses().isEmpty())
{
BytecodeViewer.showMessage("First open a class, jar, or zip file.");
JDA.showMessage("First open a class, jar, or zip file.");
return;
}

Expand Down Expand Up @@ -801,7 +800,7 @@ public String getDescription()
JOptionPane pane = new JOptionPane("Are you sure you wish to overwrite this existing file?");
Object[] options = new String[] { "Yes", "No" };
pane.setOptions(options);
JDialog dialog = pane.createDialog(BytecodeViewer.viewer, "Java DisAssembler - Overwrite File");
JDialog dialog = pane.createDialog(JDA.viewer, "Java DisAssembler - Overwrite File");
dialog.setVisible(true);
Object obj = pane.getValue();
int result = -1;
Expand All @@ -821,14 +820,14 @@ public String getDescription()

final File file2 = file;

BytecodeViewer.viewer.setIcon(true);
JDA.viewer.setIcon(true);
Thread t = new Thread()
{
@Override
public void run()
{
JarUtils.saveAsJar(BytecodeViewer.getLoadedBytes(), file2.getAbsolutePath());
BytecodeViewer.viewer.setIcon(false);
JarUtils.saveAsJar(JDA.getLoadedBytes(), file2.getAbsolutePath());
JDA.viewer.setIcon(false);
}
};
t.start();
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/the/bytecode/club/jda/JarUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static void put(final File jarFile) throws IOException
}
jis.close();
container.files = files;
BytecodeViewer.files.add(container);
JDA.files.add(container);

}

Expand Down Expand Up @@ -239,7 +239,7 @@ public static void saveAsJar(ArrayList<ClassNode> nodeList, String path, String
out.write((manifest.trim() + "\r\n\r\n").getBytes());
out.closeEntry();

for (FileContainer container : BytecodeViewer.files)
for (FileContainer container : JDA.files)
for (Entry<String, byte[]> entry : container.files.entrySet())
{
String filename = entry.getKey();
Expand Down Expand Up @@ -341,7 +341,7 @@ public static void saveAsJar(Map<String, byte[]> nodeList, String path)
}
}

for (FileContainer container : BytecodeViewer.files)
for (FileContainer container : JDA.files)
for (Entry<String, byte[]> entry : container.files.entrySet())
{
String filename = entry.getKey();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/the/bytecode/club/jda/SecurityMan.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void stopBlocking()
if (executedClass.equals("CFRDecompiler") ||
executedClass.equals("ProcyonDecompiler") ||
executedClass.equals("FernFlowerDecompiler") ||
executedClass.equals("BytecodeViewer") ||
executedClass.equals("JDA") ||
executedClass.equals("the.bytecode.club.bytecodeviewer.compilers.JavaCompiler"))
{
blocking = false;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/the/bytecode/club/jda/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static void saveGUI()
rootSettings.add(setting.getKey(), setting.getValue().get());
}
}
FileOutputStream out = new FileOutputStream(BytecodeViewer.settingsFile);
FileOutputStream out = new FileOutputStream(JDA.settingsFile);
out.write(settings.toString().getBytes("UTF-8"));
out.close();
}
Expand All @@ -61,7 +61,7 @@ public static void loadGUI()
JsonObject settings = new JsonObject();
try
{
settings = JsonObject.readFrom(new FileReader(BytecodeViewer.settingsFile));
settings = JsonObject.readFrom(new FileReader(JDA.settingsFile));
}
catch (ParseException | UnsupportedOperationException e)
{
Expand Down
25 changes: 13 additions & 12 deletions src/main/java/the/bytecode/club/jda/api/BytecodeViewer.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package the.bytecode.club.jda.api;

import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.jda.JDA;
import the.bytecode.club.jda.JarUtils;
import the.bytecode.club.jda.decompilers.Decompiler;

Expand Down Expand Up @@ -33,7 +34,7 @@ public class BytecodeViewer
*/
public static ClassNodeLoader getClassNodeLoader()
{
return the.bytecode.club.jda.BytecodeViewer.loader;
return JDA.loader;
}

/**
Expand All @@ -59,7 +60,7 @@ public static URLClassLoader getClassLoaderInstance()
@SuppressWarnings("deprecation")
public static List<Class<?>> loadClassesIntoClassLoader(ArrayList<ClassNode> nodeList) throws IOException, ClassNotFoundException
{
File f = new File(the.bytecode.club.jda.BytecodeViewer.tempDir, "loaded_temp.jar");
File f = new File(JDA.tempDir, "loaded_temp.jar");
JarUtils.saveAsJarClassesOnly(nodeList, f.getAbsolutePath());

JarFile jarFile = new JarFile("" + f.getAbsolutePath());
Expand Down Expand Up @@ -102,8 +103,8 @@ public static List<Class<?>> loadAllClassesIntoClassLoader() throws ClassNotFoun
*/
public static void createNewClassNodeLoaderInstance()
{
the.bytecode.club.jda.BytecodeViewer.loader.clear();
the.bytecode.club.jda.BytecodeViewer.loader = new ClassNodeLoader();
JDA.loader.clear();
JDA.loader = new ClassNodeLoader();
}

/**
Expand All @@ -113,7 +114,7 @@ public static void createNewClassNodeLoaderInstance()
*/
public static void startPlugin(File plugin)
{
the.bytecode.club.jda.BytecodeViewer.startPlugin(plugin);
JDA.startPlugin(plugin);
}

/**
Expand All @@ -124,7 +125,7 @@ public static void startPlugin(File plugin)
*/
public static void openFiles(File[] files, boolean recentFiles)
{
the.bytecode.club.jda.BytecodeViewer.openFiles(files, recentFiles);
JDA.openFiles(files, recentFiles);
}

/**
Expand All @@ -134,7 +135,7 @@ public static void openFiles(File[] files, boolean recentFiles)
*/
public static ClassNode getCurrentlyOpenedClassNode()
{
return the.bytecode.club.jda.BytecodeViewer.getCurrentlyOpenedClassNode();
return JDA.getCurrentlyOpenedClassNode();
}

/**
Expand All @@ -145,7 +146,7 @@ public static ClassNode getCurrentlyOpenedClassNode()
*/
public static ClassNode getClassNode(String containerName, String name)
{
return the.bytecode.club.jda.BytecodeViewer.getClassNode(containerName, name);
return JDA.getClassNode(containerName, name);
}

/**
Expand All @@ -155,7 +156,7 @@ public static ClassNode getClassNode(String containerName, String name)
*/
public static ArrayList<ClassNode> getLoadedClasses()
{
return the.bytecode.club.jda.BytecodeViewer.getLoadedClasses();
return JDA.getLoadedClasses();
}

/**
Expand All @@ -166,7 +167,7 @@ public static ArrayList<ClassNode> getLoadedClasses()
*/
public static void resetWorkSpace(boolean ask)
{
the.bytecode.club.jda.BytecodeViewer.resetWorkSpace(ask);
JDA.resetWorkSpace(ask);
}

/**
Expand All @@ -177,7 +178,7 @@ public static void resetWorkSpace(boolean ask)
*/
public static void setBusy(boolean busy)
{
the.bytecode.club.jda.BytecodeViewer.viewer.setIcon(busy);
JDA.viewer.setIcon(busy);
}

/**
Expand All @@ -187,7 +188,7 @@ public static void setBusy(boolean busy)
*/
public static void showMessage(String message)
{
the.bytecode.club.jda.BytecodeViewer.showMessage(message);
JDA.showMessage(message);
}

/**
Expand Down
Loading

0 comments on commit 7f46409

Please sign in to comment.