From aa5d4bb97f850d904ed79e1b8073d32f77e53e15 Mon Sep 17 00:00:00 2001 From: Downforce Agent Date: Fri, 12 Jul 2024 13:49:37 -0500 Subject: [PATCH] fixed incorrect operator making notification appear when it wasn't supposed to --- firestar/src/main/java/Ernie.java | 17 ++++++++++++++--- firestar/src/main/java/Main.java | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/firestar/src/main/java/Ernie.java b/firestar/src/main/java/Ernie.java index dd0095c..973f44b 100644 --- a/firestar/src/main/java/Ernie.java +++ b/firestar/src/main/java/Ernie.java @@ -19,6 +19,7 @@ import java.awt.Desktop; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -30,6 +31,7 @@ import java.net.URL; import java.nio.charset.Charset; import java.util.logging.Level; import java.util.logging.Logger; +import javax.imageio.ImageIO; import javax.swing.JButton; import javax.swing.JEditorPane; import javax.swing.JFrame; @@ -57,15 +59,24 @@ public class Ernie implements ActionListener, Runnable { private JButton surebtn; public boolean backgroundDone = false; - + private BufferedImage windowIcon; + public void run() { + try { + windowIcon = ImageIO.read(Main.class.getResourceAsStream("/titleIcon.png")); + frame.setIconImage(windowIcon); + } catch (IOException e) { + System.out.println("ERROR: Failed to find /resources/titleIcon.png. Window will not have an icon."); + } byte[] urlraw = new Ernie().getFile(gitapi+"/releases?draft=false&pre-release=false"); if (urlraw.length <= 0) { JOptionPane.showMessageDialog(frame, "Internal Error: Couldn't check for updates.", "Fatal Error", JOptionPane.ERROR_MESSAGE); } else { try { JSONArray releases = new JSONArray(new String(urlraw, Charset.forName("utf-8"))); - if (releases.length() >= 1 && ((JSONObject)releases.get(0)).get("tag_name") != Main.vtag) { + System.out.println("Updater: latest release is " + ((JSONObject)releases.get(0)).get("tag_name")); + if (releases.length() >= 1 && !((JSONObject)releases.get(0)).get("tag_name").equals(Main.vtag)) { + System.out.println("Updater: Your version is out of date."); frame.add(frameContainer); notnowbtn.addActionListener(this); surebtn.addActionListener(this); @@ -79,7 +90,7 @@ public class Ernie implements ActionListener, Runnable { frame.setLocationRelativeTo(null); frame.setAlwaysOnTop(true); frame.setVisible(true); - } else { System.out.println("Problem??"); } + } else { System.out.println("Updater: No updates."); } } catch (IOException ex) { Logger.getLogger(Ernie.class.getName()).log(Level.SEVERE, null, ex); } catch (JSONException ex) { diff --git a/firestar/src/main/java/Main.java b/firestar/src/main/java/Main.java index 5fed180..402f0f3 100644 --- a/firestar/src/main/java/Main.java +++ b/firestar/src/main/java/Main.java @@ -31,7 +31,7 @@ public class Main { // Build Information public static final String vstr = "Release 1.3"; public static final String vcode = "Tetsuo"; - public static final String vtag = "dekka-1.1"; //tetsuo-1.3 + public static final String vtag = "tetsuo-1.3"; // set to dekka-1.1 for testing public static final int vint = 1; // User Settings