diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java b/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java index f42e01f9..742b3af4 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java @@ -8,7 +8,9 @@ import javax.swing.*; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import me.konloch.kontainer.io.DiskReader; import org.apache.commons.io.FileUtils; +import org.apache.commons.io.FilenameUtils; import org.objectweb.asm.tree.ClassNode; import the.bytecode.club.bootloader.Boot; import the.bytecode.club.bytecodeviewer.api.ExceptionUI; @@ -19,6 +21,7 @@ import the.bytecode.club.bytecodeviewer.gui.MainViewerGUI; import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ResourceViewer; import the.bytecode.club.bytecodeviewer.obfuscators.mapping.Refactorer; import the.bytecode.club.bytecodeviewer.plugin.PluginManager; +import the.bytecode.club.bytecodeviewer.plugin.PluginWriter; import the.bytecode.club.bytecodeviewer.util.*; import the.bytecode.club.bytecodeviewer.resources.importing.ImportResource; @@ -548,12 +551,16 @@ public class BytecodeViewer Settings.removeRecentPlugin(file); return; } - - try { - PluginManager.runPlugin(file); - } catch (Throwable e) { + + try + { + PluginWriter writer = new PluginWriter(DiskReader.loadAsString(file.getAbsolutePath()), file.getName()); + writer.setSourceFile(file); + writer.setVisible(true); + } catch (Exception e) { BytecodeViewer.handleException(e); } + addRecentPlugin(file); } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginWriter.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginWriter.java index 0f7dcecb..cd42c573 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginWriter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginWriter.java @@ -74,9 +74,9 @@ public class PluginWriter extends JFrame menuSave.setVisible(false); menuBar.add(menu); - menu.add(menuRun); menu.add(menuSaveAs); menu.add(menuSave); + menu.add(menuRun); setJMenuBar(menuBar); add(area.getScrollPane()); @@ -98,7 +98,7 @@ public class PluginWriter extends JFrame try { //write to temporary file location - DiskWriter.replaceFile(tempFile.getAbsolutePath(), area.getText(), false); + DiskWriter.replaceFile(tempFile.getAbsolutePath(), area.getText(), true); //run plugin from that location PluginManager.runPlugin(tempFile); } @@ -170,7 +170,9 @@ public class PluginWriter extends JFrame { menuSaveAs.setVisible(false); menuSave.setVisible(true); + menuSaveAs.updateUI(); + menuSave.updateUI(); savePath = file; - setPluginName(file.getAbsolutePath()); + setPluginName(file.getName()); } } \ No newline at end of file