From e63676e92a07343841dce5d3d7f9a54389d724c9 Mon Sep 17 00:00:00 2001 From: Konloch Date: Wed, 21 Jul 2021 12:55:20 -0700 Subject: [PATCH] Repackaging --- .../{util => classtree}/ClassHelper.java | 2 +- .../{util => classtree}/ClassTree.java | 10 +- .../nullpermablehashmap/NullCreator.java | 2 +- .../NullPermeableHashMap.java | 2 +- .../nullpermablehashmap/SetCreator.java | 2 +- .../nullpermablehashmap/ValueCreator.java | 2 +- .../bootloader/loader/LibraryClassLoader.java | 2 +- .../bytecodeviewer/util/VersionChecker.java | 200 ------------------ 8 files changed, 11 insertions(+), 211 deletions(-) rename src/main/java/the/bytecode/club/bytecodeviewer/bootloader/{util => classtree}/ClassHelper.java (97%) rename src/main/java/the/bytecode/club/bytecodeviewer/bootloader/{util => classtree}/ClassTree.java (94%) rename src/main/java/the/bytecode/club/bytecodeviewer/bootloader/{util => classtree}/nullpermablehashmap/NullCreator.java (94%) rename src/main/java/the/bytecode/club/bytecodeviewer/bootloader/{util => classtree}/nullpermablehashmap/NullPermeableHashMap.java (95%) rename src/main/java/the/bytecode/club/bytecodeviewer/bootloader/{util => classtree}/nullpermablehashmap/SetCreator.java (94%) rename src/main/java/the/bytecode/club/bytecodeviewer/bootloader/{util => classtree}/nullpermablehashmap/ValueCreator.java (94%) delete mode 100644 src/main/java/the/bytecode/club/bytecodeviewer/util/VersionChecker.java diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/util/ClassHelper.java b/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/classtree/ClassHelper.java similarity index 97% rename from src/main/java/the/bytecode/club/bytecodeviewer/bootloader/util/ClassHelper.java rename to src/main/java/the/bytecode/club/bytecodeviewer/bootloader/classtree/ClassHelper.java index 943edcd0..fae10bcb 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/util/ClassHelper.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/classtree/ClassHelper.java @@ -1,4 +1,4 @@ -package the.bytecode.club.bytecodeviewer.bootloader.util; +package the.bytecode.club.bytecodeviewer.bootloader.classtree; import java.util.Collection; import java.util.HashMap; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/util/ClassTree.java b/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/classtree/ClassTree.java similarity index 94% rename from src/main/java/the/bytecode/club/bytecodeviewer/bootloader/util/ClassTree.java rename to src/main/java/the/bytecode/club/bytecodeviewer/bootloader/classtree/ClassTree.java index 87b76c3e..8a01f152 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/util/ClassTree.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/classtree/ClassTree.java @@ -1,4 +1,4 @@ -package the.bytecode.club.bytecodeviewer.bootloader.util; +package the.bytecode.club.bytecodeviewer.bootloader.classtree; import java.util.Collection; import java.util.Collections; @@ -8,11 +8,11 @@ import java.util.Map; import java.util.Set; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.MethodNode; -import the.bytecode.club.bytecodeviewer.bootloader.util.nullpermablehashmap.NullPermeableHashMap; -import the.bytecode.club.bytecodeviewer.bootloader.util.nullpermablehashmap.SetCreator; +import the.bytecode.club.bytecodeviewer.bootloader.classtree.nullpermablehashmap.NullPermeableHashMap; +import the.bytecode.club.bytecodeviewer.bootloader.classtree.nullpermablehashmap.SetCreator; -import static the.bytecode.club.bytecodeviewer.bootloader.util.ClassHelper.convertToMap; -import static the.bytecode.club.bytecodeviewer.bootloader.util.ClassHelper.copyOf; +import static the.bytecode.club.bytecodeviewer.bootloader.classtree.ClassHelper.convertToMap; +import static the.bytecode.club.bytecodeviewer.bootloader.classtree.ClassHelper.copyOf; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/util/nullpermablehashmap/NullCreator.java b/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/classtree/nullpermablehashmap/NullCreator.java similarity index 94% rename from src/main/java/the/bytecode/club/bytecodeviewer/bootloader/util/nullpermablehashmap/NullCreator.java rename to src/main/java/the/bytecode/club/bytecodeviewer/bootloader/classtree/nullpermablehashmap/NullCreator.java index dad9aca0..b0082bf4 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/util/nullpermablehashmap/NullCreator.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/classtree/nullpermablehashmap/NullCreator.java @@ -1,4 +1,4 @@ -package the.bytecode.club.bytecodeviewer.bootloader.util.nullpermablehashmap; +package the.bytecode.club.bytecodeviewer.bootloader.classtree.nullpermablehashmap; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/util/nullpermablehashmap/NullPermeableHashMap.java b/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/classtree/nullpermablehashmap/NullPermeableHashMap.java similarity index 95% rename from src/main/java/the/bytecode/club/bytecodeviewer/bootloader/util/nullpermablehashmap/NullPermeableHashMap.java rename to src/main/java/the/bytecode/club/bytecodeviewer/bootloader/classtree/nullpermablehashmap/NullPermeableHashMap.java index 50ac94b8..7b9f7315 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/util/nullpermablehashmap/NullPermeableHashMap.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/classtree/nullpermablehashmap/NullPermeableHashMap.java @@ -1,4 +1,4 @@ -package the.bytecode.club.bytecodeviewer.bootloader.util.nullpermablehashmap; +package the.bytecode.club.bytecodeviewer.bootloader.classtree.nullpermablehashmap; import java.util.HashMap; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/util/nullpermablehashmap/SetCreator.java b/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/classtree/nullpermablehashmap/SetCreator.java similarity index 94% rename from src/main/java/the/bytecode/club/bytecodeviewer/bootloader/util/nullpermablehashmap/SetCreator.java rename to src/main/java/the/bytecode/club/bytecodeviewer/bootloader/classtree/nullpermablehashmap/SetCreator.java index ba27726c..d066c1b9 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/util/nullpermablehashmap/SetCreator.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/classtree/nullpermablehashmap/SetCreator.java @@ -1,4 +1,4 @@ -package the.bytecode.club.bytecodeviewer.bootloader.util.nullpermablehashmap; +package the.bytecode.club.bytecodeviewer.bootloader.classtree.nullpermablehashmap; import java.util.HashSet; import java.util.Set; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/util/nullpermablehashmap/ValueCreator.java b/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/classtree/nullpermablehashmap/ValueCreator.java similarity index 94% rename from src/main/java/the/bytecode/club/bytecodeviewer/bootloader/util/nullpermablehashmap/ValueCreator.java rename to src/main/java/the/bytecode/club/bytecodeviewer/bootloader/classtree/nullpermablehashmap/ValueCreator.java index febb71f7..a586876c 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/util/nullpermablehashmap/ValueCreator.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/classtree/nullpermablehashmap/ValueCreator.java @@ -1,4 +1,4 @@ -package the.bytecode.club.bytecodeviewer.bootloader.util.nullpermablehashmap; +package the.bytecode.club.bytecodeviewer.bootloader.classtree.nullpermablehashmap; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/loader/LibraryClassLoader.java b/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/loader/LibraryClassLoader.java index faaaf796..82cd9734 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/loader/LibraryClassLoader.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/loader/LibraryClassLoader.java @@ -11,7 +11,7 @@ import org.objectweb.asm.ClassWriter; import org.objectweb.asm.tree.ClassNode; import the.bytecode.club.bytecodeviewer.bootloader.resource.external.ExternalResource; import the.bytecode.club.bytecodeviewer.bootloader.resource.jar.contents.JarContents; -import the.bytecode.club.bytecodeviewer.bootloader.util.ClassTree; +import the.bytecode.club.bytecodeviewer.bootloader.classtree.ClassTree; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/util/VersionChecker.java b/src/main/java/the/bytecode/club/bytecodeviewer/util/VersionChecker.java deleted file mode 100644 index 061ca19f..00000000 --- a/src/main/java/the/bytecode/club/bytecodeviewer/util/VersionChecker.java +++ /dev/null @@ -1,200 +0,0 @@ -package the.bytecode.club.bytecodeviewer.util; - -import de.skuzzle.semantic.Version; -import me.konloch.kontainer.io.HTTPRequest; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.Configuration; -import the.bytecode.club.bytecodeviewer.gui.components.FileChooser; -import the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialog; -import the.bytecode.club.bytecodeviewer.translation.TranslatedStrings; - -import javax.swing.*; -import java.awt.*; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.net.URI; -import java.net.URL; - -import static the.bytecode.club.bytecodeviewer.Constants.*; - -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - - -/** - * @author Konloch - */ -public class VersionChecker implements Runnable -{ - @Override - public void run() - { - try { - HTTPRequest r = new HTTPRequest(new URL("https://raw.githubusercontent.com/Konloch/bytecode-viewer/master/VERSION")); - final Version version = Version.parseVersion(r.readSingle()); - final Version localVersion = Version.parseVersion(VERSION); - - try { - //developer version - if (!localVersion.isGreaterThan(version)) - return; - } catch (Exception ignored) { } - - MultipleChoiceDialog outdatedDialog = new MultipleChoiceDialog("Bytecode Viewer - Outdated Version", - "Your version: " + VERSION + ", latest version: " - + version + nl + "What would you like to do?", - new String[]{"Open The Download Page", "Download The Updated Jar", "Do Nothing (And Don't Ask Again)"}); - - int result = outdatedDialog.promptChoice(); - - if (result == 0) - { - if (Desktop.isDesktopSupported()) - Desktop.getDesktop().browse(new URI("https://github.com/Konloch/bytecode-viewer/releases")); - else - BytecodeViewer.showMessage("Cannot open the page, please manually type it." - + nl + "https://github.com/Konloch/bytecode-viewer/releases"); - } - else if (result == 1) - { - JFileChooser fc = new FileChooser(new File("./").getCanonicalFile(), - "Select Save File", - "Zip Archives", - "zip"); - - int returnVal = fc.showSaveDialog(BytecodeViewer.viewer); - if (returnVal == JFileChooser.APPROVE_OPTION) - { - Configuration.setLastOpenDirectory(fc.getSelectedFile()); - - File file = fc.getSelectedFile(); - if (!file.getAbsolutePath().endsWith(".zip")) - file = new File(file.getAbsolutePath() + ".zip"); - - if (file.exists()) - { - MultipleChoiceDialog overwriteDialog = new MultipleChoiceDialog("Bytecode Viewer - Overwrite File", - "The file " + file + " exists, would you like to overwrite it?", - new String[]{TranslatedStrings.YES.toString(), TranslatedStrings.NO.toString()}); - - if (overwriteDialog.promptChoice() != 0) - return; - - file.delete(); - } - - final File finalFile = file; - Thread downloadThread = new Thread(() -> { - try { - InputStream is = new URL("https://github.com/Konloch/bytecode-viewer/releases/download/v" + version + "/BytecodeViewer." + version + ".zip").openConnection().getInputStream(); - FileOutputStream fos = new FileOutputStream(finalFile); - try { - System.out.println("Downloading from https://github.com/Konloch/bytecode-viewer/releases/download/v" + version + "/BytecodeViewer." + version + ".zip"); - byte[] buffer = new byte[8192]; - int len; - int downloaded = 0; - boolean flag = false; - BytecodeViewer.showMessage("Downloading the jar in the background, when it's finished " - + "you will be alerted with another message box." + nl + nl + - "Expect this to take several minutes."); - - while ((len = is.read(buffer)) > 0) - { - fos.write(buffer, 0, len); - fos.flush(); - downloaded += 8192; - int mbs = downloaded / 1048576; - if (mbs % 5 == 0 && mbs != 0) - { - if (!flag) - System.out.println("Downloaded " + mbs + "MBs so far"); - flag = true; - } else - flag = false; - } - } finally { - try { - if (is != null) { - is.close(); - } - } finally { - fos.flush(); - fos.close(); - } - } - System.out.println("Download finished!"); - BytecodeViewer.showMessage("Download successful! You can find the updated program at " + finalFile.getAbsolutePath()); - } catch (FileNotFoundException e) { - try { - InputStream is = new URL("https://github.com/Konloch/bytecode-viewer/releases/download/v" + version + "/BytecodeViewer." + version + ".jar" - ).openConnection().getInputStream(); - FileOutputStream fos = new FileOutputStream(finalFile); - try { - System.out.println("Downloading from https://github.com/Konloch/bytecode-viewer/releases/download/v" + version + "/BytecodeViewer." + version + ".jar"); - byte[] buffer = new byte[8192]; - int len; - int downloaded = 0; - boolean flag = false; - BytecodeViewer.showMessage("Downloading the jar in the background, when it's " - + "finished you will be alerted with another message box." + nl + nl + "Expect this to take several minutes."); - while ((len = is.read(buffer)) > 0) { - fos.write(buffer, 0, len); - fos.flush(); - downloaded += 8192; - int mbs = downloaded / 1048576; - if (mbs % 5 == 0 && mbs != 0) { - if (!flag) - System.out.println("Downloaded " + mbs + "MBs so far"); - flag = true; - } else - flag = false; - } - } finally { - try { - if (is != null) { - is.close(); - } - } finally { - fos.flush(); - fos.close(); - } - } - System.out.println("Download finished!"); - BytecodeViewer.showMessage("Download successful! You can find the updated program at " + finalFile.getAbsolutePath()); - } catch (FileNotFoundException ex) { - BytecodeViewer.showMessage("Unable to download, the zip file has not been uploaded yet, " - + "please try again in about 10 minutes."); - } catch (Exception ex) { - BytecodeViewer.handleException(ex); - } - - } catch (Exception e) { - BytecodeViewer.handleException(e); - } - - }, "Downloader"); - downloadThread.start(); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } -}