Decompiler View Types
This commit is contained in:
parent
ce06cba71f
commit
11c3aae683
4 changed files with 40 additions and 29 deletions
|
@ -35,6 +35,8 @@ import the.bytecode.club.bytecodeviewer.resources.importing.ImportResource;
|
|||
import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
|
||||
import static the.bytecode.club.bytecodeviewer.Constants.*;
|
||||
import static the.bytecode.club.bytecodeviewer.Settings.addRecentPlugin;
|
||||
import static the.bytecode.club.bytecodeviewer.gui.components.DecompilerViewComponent.DecompilerComponentTypes.JAVA;
|
||||
import static the.bytecode.club.bytecodeviewer.gui.components.DecompilerViewComponent.DecompilerComponentTypes.JAVA_AND_BYTECODE;
|
||||
import static the.bytecode.club.bytecodeviewer.util.MiscUtils.guessLanguage;
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -128,7 +130,7 @@ public class BytecodeViewer
|
|||
public static Refactorer refactorer = new Refactorer();
|
||||
public static List<FileContainer> files = new ArrayList<>(); //all of BCV's loaded files/classes/etc
|
||||
public static List<Process> createdProcesses = new ArrayList<>();
|
||||
public static final DecompilerViewComponent krakatau = new DecompilerViewComponent("Krakatau", true);
|
||||
public static final DecompilerViewComponent krakatau = new DecompilerViewComponent("Krakatau", JAVA_AND_BYTECODE);
|
||||
public static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
public static final boolean EXPERIMENTAL_TAB_CODE = false;
|
||||
public static final boolean DEV_MODE = false; //if true error streams as preserved
|
||||
|
|
|
@ -6,6 +6,8 @@ import the.bytecode.club.bytecodeviewer.gui.components.DecompilerViewComponent;
|
|||
|
||||
import javax.swing.*;
|
||||
|
||||
import static the.bytecode.club.bytecodeviewer.gui.components.DecompilerViewComponent.DecompilerComponentTypes.*;
|
||||
|
||||
/***************************************************************************
|
||||
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
|
||||
* Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com *
|
||||
|
@ -32,17 +34,17 @@ import javax.swing.*;
|
|||
public enum Decompiler
|
||||
{
|
||||
NONE("None", null, (JRadioButtonMenuItem) null),
|
||||
PROCYON_DECOMPILER("Procyon Decompiler", new ProcyonDecompiler(), new DecompilerViewComponent("Procyon")),
|
||||
CFR_DECOMPILER("CFR Decompiler", new CFRDecompiler(), new DecompilerViewComponent("Procyon")),
|
||||
FERNFLOWER_DECOMPILER("FernFlower Decompiler", new FernFlowerDecompiler(), new DecompilerViewComponent("Procyon")),
|
||||
PROCYON_DECOMPILER("Procyon Decompiler", new ProcyonDecompiler(), new DecompilerViewComponent("Procyon", JAVA)),
|
||||
CFR_DECOMPILER("CFR Decompiler", new CFRDecompiler(), new DecompilerViewComponent("CFR", JAVA)),
|
||||
FERNFLOWER_DECOMPILER("FernFlower Decompiler", new FernFlowerDecompiler(), new DecompilerViewComponent("FernFlower", JAVA)),
|
||||
BYTECODE_DISASSEMBLER("Bytecode Disassembler", new BytecodeDisassembler(), new JRadioButtonMenuItem("Bytecode")),
|
||||
HEXCODE_VIEWER("Hexcode Viewer", null, new JRadioButtonMenuItem("Hexcode")),
|
||||
SMALI_DISASSEMBLER("Smali Disassembler", new SmaliDisassembler(), new DecompilerViewComponent("Smali")),
|
||||
SMALI_DISASSEMBLER("Smali Disassembler", new SmaliDisassembler(), new DecompilerViewComponent("Smali", BYTECODE)),
|
||||
KRAKATAU_DECOMPILER("Krakatau Decompiler", new KrakatauDecompiler(), BytecodeViewer.krakatau),
|
||||
KRAKATAU_DISASSEMBLER("Krakatau Disassembler", new KrakatauDisassembler(), BytecodeViewer.krakatau),
|
||||
JD_DECOMPILER("JD-GUI Decompiler", new JDGUIDecompiler(), new DecompilerViewComponent("Bytecode")),
|
||||
JADX_DECOMPILER("JADX Decompiler", new JADXDecompiler(), new DecompilerViewComponent("JADX")),
|
||||
ASM_TEXTIFY_DISASSEMBLER("ASM Disassembler", new ASMTextifierDecompiler(), new DecompilerViewComponent("ASM Textify")),
|
||||
JD_DECOMPILER("JD-GUI Decompiler", new JDGUIDecompiler(), new DecompilerViewComponent("JD-GUI", JAVA)),
|
||||
JADX_DECOMPILER("JADX Decompiler", new JADXDecompiler(), new DecompilerViewComponent("JADX", JAVA)),
|
||||
ASM_TEXTIFY_DISASSEMBLER("ASM Disassembler", new ASMTextifierDecompiler(), new DecompilerViewComponent("ASM Textify", BYTECODE)),
|
||||
;
|
||||
|
||||
private final String decompilerName;
|
||||
|
|
|
@ -32,27 +32,24 @@ import javax.swing.*;
|
|||
public class DecompilerViewComponent
|
||||
{
|
||||
private final String name;
|
||||
private final boolean hasBytecodeOption;
|
||||
private final JMenu menu;
|
||||
private final DecompilerComponentTypes types;
|
||||
private final JRadioButtonMenuItem java = new TranslatedJRadioButtonMenuItem("Java", Translation.JAVA);
|
||||
private final JRadioButtonMenuItem bytecode = new TranslatedJRadioButtonMenuItem("Bytecode", Translation.BYTECODE);
|
||||
private final JCheckBoxMenuItem editable = new TranslatedJCheckBoxMenuItem("Editable", Translation.EDITABLE);
|
||||
|
||||
public DecompilerViewComponent(String name) {
|
||||
this(name, false);
|
||||
}
|
||||
|
||||
public DecompilerViewComponent(String name, boolean hasBytecodeOption) {
|
||||
public DecompilerViewComponent(String name, DecompilerComponentTypes types) {
|
||||
this.name = name;
|
||||
this.menu = new JMenu(name);
|
||||
this.hasBytecodeOption = hasBytecodeOption;
|
||||
this.types = types;
|
||||
createMenu();
|
||||
}
|
||||
|
||||
private void createMenu()
|
||||
{
|
||||
if(types == DecompilerComponentTypes.JAVA || types == DecompilerComponentTypes.JAVA_AND_BYTECODE)
|
||||
menu.add(java);
|
||||
if(hasBytecodeOption)
|
||||
if(types == DecompilerComponentTypes.BYTECODE || types == DecompilerComponentTypes.JAVA_AND_BYTECODE)
|
||||
menu.add(bytecode);
|
||||
|
||||
menu.add(new JSeparator());
|
||||
|
@ -63,8 +60,9 @@ public class DecompilerViewComponent
|
|||
|
||||
public void addToGroup(ButtonGroup group)
|
||||
{
|
||||
if(types == DecompilerComponentTypes.JAVA || types == DecompilerComponentTypes.JAVA_AND_BYTECODE)
|
||||
group.add(java);
|
||||
if(hasBytecodeOption)
|
||||
if(types == DecompilerComponentTypes.BYTECODE || types == DecompilerComponentTypes.JAVA_AND_BYTECODE)
|
||||
group.add(bytecode);
|
||||
}
|
||||
|
||||
|
@ -87,4 +85,11 @@ public class DecompilerViewComponent
|
|||
{
|
||||
return editable;
|
||||
}
|
||||
|
||||
public enum DecompilerComponentTypes
|
||||
{
|
||||
JAVA,
|
||||
BYTECODE,
|
||||
JAVA_AND_BYTECODE
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ import the.bytecode.club.bytecodeviewer.translation.components.TranslatedJRadioB
|
|||
|
||||
import javax.swing.*;
|
||||
|
||||
import static the.bytecode.club.bytecodeviewer.gui.components.DecompilerViewComponent.DecompilerComponentTypes.*;
|
||||
|
||||
/**
|
||||
* @author Konloch
|
||||
* @since 6/21/2021
|
||||
|
@ -18,13 +20,13 @@ public class DecompilerSelectionPane
|
|||
public final JMenu menu;
|
||||
public final ButtonGroup group = new ButtonGroup();
|
||||
public final JRadioButtonMenuItem none = new TranslatedJRadioButtonMenuItem("None", Translation.NONE);
|
||||
public final DecompilerViewComponent procyon = new DecompilerViewComponent("Procyon");
|
||||
public final DecompilerViewComponent CFR = new DecompilerViewComponent("CFR");
|
||||
public final DecompilerViewComponent JADX = new DecompilerViewComponent("JADX");
|
||||
public final DecompilerViewComponent JD = new DecompilerViewComponent("JD-GUI");
|
||||
public final DecompilerViewComponent fern = new DecompilerViewComponent("FernFlower");
|
||||
public final DecompilerViewComponent krakatau = new DecompilerViewComponent("Krakatau", true);
|
||||
public final DecompilerViewComponent smali = new DecompilerViewComponent("Smali/DEX");
|
||||
public final DecompilerViewComponent procyon = new DecompilerViewComponent("Procyon", JAVA);
|
||||
public final DecompilerViewComponent CFR = new DecompilerViewComponent("CFR", JAVA);
|
||||
public final DecompilerViewComponent JADX = new DecompilerViewComponent("JADX", JAVA);
|
||||
public final DecompilerViewComponent JD = new DecompilerViewComponent("JD-GUI", JAVA);
|
||||
public final DecompilerViewComponent fern = new DecompilerViewComponent("FernFlower", JAVA);
|
||||
public final DecompilerViewComponent krakatau = new DecompilerViewComponent("Krakatau", JAVA_AND_BYTECODE);
|
||||
public final DecompilerViewComponent smali = new DecompilerViewComponent("Smali", BYTECODE);
|
||||
public final JRadioButtonMenuItem hexcode = new TranslatedJRadioButtonMenuItem("Hexcode", Translation.HEXCODE);
|
||||
public final JRadioButtonMenuItem bytecode = new TranslatedJRadioButtonMenuItem("Bytecode", Translation.BYTECODE);
|
||||
public final JRadioButtonMenuItem asmTextify = new TranslatedJRadioButtonMenuItem("ASM Textify", Translation.ASM_TEXTIFY);
|
||||
|
@ -86,7 +88,7 @@ public class DecompilerSelectionPane
|
|||
return Decompiler.BYTECODE_DISASSEMBLER;
|
||||
else if (group.isSelected(hexcode.getModel()))
|
||||
return Decompiler.HEXCODE_VIEWER;
|
||||
else if (group.isSelected(smali.getJava().getModel()))
|
||||
else if (group.isSelected(smali.getBytecode().getModel()))
|
||||
return Decompiler.SMALI_DISASSEMBLER;
|
||||
else if (group.isSelected(krakatau.getJava().getModel()))
|
||||
return Decompiler.KRAKATAU_DECOMPILER;
|
||||
|
@ -128,7 +130,7 @@ public class DecompilerSelectionPane
|
|||
group.setSelected(hexcode.getModel(), true);
|
||||
break;
|
||||
case SMALI_DISASSEMBLER:
|
||||
group.setSelected(smali.getJava().getModel(), true);
|
||||
group.setSelected(smali.getBytecode().getModel(), true);
|
||||
break;
|
||||
case KRAKATAU_DECOMPILER:
|
||||
group.setSelected(krakatau.getJava().getModel(), true);
|
||||
|
@ -162,7 +164,7 @@ public class DecompilerSelectionPane
|
|||
return true;
|
||||
if((group.isSelected(krakatau.getJava().getModel()) || group.isSelected(krakatau.getBytecode().getModel())) && krakatau.getEditable().isSelected())
|
||||
return true;
|
||||
if(group.isSelected(smali.getJava().getModel()) && smali.getEditable().isSelected())
|
||||
if(group.isSelected(smali.getBytecode().getModel()) && smali.getEditable().isSelected())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue