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

View file

@ -45,6 +45,9 @@ public class Constants
//dev mode is just a check for running via IDE
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 nl = System.getProperty("line.separator");
@ -111,6 +114,9 @@ public class Constants
*/
public static String getVersion(String mavenVersion)
{
if(TEST_VERSION_CHECKER)
return "2.10.1";
if(mavenVersion == null)
{
DEV_MODE = true;

View file

@ -1,5 +1,6 @@
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;
@ -47,23 +48,19 @@ public class VersionChecker implements Runnable
{
try {
HTTPRequest r = new HTTPRequest(new URL("https://raw.githubusercontent.com/Konloch/bytecode-viewer/master/VERSION"));
final String version = r.readSingle();
final String localVersion = VERSION + 0;
final Version version = Version.parseVersion(r.readSingle());
final Version localVersion = Version.parseVersion(VERSION);
try {
int simplemaths = Integer.parseInt(version.replace(".", ""));
int simplemaths2 = Integer.parseInt(localVersion.replace(".", ""));
if (simplemaths2 > simplemaths)
return; //developer version
} catch (Exception ignored) {
//developer version
if (!localVersion.isGreaterThan(version))
return;
} catch (Exception ignored) { }
}
if (VERSION != null && !VERSION.equals(version))
{
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"});
new String[]{"Open The Download Page", "Download The Updated Jar", "Do Nothing (And Don't Ask Again)"});
int result = outdatedDialog.promptChoice();
@ -77,17 +74,11 @@ public class VersionChecker implements Runnable
}
else if (result == 1)
{
JFileChooser fc = new FileChooser(Configuration.getLastOpenDirectory(),
JFileChooser fc = new FileChooser(new File("./").getCanonicalFile(),
"Select Save File",
"Zip Archives",
"zip");
try {
fc.setCurrentDirectory(new File(".").getAbsoluteFile()); //set the current working directory
} catch (Exception e) {
BytecodeViewer.handleException(e);
}
int returnVal = fc.showSaveDialog(BytecodeViewer.viewer);
if (returnVal == JFileChooser.APPROVE_OPTION)
{
@ -202,7 +193,6 @@ public class VersionChecker implements Runnable
downloadThread.start();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}