Fixed Versioning

The downloader is still broken and seems to have issues with the entire v2.10.x line so any version prompt cannot happen till everyone is on v2.11.x or it will just be a remote error

that also means the downloader needs to be fixed for v2.11.0
This commit is contained in:
Konloch 2021-07-21 10:47:56 -07:00
parent 7056c0bd40
commit 84d3b36454
3 changed files with 116 additions and 115 deletions

View file

@ -3,7 +3,7 @@
<groupId>the.bytecode.club</groupId> <groupId>the.bytecode.club</groupId>
<artifactId>bytecodeviewer</artifactId> <artifactId>bytecodeviewer</artifactId>
<version>2.10.14</version> <version>2.11.0</version>
<properties> <properties>
<java.version>1.8</java.version> <java.version>1.8</java.version>
@ -243,6 +243,11 @@
<artifactId>webp-imageio</artifactId> <artifactId>webp-imageio</artifactId>
<version>0.2.1</version> <version>0.2.1</version>
</dependency> </dependency>
<dependency>
<groupId>de.skuzzle</groupId>
<artifactId>semantic-version</artifactId>
<version>2.1.0</version>
</dependency>
<!-- TODO Re-add for Graal.JS support --> <!-- TODO Re-add for Graal.JS support -->
<!--<dependency> <!--<dependency>

View file

@ -45,6 +45,9 @@ public class Constants
//dev mode is just a check for running via IDE //dev mode is just a check for running via IDE
public static boolean DEV_MODE; public static boolean DEV_MODE;
//if true the version checker will prompt and ask how you would like to proceed
public static final boolean TEST_VERSION_CHECKER = false;
public static final String fs = System.getProperty("file.separator"); public static final String fs = System.getProperty("file.separator");
public static final String nl = System.getProperty("line.separator"); public static final String nl = System.getProperty("line.separator");
@ -111,6 +114,9 @@ public class Constants
*/ */
public static String getVersion(String mavenVersion) public static String getVersion(String mavenVersion)
{ {
if(TEST_VERSION_CHECKER)
return "2.10.1";
if(mavenVersion == null) if(mavenVersion == null)
{ {
DEV_MODE = true; DEV_MODE = true;

View file

@ -1,5 +1,6 @@
package the.bytecode.club.bytecodeviewer.util; package the.bytecode.club.bytecodeviewer.util;
import de.skuzzle.semantic.Version;
import me.konloch.kontainer.io.HTTPRequest; import me.konloch.kontainer.io.HTTPRequest;
import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Configuration; import the.bytecode.club.bytecodeviewer.Configuration;
@ -47,23 +48,19 @@ public class VersionChecker implements Runnable
{ {
try { try {
HTTPRequest r = new HTTPRequest(new URL("https://raw.githubusercontent.com/Konloch/bytecode-viewer/master/VERSION")); HTTPRequest r = new HTTPRequest(new URL("https://raw.githubusercontent.com/Konloch/bytecode-viewer/master/VERSION"));
final String version = r.readSingle(); final Version version = Version.parseVersion(r.readSingle());
final String localVersion = VERSION + 0; final Version localVersion = Version.parseVersion(VERSION);
try { try {
int simplemaths = Integer.parseInt(version.replace(".", "")); //developer version
int simplemaths2 = Integer.parseInt(localVersion.replace(".", "")); if (!localVersion.isGreaterThan(version))
if (simplemaths2 > simplemaths) return;
return; //developer version } catch (Exception ignored) { }
} catch (Exception ignored) {
}
if (VERSION != null && !VERSION.equals(version))
{
MultipleChoiceDialog outdatedDialog = new MultipleChoiceDialog("Bytecode Viewer - Outdated Version", MultipleChoiceDialog outdatedDialog = new MultipleChoiceDialog("Bytecode Viewer - Outdated Version",
"Your version: " + VERSION + ", latest version: " "Your version: " + VERSION + ", latest version: "
+ version + nl + "What would you like to do?", + version + nl + "What would you like to do?",
new String[]{"Open The Download Page", "Download The Updated Jar", "Do Nothing"}); new String[]{"Open The Download Page", "Download The Updated Jar", "Do Nothing (And Don't Ask Again)"});
int result = outdatedDialog.promptChoice(); int result = outdatedDialog.promptChoice();
@ -77,17 +74,11 @@ public class VersionChecker implements Runnable
} }
else if (result == 1) else if (result == 1)
{ {
JFileChooser fc = new FileChooser(Configuration.getLastOpenDirectory(), JFileChooser fc = new FileChooser(new File("./").getCanonicalFile(),
"Select Save File", "Select Save File",
"Zip Archives", "Zip Archives",
"zip"); "zip");
try {
fc.setCurrentDirectory(new File(".").getAbsoluteFile()); //set the current working directory
} catch (Exception e) {
BytecodeViewer.handleException(e);
}
int returnVal = fc.showSaveDialog(BytecodeViewer.viewer); int returnVal = fc.showSaveDialog(BytecodeViewer.viewer);
if (returnVal == JFileChooser.APPROVE_OPTION) if (returnVal == JFileChooser.APPROVE_OPTION)
{ {
@ -202,7 +193,6 @@ public class VersionChecker implements Runnable
downloadThread.start(); downloadThread.start();
} }
} }
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }