Package org.spoutcraft.launcher

Examples of org.spoutcraft.launcher.StartupParameters


    System.setProperty("java.net.preferIPv4Stack" , "true");

    SplashScreen splash = new SplashScreen(Toolkit.getDefaultToolkit().getImage(SplashScreen.class.getResource("/org/spoutcraft/launcher/resources/splash.png")));
    splash.setVisible(true);

    StartupParameters params = setupParameters(args);
    SpoutcraftLauncher.logger = setupLogger();
   
    cleanup();

    int launcherBuild = parseInt(getLauncherBuild(), -1);
    logger.info("---------------------------------------------");
    logger.info("Spoutcraft Launcher is starting...");
    logger.info("Operating System: " + System.getProperty("os.name") + " " + System.getProperty("os.version") + " " + System.getProperty("os.arch"));
    logger.info("Java Version: " + System.getProperty("java.vendor") + " " + System.getProperty("java.version") + " <" + System.getProperty("java.vendor.url") + ">");
    logger.info("Launcher Build: " + launcherBuild);

    params.logParameters(logger);

    // Setup directories
    SpoutcraftDirectories dirs = new SpoutcraftDirectories();
    dirs.getSkinDir().mkdirs();
    dirs.getSpoutcraftDir().mkdirs();

    if (Settings.getYAML() == null) {
      YAMLProcessor settings = setupSettings();
      if (settings == null) {
        throw new NullPointerException("The YAMLProcessor object was null for settings.");
      }
      Settings.setYAML(settings);
    }
    Settings.setLauncherBuild(launcherBuild);
    setupProxy();

    if (params.isDebugMode()) {
      Settings.setDebugMode(true);
    }

    if (Settings.isDebugMode()) {
      logger.info("Initial organization and look and feel time took " + (System.currentTimeMillis() - start) + " ms");
      start = System.currentTimeMillis();
    }

    if (Settings.isDebugMode()) {
      logger.info("Loading settings took " + (System.currentTimeMillis() - start) + " ms");
      start = System.currentTimeMillis();
    }

    if (params.relaunch(logger)) {
      try {
        Thread.sleep(3000);
      } catch (InterruptedException e) { }
      System.exit(0);
      return;
    }

    checkInternet();

    validateBuild(params);

    setLookAndFeel();

    if (params.isConsole() || Settings.isDebugMode()) {
      setupConsole();
      logger.info("Debug mode activated!");
    }

    Runtime.getRuntime().addShutdownHook(new ShutdownThread());
    Thread logThread = new LogFlushThread();
    logThread.start();

    if (Settings.isDebugMode()) {
      logger.info("Internet validation and look and feel took " + (System.currentTimeMillis() - start) + " ms");
      start = System.currentTimeMillis();
    }

    // Set up the launcher and load login frame
    LoginFrame frame = new MetroLoginFrame();

    try {
      @SuppressWarnings("unused")
      Launcher launcher = new Launcher(new GameUpdater(), new GameLauncher(), frame);
    } catch (IOException failure) {
      failure.printStackTrace();
      ErrorDialog dialog = new ErrorDialog(frame, failure);
      splash.dispose();
      frame.setVisible(true);
      dialog.setAlwaysOnTop(true);
      dialog.setVisible(true);
      return;
    }
    Launcher.getGameUpdater().start();

    if (Settings.isDebugMode()) {
      logger.info("Loading default launcher skin took " + (System.currentTimeMillis() - start) + " ms");
      start = System.currentTimeMillis();
    }

    splash.dispose();
    frame.setVisible(true);
    if (params.hasAccount()) {
      frame.disableForm();
      frame.doLogin(params.getUser(), params.getPass());
    }

    logger.info("Launcher startup took " + (System.currentTimeMillis() - startupTime) + "ms");
  }
View Full Code Here


    return logger;
  }

  public static StartupParameters setupParameters(String[] args) {
    StartupParameters params = new StartupParameters(args);
    try {
      new JCommander(params, args);
    } catch (Exception ex) {
      ex.printStackTrace();
    }
    Utils.setStartupParameters(params);

    params.setupProxy();

    return params;
  }
View Full Code Here

    } else {
      temp = new File(Utils.getSystemTemporaryDirectory(), "temp.jar");
    }
    //Legacy support
    if (!temp.exists()) {
      Utils.setStartupParameters(new StartupParameters(new String[0]));
      if (exe) {
        temp = new File(Utils.getWorkingDirectory(), "temp.exe");
      } else {
        temp = new File(Utils.getWorkingDirectory(), "temp.jar");
      }
View Full Code Here

TOP

Related Classes of org.spoutcraft.launcher.StartupParameters

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.