Updated library
This commit is contained in:
parent
34984083ce
commit
ac052812b2
Binary file not shown.
@ -10,6 +10,7 @@ favour and pour yourself some nice Jack Daniels. You deserve it if you're going
|
|||||||
|
|
||||||
package Launcher;
|
package Launcher;
|
||||||
|
|
||||||
|
import Launcher.net.Updater;
|
||||||
import com.tofvesson.reflection.SafeReflection;
|
import com.tofvesson.reflection.SafeReflection;
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
@ -147,7 +148,11 @@ public class Main extends Application {
|
|||||||
icon.setImage(appIcon);
|
icon.setImage(appIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) { launch(args); }
|
public static void main(String[] args) {
|
||||||
|
Updater u = Updater.getInstance();
|
||||||
|
|
||||||
|
launch(args);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search for packs with an 80% match compared to detected string.
|
* Search for packs with an 80% match compared to detected string.
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package Launcher.net;
|
package Launcher.net;
|
||||||
|
|
||||||
|
import com.tofvesson.async.Async;
|
||||||
|
import com.tofvesson.reflection.SafeReflection;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
|
|
||||||
@ -9,27 +13,28 @@ import java.net.URLConnection;
|
|||||||
*/
|
*/
|
||||||
public class Updater {
|
public class Updater {
|
||||||
|
|
||||||
private static Updater instance;
|
private static volatile Updater instance;
|
||||||
|
private static final Async<Updater> setup = new Async<>(SafeReflection.getFirstConstructor(Updater.class));
|
||||||
private URLConnection conn;
|
private URLConnection conn;
|
||||||
|
public static final URL updateURL;
|
||||||
|
private boolean isUpdateAvailable = false;
|
||||||
|
|
||||||
private Updater(String URL) throws IOException {
|
static {
|
||||||
conn = new URL(URL).openConnection();
|
URL u = null;
|
||||||
|
try { u = new URL("https://github.com/GabrielTofvesson/TeamAvionLauncher/releases/"); } catch (MalformedURLException e) { e.printStackTrace(); }
|
||||||
|
updateURL = u;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void downloadStuff(){
|
private Updater(){
|
||||||
//TODO:
|
try {
|
||||||
|
conn = updateURL.openConnection();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.out.println("No internet connection available!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void downloadMoreStuff(){
|
public static Updater getInstance() {
|
||||||
|
return instance==null?instance=setup.await():instance; // Await async creation
|
||||||
}
|
|
||||||
|
|
||||||
public void downloadEvenMoreStuff(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Updater getInstance(String url) throws IOException {
|
|
||||||
if(instance==null) instance = new Updater(url);
|
|
||||||
return instance;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user