Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.Neranaton.ReachEscrot.Bootstrap;
- import static fr.theshark34.swinger.Swinger.getResource;
- import static fr.theshark34.swinger.Swinger.setResourcePath;
- 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.util.ErrorUtil;
- import fr.theshark34.openlauncherlib.util.GameDir;
- import fr.theshark34.openlauncherlib.util.SplashScreen;
- import fr.theshark34.supdate.BarAPI;
- import fr.theshark34.supdate.SUpdate;
- import fr.theshark34.swinger.Swinger;
- import fr.theshark34.swinger.colored.SColoredBar;
- public class ReachEscrotBootstrap {
- private static SplashScreen splash;
- private static SColoredBar bar;
- private static Thread barThread;
- private static final LauncherInfos SC_B_INFOS = new LauncherInfos("ReachEscrot 1", "fr.Neranaton.ReachEscrot.LauncherFrame");
- private static final File SC_DIR = GameDir.createGameDir("ReachEscrot 1");
- private static final LauncherClasspath SC_B_CP = new LauncherClasspath(new File(SC_DIR, "Launcher/launcher.jar"), new File(SC_DIR, "Launcher/Libs/"));
- private static ErrorUtil errorUtil = new ErrorUtil(new File(SC_DIR, "Launcher/crashes/*"));
- public static void main(String[] args) {
- Swinger.setResourcePath("fr/Neranaton/ReachEscrot/BootStrap/resources");
- 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("ReachEscrot 1", Swinger.getResource("splash.png"));
- bar.setBounds(0, 490, 350, 20);
- splash.add(bar);
- bar = new SColoredBar(Swinger.getTransparentWhite(100), Swinger.getTransparentWhite(175));
- splash.setVisible(true);
- }
- private static void doUpdate() throws Exception {
- SUpdate su = new SUpdate("http://escrot.livehost.fr/Bootstrap", new File(SC_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();
- barThread.interrupt();
- }
- private static void launchLauncher() throws IOException {
- Bootstrap bootstrap = new Bootstrap(SC_B_CP, SC_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