From c2a9c0f51e937951462c5177af7a33cc4189011f Mon Sep 17 00:00:00 2001 From: Konloch Date: Sun, 11 Jul 2021 07:10:42 -0700 Subject: [PATCH] Icon Resources API Change --- .../club/bootloader/InitialBootScreen.java | 4 +- .../club/bytecodeviewer/api/ExceptionUI.java | 4 +- .../impl/FernFlowerDecompiler.java | 1 - .../gui/components/AboutWindow.java | 4 +- .../gui/components/JFrameConsole.java | 4 +- .../gui/components/RunOptions.java | 4 +- .../gui/components/SearchableJTextArea.java | 6 +-- .../components/SearchableRSyntaxTextArea.java | 6 +-- .../gui/components/WaitBusyIcon.java | 8 ++-- .../gui/plugins/GraphicalReflectionKit.java | 4 +- .../plugins/MaliciousCodeScannerOptions.java | 4 +- .../gui/plugins/ReplaceStringsOptions.java | 4 +- .../gui/resourcelist/ImageRenderer.java | 34 +++++++-------- .../bytecodeviewer/plugin/PluginTemplate.java | 4 +- .../bytecodeviewer/plugin/PluginWriter.java | 4 +- .../preinstalled/AllatoriStringDecrypter.java | 4 +- .../preinstalled/CodeSequenceDiagram.java | 4 +- .../{Resources.java => IconResources.java} | 41 +++++++++---------- .../bytecodeviewer/translation/Language.java | 6 +-- 19 files changed, 73 insertions(+), 77 deletions(-) rename src/main/java/the/bytecode/club/bytecodeviewer/resources/{Resources.java => IconResources.java} (86%) diff --git a/src/main/java/the/bytecode/club/bootloader/InitialBootScreen.java b/src/main/java/the/bytecode/club/bootloader/InitialBootScreen.java index d8958e1f..125c9f02 100644 --- a/src/main/java/the/bytecode/club/bootloader/InitialBootScreen.java +++ b/src/main/java/the/bytecode/club/bootloader/InitialBootScreen.java @@ -13,7 +13,7 @@ import javax.swing.JProgressBar; import javax.swing.JScrollPane; import the.bytecode.club.bytecodeviewer.Configuration; -import the.bytecode.club.bytecodeviewer.resources.Resources; +import the.bytecode.club.bytecodeviewer.resources.IconResources; import the.bytecode.club.bytecodeviewer.gui.components.HTMLPane; import static the.bytecode.club.bytecodeviewer.Configuration.language; @@ -55,7 +55,7 @@ public class InitialBootScreen extends JFrame System.exit(0); } }); - this.setIconImages(Resources.iconList); + this.setIconImages(IconResources.iconList); setSize(getSafeSize()); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/api/ExceptionUI.java b/src/main/java/the/bytecode/club/bytecodeviewer/api/ExceptionUI.java index 2cb33214..368fdd8f 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/api/ExceptionUI.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/api/ExceptionUI.java @@ -10,7 +10,7 @@ import javax.swing.JScrollPane; import javax.swing.JTextArea; import the.bytecode.club.bytecodeviewer.Configuration; -import the.bytecode.club.bytecodeviewer.resources.Resources; +import the.bytecode.club.bytecodeviewer.resources.IconResources; import static the.bytecode.club.bytecodeviewer.Constants.*; @@ -101,7 +101,7 @@ public class ExceptionUI extends JFrame */ private void setupFrame(String error, String author) { - this.setIconImages(Resources.iconList); + this.setIconImages(IconResources.iconList); setSize(new Dimension(600, 400)); setTitle("Bytecode Viewer " + VERSION + " - Error Log - Send this to " + author); getContentPane().setLayout(new CardLayout(0, 0)); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/impl/FernFlowerDecompiler.java b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/impl/FernFlowerDecompiler.java index 8d124574..de851754 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/impl/FernFlowerDecompiler.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/impl/FernFlowerDecompiler.java @@ -10,7 +10,6 @@ import org.apache.commons.lang3.ArrayUtils; import org.objectweb.asm.tree.ClassNode; import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.resources.ExternalResources; -import the.bytecode.club.bytecodeviewer.resources.Resources; import the.bytecode.club.bytecodeviewer.api.ExceptionUI; import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler; import the.bytecode.club.bytecodeviewer.translation.TranslatedStrings; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/AboutWindow.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/AboutWindow.java index 001b3671..093ccc59 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/AboutWindow.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/AboutWindow.java @@ -6,7 +6,7 @@ import javax.swing.JFrame; import javax.swing.JScrollPane; import the.bytecode.club.bootloader.InitialBootScreen; -import the.bytecode.club.bytecodeviewer.resources.Resources; +import the.bytecode.club.bytecodeviewer.resources.IconResources; import static the.bytecode.club.bytecodeviewer.Configuration.*; @@ -38,7 +38,7 @@ public class AboutWindow extends JFrame { public AboutWindow() { - this.setIconImages(Resources.iconList); + this.setIconImages(IconResources.iconList); setSize(InitialBootScreen.getSafeSize()); setTitle("Bytecode Viewer - About - https://bytecodeviewer.com | https://the.bytecode.club"); getContentPane().setLayout(new CardLayout(0, 0)); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JFrameConsole.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JFrameConsole.java index a6c6bd3c..8bf0502b 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JFrameConsole.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JFrameConsole.java @@ -1,6 +1,6 @@ package the.bytecode.club.bytecodeviewer.gui.components; -import the.bytecode.club.bytecodeviewer.resources.Resources; +import the.bytecode.club.bytecodeviewer.resources.IconResources; import javax.swing.*; import java.awt.*; @@ -35,7 +35,7 @@ public class JFrameConsole extends JFrame public JFrameConsole(String title) { - this.setIconImages(Resources.iconList); + this.setIconImages(IconResources.iconList); setTitle(title); setSize(new Dimension(542, 316)); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/RunOptions.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/RunOptions.java index a21cbb6d..4fa450e7 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/RunOptions.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/RunOptions.java @@ -7,7 +7,7 @@ import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; -import the.bytecode.club.bytecodeviewer.resources.Resources; +import the.bytecode.club.bytecodeviewer.resources.IconResources; import the.bytecode.club.bytecodeviewer.api.ASMResourceUtil; import the.bytecode.club.bytecodeviewer.plugin.PluginManager; import the.bytecode.club.bytecodeviewer.plugin.preinstalled.EZInjection; @@ -45,7 +45,7 @@ public class RunOptions extends JFrame public RunOptions() { - this.setIconImages(Resources.iconList); + this.setIconImages(IconResources.iconList); setSize(new Dimension(250, 402)); setResizable(false); setTitle("Run Options"); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SearchableJTextArea.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SearchableJTextArea.java index c809c836..fae5a3ed 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SearchableJTextArea.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SearchableJTextArea.java @@ -1,7 +1,7 @@ package the.bytecode.club.bytecodeviewer.gui.components; import the.bytecode.club.bytecodeviewer.GlobalHotKeys; -import the.bytecode.club.bytecodeviewer.resources.Resources; +import the.bytecode.club.bytecodeviewer.resources.IconResources; import the.bytecode.club.bytecodeviewer.gui.components.listeners.PressKeyListener; import the.bytecode.club.bytecodeviewer.gui.components.listeners.ReleaseKeyListener; import the.bytecode.club.bytecodeviewer.translation.Translation; @@ -49,10 +49,10 @@ public class SearchableJTextArea extends JTextArea scrollPane.setColumnHeaderView(searchPanel); JButton searchNext = new JButton(); - searchNext.setIcon(Resources.nextIcon); + searchNext.setIcon(IconResources.nextIcon); JButton searchPrev = new JButton(); - searchPrev.setIcon(Resources.prevIcon); + searchPrev.setIcon(IconResources.prevIcon); JPanel buttonPane = new JPanel(new BorderLayout()); buttonPane.add(searchNext, BorderLayout.WEST); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SearchableRSyntaxTextArea.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SearchableRSyntaxTextArea.java index 57d6b8c9..ad450c08 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SearchableRSyntaxTextArea.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SearchableRSyntaxTextArea.java @@ -4,7 +4,7 @@ import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; import org.fife.ui.rtextarea.RTextScrollPane; import the.bytecode.club.bytecodeviewer.Configuration; import the.bytecode.club.bytecodeviewer.GlobalHotKeys; -import the.bytecode.club.bytecodeviewer.resources.Resources; +import the.bytecode.club.bytecodeviewer.resources.IconResources; import the.bytecode.club.bytecodeviewer.gui.components.listeners.PressKeyListener; import the.bytecode.club.bytecodeviewer.gui.components.listeners.ReleaseKeyListener; import the.bytecode.club.bytecodeviewer.gui.theme.LAFTheme; @@ -72,8 +72,8 @@ public class SearchableRSyntaxTextArea extends RSyntaxTextArea JPanel buttonPane = new JPanel(new BorderLayout()); buttonPane.add(searchNext, BorderLayout.WEST); buttonPane.add(searchPrev, BorderLayout.EAST); - searchNext.setIcon(Resources.nextIcon); - searchPrev.setIcon(Resources.prevIcon); + searchNext.setIcon(IconResources.nextIcon); + searchPrev.setIcon(IconResources.prevIcon); searchPanel.add(buttonPane, BorderLayout.WEST); searchPanel.add(searchInput, BorderLayout.CENTER); searchPanel.add(caseSensitiveSearch, BorderLayout.EAST); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/WaitBusyIcon.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/WaitBusyIcon.java index e02404fb..2b7a8745 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/WaitBusyIcon.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/WaitBusyIcon.java @@ -1,6 +1,6 @@ package the.bytecode.club.bytecodeviewer.gui.components; -import the.bytecode.club.bytecodeviewer.resources.Resources; +import the.bytecode.club.bytecodeviewer.resources.IconResources; import javax.swing.*; @@ -18,9 +18,9 @@ public class WaitBusyIcon extends JMenuItemIcon public static Icon loadIcon() { - if(Resources.busyIcon != null) - return Resources.busyIcon; + if(IconResources.busyIcon != null) + return IconResources.busyIcon; - return Resources.busyB64Icon; + return IconResources.busyB64Icon; } } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/plugins/GraphicalReflectionKit.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/plugins/GraphicalReflectionKit.java index c421942a..7815349b 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/plugins/GraphicalReflectionKit.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/plugins/GraphicalReflectionKit.java @@ -5,7 +5,7 @@ import java.awt.Dimension; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTabbedPane; -import the.bytecode.club.bytecodeviewer.resources.Resources; +import the.bytecode.club.bytecodeviewer.resources.IconResources; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * @@ -35,7 +35,7 @@ public class GraphicalReflectionKit extends JFrame { public GraphicalReflectionKit() { - this.setIconImages(Resources.iconList); + this.setIconImages(IconResources.iconList); setSize(new Dimension(382, 356)); setTitle("Graphical Reflection Kit"); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/plugins/MaliciousCodeScannerOptions.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/plugins/MaliciousCodeScannerOptions.java index 0b43f40c..9d21e0e6 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/plugins/MaliciousCodeScannerOptions.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/plugins/MaliciousCodeScannerOptions.java @@ -1,7 +1,7 @@ package the.bytecode.club.bytecodeviewer.gui.plugins; import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.resources.Resources; +import the.bytecode.club.bytecodeviewer.resources.IconResources; import the.bytecode.club.bytecodeviewer.malwarescanner.MalwareScanModule; import the.bytecode.club.bytecodeviewer.malwarescanner.util.MaliciousCodeOptions; import the.bytecode.club.bytecodeviewer.plugin.PluginManager; @@ -49,7 +49,7 @@ public class MaliciousCodeScannerOptions extends JFrame public MaliciousCodeScannerOptions() { - this.setIconImages(Resources.iconList); + this.setIconImages(IconResources.iconList); setSize(new Dimension(250, 7 + (MalwareScanModule.values().length * SPACER_HEIGHT_BETWEEN_OPTIONS) + 90)); setResizable(false); setTitle("Malicious Code Scanner Options"); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/plugins/ReplaceStringsOptions.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/plugins/ReplaceStringsOptions.java index 350c77f6..c01c7762 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/plugins/ReplaceStringsOptions.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/plugins/ReplaceStringsOptions.java @@ -8,7 +8,7 @@ import javax.swing.JLabel; import javax.swing.JTextField; import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.resources.Resources; +import the.bytecode.club.bytecodeviewer.resources.IconResources; import the.bytecode.club.bytecodeviewer.plugin.PluginManager; import the.bytecode.club.bytecodeviewer.plugin.preinstalled.ReplaceStrings; @@ -48,7 +48,7 @@ public class ReplaceStringsOptions extends JFrame public ReplaceStringsOptions() { - this.setIconImages(Resources.iconList); + this.setIconImages(IconResources.iconList); setSize(new Dimension(250, 176)); setResizable(false); setTitle("Replace Strings"); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ImageRenderer.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ImageRenderer.java index f106524e..01134d88 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ImageRenderer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ImageRenderer.java @@ -1,6 +1,6 @@ package the.bytecode.club.bytecodeviewer.gui.resourcelist; -import the.bytecode.club.bytecodeviewer.resources.Resources; +import the.bytecode.club.bytecodeviewer.resources.IconResources; import javax.swing.*; import javax.swing.tree.DefaultTreeCellRenderer; @@ -31,61 +31,61 @@ public class ImageRenderer extends DefaultTreeCellRenderer if (name.endsWith(".jar") || name.endsWith(".war") || name.endsWith(".ear")) { - setIcon(Resources.jarIcon); + setIcon(IconResources.jarIcon); } else if (name.endsWith(".zip")) { - setIcon(Resources.zipIcon); + setIcon(IconResources.zipIcon); } else if (name.endsWith(".bat")) { - setIcon(Resources.batIcon); + setIcon(IconResources.batIcon); } else if (name.endsWith(".sh")) { - setIcon(Resources.shIcon); + setIcon(IconResources.shIcon); } else if (name.endsWith(".cs")) { - setIcon(Resources.csharpIcon); + setIcon(IconResources.csharpIcon); } else if (name.endsWith(".c") || name.endsWith(".cpp") || name.endsWith(".h")) { - setIcon(Resources.cplusplusIcon); + setIcon(IconResources.cplusplusIcon); } else if (name.endsWith(".xapk") || name.endsWith(".apk") || name.endsWith(".dex")) { - setIcon(Resources.androidIcon); + setIcon(IconResources.androidIcon); } else if (name.endsWith(".png") || name.endsWith(".jpg") || name.endsWith(".jpeg") || name.endsWith(".bmp") || name.endsWith(".gif")) { - setIcon(Resources.imageIcon); + setIcon(IconResources.imageIcon); } else if (name.endsWith(".class")) { - setIcon(Resources.classIcon); + setIcon(IconResources.classIcon); } else if (name.endsWith(".java")) { - setIcon(Resources.javaIcon); + setIcon(IconResources.javaIcon); } else if (name.endsWith(".txt") || name.endsWith(".md")) { - setIcon(Resources.textIcon); + setIcon(IconResources.textIcon); } else if (name.equals("decoded resources")) { - setIcon(Resources.decodedIcon); + setIcon(IconResources.decodedIcon); } else if (name.endsWith(".properties") || name.endsWith(".xml") || name.endsWith(".jsp") || name.endsWith(".mf") || name.endsWith(".config") || name.endsWith(".cfg")) { - setIcon(Resources.configIcon); + setIcon(IconResources.configIcon); } else if (node.getChildCount() <= 0) { //random file - setIcon(Resources.fileIcon); + setIcon(IconResources.fileIcon); } else { //folder @@ -128,10 +128,10 @@ public class ImageRenderer extends DefaultTreeCellRenderer } if (isJava) - setIcon(Resources.packagesIcon); + setIcon(IconResources.packagesIcon); else { - setIcon(Resources.folderIcon); + setIcon(IconResources.folderIcon); } } } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginTemplate.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginTemplate.java index df40b9f6..19ce8c41 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginTemplate.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginTemplate.java @@ -2,7 +2,7 @@ package the.bytecode.club.bytecodeviewer.plugin; import org.apache.commons.io.FilenameUtils; import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.resources.Resources; +import the.bytecode.club.bytecodeviewer.resources.IconResources; import java.io.IOException; @@ -29,7 +29,7 @@ public enum PluginTemplate public String getContents() throws IOException { if(contents == null) - contents = Resources.loadResourceAsString(resourcePath); + contents = IconResources.loadResourceAsString(resourcePath); return contents; } 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 28891774..a748be08 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginWriter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginWriter.java @@ -4,7 +4,7 @@ import me.konloch.kontainer.io.DiskWriter; import org.apache.commons.compress.utils.FileNameUtils; import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.Configuration; -import the.bytecode.club.bytecodeviewer.resources.Resources; +import the.bytecode.club.bytecodeviewer.resources.IconResources; import the.bytecode.club.bytecodeviewer.gui.components.FileChooser; import the.bytecode.club.bytecodeviewer.gui.components.SearchableRSyntaxTextArea; import the.bytecode.club.bytecodeviewer.translation.Translation; @@ -53,7 +53,7 @@ public class PluginWriter extends JFrame public void buildGUI() { setTitle("Editing BCV Plugin: " + pluginName); - setIconImages(Resources.iconList); + setIconImages(IconResources.iconList); setSize(new Dimension(542, 316)); area = (SearchableRSyntaxTextArea) Configuration.rstaTheme.apply(new SearchableRSyntaxTextArea()); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java index 5afb4dbe..76f4d0ee 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java @@ -8,7 +8,7 @@ import java.util.ArrayList; import org.objectweb.asm.tree.*; import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.Constants; -import the.bytecode.club.bytecodeviewer.resources.Resources; +import the.bytecode.club.bytecodeviewer.resources.IconResources; import the.bytecode.club.bytecodeviewer.api.*; import the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialogue; import the.bytecode.club.bytecodeviewer.plugin.PluginManager; @@ -285,7 +285,7 @@ public class AllatoriStringDecrypter extends Plugin public AllatoriStringDecrypterOptionsFrame() { - this.setIconImages(Resources.iconList); + this.setIconImages(IconResources.iconList); setSize(new Dimension(250, 120)); setResizable(false); setTitle("Allatori String Decrypter"); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/CodeSequenceDiagram.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/CodeSequenceDiagram.java index 4d63a00a..9924ef2b 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/CodeSequenceDiagram.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/CodeSequenceDiagram.java @@ -13,7 +13,7 @@ import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.MethodInsnNode; import org.objectweb.asm.tree.MethodNode; import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.resources.Resources; +import the.bytecode.club.bytecodeviewer.resources.IconResources; import the.bytecode.club.bytecodeviewer.api.Plugin; import the.bytecode.club.bytecodeviewer.plugin.PluginManager; @@ -66,7 +66,7 @@ public class CodeSequenceDiagram extends Plugin ClassNode c = BytecodeViewer.getCurrentlyOpenedClassNode(); JFrame frame = new JFrame("Code Sequence Diagram - " + c.name); - frame.setIconImages(Resources.iconList); + frame.setIconImages(IconResources.iconList); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setSize(400, 320); mxGraph graph = new mxGraph(); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/resources/Resources.java b/src/main/java/the/bytecode/club/bytecodeviewer/resources/IconResources.java similarity index 86% rename from src/main/java/the/bytecode/club/bytecodeviewer/resources/Resources.java rename to src/main/java/the/bytecode/club/bytecodeviewer/resources/IconResources.java index 4b6fcd1b..3eee6ff1 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/resources/Resources.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/resources/IconResources.java @@ -2,7 +2,6 @@ package the.bytecode.club.bytecodeviewer.resources; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; -import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.ArrayList; @@ -16,8 +15,6 @@ import org.apache.commons.io.IOUtils; import org.imgscalr.Scalr; import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import static the.bytecode.club.bytecodeviewer.Constants.libsDirectory; - /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * @@ -42,7 +39,7 @@ import static the.bytecode.club.bytecodeviewer.Constants.libsDirectory; * @author Konloch */ -public class Resources +public class IconResources { public static List iconList; public static BufferedImage icon; @@ -76,27 +73,27 @@ public class Resources + "+BoY3H0BSbz6A2MxA6VciFyDqGAWQTWVkYEkCUrcOsDD8OwtkvMViMwAb8xEUHlHcFAAAAABJRU5ErkJggg==")); prevIcon = new ImageIcon(b642IMG("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAMFBMVEX" + "///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAABnRSTlMANzlYgKhxpRi1AAAATElEQVR42mNgwAZYHIAEExA7qUAYLApMDmCGEwODCojByM/A8FEAyPi/moFh9QewYjCAM1iA+D2KqYwMrIlA6tUGFoa/Z4GMt1hsBgCe1wuKber+SwAAAABJRU5ErkJggg==")); - busyIcon = new ImageIcon(Objects.requireNonNull(Resources.class.getResource("/gui/loading.gif"))); + busyIcon = new ImageIcon(Objects.requireNonNull(IconResources.class.getResource("/gui/loading.gif"))); busyB64Icon = new ImageIcon(b642IMG("R0lGODlhEAALAPQAAP" + "///wAAANra2tDQ0Orq6gcHBwAAAC8vL4KCgmFhYbq6uiMjI0tLS4qKimVlZb6+vicnJwUFBU9PT" + "+bm5tjY2PT09Dk5Odzc3PLy8ra2tqCgoMrKyu7u7gAAAAAAAAAAACH5BAkLAAAAIf4aQ3JlYXRlZCB3aXRoIGFqYXhsb2FkLmluZm8AIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAEAALAAAFLSAgjmRpnqSgCuLKAq5AEIM4zDVw03ve27ifDgfkEYe04kDIDC5zrtYKRa2WQgAh+QQJCwAAACwAAAAAEAALAAAFJGBhGAVgnqhpHIeRvsDawqns0qeN5+y967tYLyicBYE7EYkYAgAh+QQJCwAAACwAAAAAEAALAAAFNiAgjothLOOIJAkiGgxjpGKiKMkbz7SN6zIawJcDwIK9W/HISxGBzdHTuBNOmcJVCyoUlk7CEAAh+QQJCwAAACwAAAAAEAALAAAFNSAgjqQIRRFUAo3jNGIkSdHqPI8Tz3V55zuaDacDyIQ+YrBH+hWPzJFzOQQaeavWi7oqnVIhACH5BAkLAAAALAAAAAAQAAsAAAUyICCOZGme1rJY5kRRk7hI0mJSVUXJtF3iOl7tltsBZsNfUegjAY3I5sgFY55KqdX1GgIAIfkECQsAAAAsAAAAABAACwAABTcgII5kaZ4kcV2EqLJipmnZhWGXaOOitm2aXQ4g7P2Ct2ER4AMul00kj5g0Al8tADY2y6C+4FIIACH5BAkLAAAALAAAAAAQAAsAAAUvICCOZGme5ERRk6iy7qpyHCVStA3gNa/7txxwlwv2isSacYUc+l4tADQGQ1mvpBAAIfkECQsAAAAsAAAAABAACwAABS8gII5kaZ7kRFGTqLLuqnIcJVK0DeA1r/u3HHCXC/aKxJpxhRz6Xi0ANAZDWa+kEAA7")); - batIcon = new ImageIcon(Objects.requireNonNull(Resources.class.getResource("/gui/bat.png"))); - shIcon = new ImageIcon(Objects.requireNonNull(Resources.class.getResource("/gui/sh.png"))); - csharpIcon = new ImageIcon(Objects.requireNonNull(Resources.class.getResource("/gui/c#.png"))); - cplusplusIcon = new ImageIcon(Objects.requireNonNull(Resources.class.getResource("/gui/c++.png"))); - configIcon = new ImageIcon(Objects.requireNonNull(Resources.class.getResource("/gui/config.png"))); - jarIcon = new ImageIcon(Objects.requireNonNull(Resources.class.getResource("/gui/jar.png"))); - zipIcon = new ImageIcon(Objects.requireNonNull(Resources.class.getResource("/gui/zip.png"))); - packagesIcon = new ImageIcon(Objects.requireNonNull(Resources.class.getResource("/gui/package.png"))); - folderIcon = new ImageIcon(Objects.requireNonNull(Resources.class.getResource("/gui/folder.png"))); - androidIcon = new ImageIcon(Objects.requireNonNull(Resources.class.getResource("/gui/android.png"))); - fileIcon = new ImageIcon(Objects.requireNonNull(Resources.class.getResource("/gui/file.png"))); - textIcon = new ImageIcon(Objects.requireNonNull(Resources.class.getResource("/gui/text.png"))); - classIcon = new ImageIcon(Objects.requireNonNull(Resources.class.getResource("/gui/class.png"))); - imageIcon = new ImageIcon(Objects.requireNonNull(Resources.class.getResource("/gui/image.png"))); - decodedIcon = new ImageIcon(Objects.requireNonNull(Resources.class.getResource("/gui/decoded.png"))); - javaIcon = new ImageIcon(Objects.requireNonNull(Resources.class.getResource("/gui/java.png"))); + batIcon = new ImageIcon(Objects.requireNonNull(IconResources.class.getResource("/gui/bat.png"))); + shIcon = new ImageIcon(Objects.requireNonNull(IconResources.class.getResource("/gui/sh.png"))); + csharpIcon = new ImageIcon(Objects.requireNonNull(IconResources.class.getResource("/gui/c#.png"))); + cplusplusIcon = new ImageIcon(Objects.requireNonNull(IconResources.class.getResource("/gui/c++.png"))); + configIcon = new ImageIcon(Objects.requireNonNull(IconResources.class.getResource("/gui/config.png"))); + jarIcon = new ImageIcon(Objects.requireNonNull(IconResources.class.getResource("/gui/jar.png"))); + zipIcon = new ImageIcon(Objects.requireNonNull(IconResources.class.getResource("/gui/zip.png"))); + packagesIcon = new ImageIcon(Objects.requireNonNull(IconResources.class.getResource("/gui/package.png"))); + folderIcon = new ImageIcon(Objects.requireNonNull(IconResources.class.getResource("/gui/folder.png"))); + androidIcon = new ImageIcon(Objects.requireNonNull(IconResources.class.getResource("/gui/android.png"))); + fileIcon = new ImageIcon(Objects.requireNonNull(IconResources.class.getResource("/gui/file.png"))); + textIcon = new ImageIcon(Objects.requireNonNull(IconResources.class.getResource("/gui/text.png"))); + classIcon = new ImageIcon(Objects.requireNonNull(IconResources.class.getResource("/gui/class.png"))); + imageIcon = new ImageIcon(Objects.requireNonNull(IconResources.class.getResource("/gui/image.png"))); + decodedIcon = new ImageIcon(Objects.requireNonNull(IconResources.class.getResource("/gui/decoded.png"))); + javaIcon = new ImageIcon(Objects.requireNonNull(IconResources.class.getResource("/gui/java.png"))); iconList = new ArrayList<>(); int size = 16; @@ -109,7 +106,7 @@ public class Resources public static String loadResourceAsString(String resourcePath) throws IOException { - return IOUtils.toString(Resources.class.getResourceAsStream(resourcePath), StandardCharsets.UTF_8); + return IOUtils.toString(IconResources.class.getResourceAsStream(resourcePath), StandardCharsets.UTF_8); } public static BufferedImage resize(BufferedImage image, int width, int height) { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/translation/Language.java b/src/main/java/the/bytecode/club/bytecodeviewer/translation/Language.java index 4cbc62d3..91b19e07 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/translation/Language.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/translation/Language.java @@ -4,7 +4,7 @@ import com.google.gson.reflect.TypeToken; import org.apache.commons.collections4.map.HashedMap; import org.apache.commons.collections4.map.LinkedMap; import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.resources.Resources; +import the.bytecode.club.bytecodeviewer.resources.IconResources; import java.io.IOException; import java.util.Arrays; @@ -103,7 +103,7 @@ public enum Language printMissingLanguageKeys(); HashMap translationMap = BytecodeViewer.gson.fromJson( - Resources.loadResourceAsString(resourcePath), + IconResources.loadResourceAsString(resourcePath), new TypeToken>(){}.getType()); for(Translation translation : Translation.values()) @@ -153,7 +153,7 @@ public enum Language return; LinkedMap translationMap = BytecodeViewer.gson.fromJson( - Resources.loadResourceAsString(resourcePath), + IconResources.loadResourceAsString(resourcePath), new TypeToken>(){}.getType()); HashSet existingKeys = new HashSet<>();