Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.vekorax.derivium.bootstrap;
- import java.io.File;
- import java.io.IOException;
- import fr.theshark34.openlauncherlib.bootstrap.Bootstrap;
- import fr.theshark34.openlauncherlib.bootstrap.LauncherClasspath;
- import fr.theshark34.openlauncherlib.bootstrap.LauncherInfos;
- import fr.theshark34.openlauncherlib.external.ClasspathConstructor;
- import fr.theshark34.openlauncherlib.external.ExternalLaunchProfile;
- import fr.theshark34.openlauncherlib.external.ExternalLauncher;
- import fr.theshark34.openlauncherlib.util.CrashReporter;
- import fr.theshark34.openlauncherlib.util.ErrorUtil;
- import fr.theshark34.openlauncherlib.util.GameDir;
- import fr.theshark34.openlauncherlib.util.SplashScreen;
- import fr.theshark34.openlauncherlib.util.explorer.ExploredDirectory;
- import fr.theshark34.openlauncherlib.util.explorer.Explorer;
- import fr.theshark34.openlauncherlib.util.ramselector.RamSelector;
- import fr.theshark34.supdate.BarAPI;
- import fr.theshark34.supdate.SUpdate;
- import fr.theshark34.swinger.Swinger;
- import fr.theshark34.swinger.colored.SColoredBar;
- public class deriviumbootstrap {
- private static SplashScreen splash;
- private static SColoredBar bar;
- private static Thread barThread;
- private static final LauncherInfos DL_B_INFOS = new LauncherInfos("Derivium", "fr.vekorax.derivium.launcher.LauncherFrame");
- private static final File DL_DIR = GameDir.createGameDir("Derivium");
- private static final LauncherClasspath DL_B_CP = new LauncherClasspath(new File(DL_DIR, "Launcher/launcher.jar"), new File(DL_DIR, "Launcher/libs/"));
- private static final File DL_B_DIR = new File(DL_DIR, "Launcher/crashes/");
- private static final CrashReporter errorUtil = new CrashReporter("Derivium", DL_B_DIR);
- private static RamSelector selector = new RamSelector(new File(DL_DIR, "ram.txt"));
- public static void main(String[] args) {
- Swinger.setResourcePath("/fr/vekorax/derivium/bootstrap/ressource/");
- displaySplash();
- try {
- doUpdate();
- } catch (Exception e) {
- errorUtil.catchError(e, "Impossible de mettre a jour le launcher !");
- barThread.interrupt();
- }
- try {
- launchLauncher();
- } catch (IOException e) {
- errorUtil.catchError(e, "Impossible de lancer le launcher !");
- }
- }
- private static void displaySplash() {
- splash = new SplashScreen("Derivium", Swinger.getResource("bootstrap.png"));
- splash.setBackground(Swinger.TRANSPARENT);
- //splash.getContentPane().setBackground(Swinger.TRANSPARENT);
- splash.setLayout(null);
- bar = new SColoredBar(Swinger.getTransparentWhite(100), Swinger.getTransparentWhite(175));
- bar.setBounds(8, 344, 315, 22);
- splash.add(bar);
- splash.setVisible(true);
- }
- private static void doUpdate() throws Exception {
- SUpdate su = new SUpdate("https://fabricemorin00.000webhostapp.com/" , new File(DL_DIR, "Launcher"));
- barThread = new Thread() {
- @Override
- public void run() {
- while(!this.isInterrupted()) {
- bar.setValue((int) (BarAPI.getNumberOfTotalDownloadedBytes() / 1000));
- bar.setMaximum((int) (BarAPI.getNumberOfTotalBytesToDownload() / 1000));
- }
- }
- };
- barThread.start();
- su.start();
- //selector.display();
- barThread.interrupt();
- }
- private static void launchLauncher() throws IOException {
- //ClasspathConstructor constructor = new ClasspathConstructor();
- //ExploredDirectory gameDir = Explorer.dir("DL_B_DIR");
- //constructor.add(gameDir.sub("Libs").allRecursive().files().match("^(.*\\((jar)$))*$"));
- //constructor.add(gameDir.get("launcher.jar"));
- //ExternalLaunchProfile profile = new ExternalLaunchProfile("fr.vekorax.derivium.launcher.LauncherFrame", constructor.make());
- //ExternalLauncher Launcher = new ExternalLauncher(profile);
- Bootstrap bootstrap = new Bootstrap(DL_B_CP, DL_B_INFOS);
- Process p = bootstrap.launch();
- splash.setVisible(false);
- try {
- p.waitFor();
- } catch (InterruptedException e) {
- }
- System.exit(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement