Repackaging

This commit is contained in:
Konloch 2021-07-21 12:55:20 -07:00
parent d8c88b18d1
commit e63676e92a
8 changed files with 11 additions and 211 deletions

View file

@ -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;

View file

@ -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 *

View file

@ -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 *

View file

@ -1,4 +1,4 @@
package the.bytecode.club.bytecodeviewer.bootloader.util.nullpermablehashmap;
package the.bytecode.club.bytecodeviewer.bootloader.classtree.nullpermablehashmap;
import java.util.HashMap;

View file

@ -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;

View file

@ -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 *

View file

@ -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 *

View file

@ -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 <http://www.gnu.org/licenses/>. *
***************************************************************************/
/**
* @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();
}
}
}