diff --git a/QuickLaunch/bin/basics/BasicGuiApp$1.class b/QuickLaunch/bin/basics/BasicGuiApp$1.class index 4b94953..c9c55f2 100644 Binary files a/QuickLaunch/bin/basics/BasicGuiApp$1.class and b/QuickLaunch/bin/basics/BasicGuiApp$1.class differ diff --git a/QuickLaunch/bin/basics/BasicGuiApp.class b/QuickLaunch/bin/basics/BasicGuiApp.class index c11e0d0..e3df2fe 100644 Binary files a/QuickLaunch/bin/basics/BasicGuiApp.class and b/QuickLaunch/bin/basics/BasicGuiApp.class differ diff --git a/QuickLaunch/bin/update/UpdateChecker.class b/QuickLaunch/bin/update/UpdateChecker.class index 67e0ea2..183a619 100644 Binary files a/QuickLaunch/bin/update/UpdateChecker.class and b/QuickLaunch/bin/update/UpdateChecker.class differ diff --git a/QuickLaunch/bin/update/Updater.class b/QuickLaunch/bin/update/Updater.class index c28f1ad..3618065 100644 Binary files a/QuickLaunch/bin/update/Updater.class and b/QuickLaunch/bin/update/Updater.class differ diff --git a/QuickLaunch/settings.properties b/QuickLaunch/settings.properties index 75f37c9..2f6a4f2 100644 --- a/QuickLaunch/settings.properties +++ b/QuickLaunch/settings.properties @@ -1,4 +1,4 @@ -#Sun Apr 14 19:07:39 CEST 2019 +#Mon Apr 15 11:05:55 CEST 2019 Load-File-on-startup=true key2=44 key1=29 diff --git a/QuickLaunch/src/basics/BasicGuiApp.java b/QuickLaunch/src/basics/BasicGuiApp.java index a9dbfd5..ce89ef8 100644 --- a/QuickLaunch/src/basics/BasicGuiApp.java +++ b/QuickLaunch/src/basics/BasicGuiApp.java @@ -31,7 +31,6 @@ public class BasicGuiApp extends Application{ public static KeyChecker listener; public BasicGuiApp(){ - ModLoader ml = new ModLoader(); ml.init(); ml.addMods(); @@ -45,7 +44,6 @@ public class BasicGuiApp extends Application{ } listener = new KeyChecker(); LogManager.getLogManager().reset(); - Logger logger = Logger.getLogger(GlobalScreen.class.getPackage().getName()); logger.setLevel(Level.OFF); GlobalScreen.addNativeKeyListener(listener); diff --git a/QuickLaunch/src/update/UpdateChecker.java b/QuickLaunch/src/update/UpdateChecker.java index b77b34f..b135ce7 100644 --- a/QuickLaunch/src/update/UpdateChecker.java +++ b/QuickLaunch/src/update/UpdateChecker.java @@ -14,7 +14,7 @@ public class UpdateChecker { public void requestServerData(){ try { Socket socket = new Socket(); - socket.connect(new InetSocketAddress(InetAddress.getByName("cookiestudios.org"), 9999), 700); + socket.connect(new InetSocketAddress(InetAddress.getByName("cookiestudios.org"), 9999), 2000); DataInputStream in = new DataInputStream(socket.getInputStream()); DataOutputStream out = new DataOutputStream(socket.getOutputStream()); @@ -30,7 +30,6 @@ public class UpdateChecker { String[] keyValue = str.split("="); serverData.put(keyValue[0], keyValue[1]); } - socket.close(); } catch (IOException e) { e.printStackTrace(); diff --git a/QuickLaunch/src/update/Updater.java b/QuickLaunch/src/update/Updater.java index 51e23c9..962e524 100644 --- a/QuickLaunch/src/update/Updater.java +++ b/QuickLaunch/src/update/Updater.java @@ -9,6 +9,7 @@ import java.nio.channels.ReadableByteChannel; import java.util.Optional; import guis.MainGui; +import javafx.application.Platform; import javafx.scene.control.Alert; import javafx.scene.control.Alert.AlertType; import javafx.scene.control.ButtonType; @@ -22,37 +23,42 @@ public class Updater { uc.requestServerData(); System.out.println("got version: " + uc.getLatestVersion()); if(uc.getLatestVersion() > Start.VERSION){ - String dl = "https://cookiestudios.org/software/QuickLaunch/QuickLaunch.jar"; - Alert updateAlert = new Alert(AlertType.INFORMATION, + Platform.runLater(new Runnable() { + @Override + public void run() { + String dl = "https://cookiestudios.org/software/QuickLaunch/QuickLaunch.jar"; + Alert updateAlert = new Alert(AlertType.INFORMATION, "There is a newer version of QuickLaunch available\nDownload now?", ButtonType.YES, ButtonType.NO); - updateAlert.setTitle("Update available!"); - Optional result = updateAlert.showAndWait(); - if(result.isPresent() && result.get() == ButtonType.YES){ - try { - System.out.println("here"); - cleanDirectory(); - URL website = new URL(dl); - ReadableByteChannel rbc = Channels.newChannel(website.openStream()); - FileOutputStream fos = new FileOutputStream(SettingManager.getJarDirectory()+File.separator+"Squirrel.jar"); - fos.getChannel().transferFrom(rbc, 0, Integer.MAX_VALUE); - fos.close(); - try { - ProcessBuilder pb = new ProcessBuilder("java","-jar",SettingManager.getJarDirectory()+File.separator+"Squirrel.jar"); - pb.directory(new File(SettingManager.getJarDirectory())); - pb.redirectErrorStream(true); - pb.redirectOutput(ProcessBuilder.Redirect.INHERIT); - pb.start(); - }catch(Exception e) { - e.printStackTrace(); + updateAlert.setTitle("Update available!"); + Optional result = updateAlert.showAndWait(); + if(result.isPresent() && result.get() == ButtonType.YES){ + try { + System.out.println("here"); + cleanDirectory(); + URL website = new URL(dl); + ReadableByteChannel rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(SettingManager.getJarDirectory()+File.separator+"Squirrel.jar"); + fos.getChannel().transferFrom(rbc, 0, Integer.MAX_VALUE); + fos.close(); + try { + ProcessBuilder pb = new ProcessBuilder("java","-jar",SettingManager.getJarDirectory()+File.separator+"Squirrel.jar"); + pb.directory(new File(SettingManager.getJarDirectory())); + pb.redirectErrorStream(true); + pb.redirectOutput(ProcessBuilder.Redirect.INHERIT); + pb.start(); + }catch(Exception e) { + e.printStackTrace(); + } + System.exit(0); + } catch (IOException e) { + e.printStackTrace(); + MainGui.addNotification("Couldn't download update", 2); + } } - System.exit(0); - } catch (IOException e) { - e.printStackTrace(); - MainGui.addNotification("Couldn't download update", 2); } - } + }); } else{ if(uc.getLatestVersion() == Start.VERSION){ MainGui.addNotification("QuickLaunch is up to date", 2); diff --git a/QuickLaunchUpdateServer/bin/run/ServerThread.class b/QuickLaunchUpdateServer/bin/run/ServerThread.class index 99f0333..a3bca70 100644 Binary files a/QuickLaunchUpdateServer/bin/run/ServerThread.class and b/QuickLaunchUpdateServer/bin/run/ServerThread.class differ diff --git a/QuickLaunchUpdateServer/bin/run/Start.class b/QuickLaunchUpdateServer/bin/run/Start.class index 2981809..93ec466 100644 Binary files a/QuickLaunchUpdateServer/bin/run/Start.class and b/QuickLaunchUpdateServer/bin/run/Start.class differ diff --git a/QuickLaunchUpdateServer/bin/run/UpdateThread.class b/QuickLaunchUpdateServer/bin/run/UpdateThread.class index 5b90e66..40c6bfc 100644 Binary files a/QuickLaunchUpdateServer/bin/run/UpdateThread.class and b/QuickLaunchUpdateServer/bin/run/UpdateThread.class differ diff --git a/QuickLaunchUpdateServer/src/run/ServerThread.java b/QuickLaunchUpdateServer/src/run/ServerThread.java index 618a350..ff0ae22 100644 --- a/QuickLaunchUpdateServer/src/run/ServerThread.java +++ b/QuickLaunchUpdateServer/src/run/ServerThread.java @@ -15,7 +15,6 @@ implements Runnable { this.PORT = port; } - boolean updateNeeded = true; ServerSocket ses; Socket s; DataOutputStream out; @@ -25,25 +24,14 @@ implements Runnable { do { try { do { - updateNeeded = true; ses = new ServerSocket(this.PORT); s = ses.accept(); System.out.println("Connected with: " + s.getInetAddress()); out = new DataOutputStream(s.getOutputStream()); in = new DataInputStream(s.getInputStream()); - out.writeFloat(Start.version); + System.out.println(in.readUTF()); + out.writeUTF("VERSION="+Start.version); - System.out.println(in.readUTF()); - System.out.println(in.readUTF()); - System.out.println(in.readUTF()); - System.out.println(in.readUTF()); - - updateNeeded = in.readBoolean(); - - if (updateNeeded) { - System.out.println("Update needed, Download link was send"); - out.writeUTF(Start.download); - } out.close(); in.close(); s.close(); diff --git a/QuickLaunchUpdateServer/src/run/Start.java b/QuickLaunchUpdateServer/src/run/Start.java index 496f123..1b00598 100644 --- a/QuickLaunchUpdateServer/src/run/Start.java +++ b/QuickLaunchUpdateServer/src/run/Start.java @@ -6,7 +6,6 @@ import run.UpdateThread; public class Start { public static float version = -1.0f; - public static String download = ""; private static final int PORT = 9999; @@ -14,7 +13,6 @@ public class Start { public static void main(String[] args) { version = Float.parseFloat(JOptionPane.showInputDialog("QuickLaunch version:")); - download = JOptionPane.showInputDialog("Link to downloadable"); Thread ut = new Thread(new UpdateThread()); ut.start(); System.out.println("Update thread started"); diff --git a/QuickLaunchUpdateServer/src/run/UpdateThread.java b/QuickLaunchUpdateServer/src/run/UpdateThread.java index 1b61e5b..9330ff3 100644 --- a/QuickLaunchUpdateServer/src/run/UpdateThread.java +++ b/QuickLaunchUpdateServer/src/run/UpdateThread.java @@ -9,7 +9,6 @@ implements Runnable { public void run() { do { Start.version = Float.parseFloat(JOptionPane.showInputDialog("QuickLaunch version (" + Start.version + "): ")); - Start.download = JOptionPane.showInputDialog("Link to downloadable:"); } while (true); } } \ No newline at end of file