コード例 #1
0
ファイル: LaunchFrame.java プロジェクト: eightbitme/FTBLaunch
  /**
   * Launch the application.
   *
   * @param args - CLI arguments
   */
  public static void main(String[] args) {
    tracker.setEnabled(true);
    TrackerUtils.sendPageView("net/ftb/gui/LaunchFrame.java", "Launcher Start v" + version);

    if (new File(Settings.getSettings().getInstallPath(), "FTBLauncherLog.txt").exists()) {
      new File(Settings.getSettings().getInstallPath(), "FTBLauncherLog.txt").delete();
    }

    if (new File(Settings.getSettings().getInstallPath(), "MinecraftLog.txt").exists()) {
      new File(Settings.getSettings().getInstallPath(), "MinecraftLog.txt").delete();
    }

    DownloadUtils thread = new DownloadUtils();
    thread.start();

    Logger.logInfo("FTBLaunch starting up (version " + version + ")");
    Logger.logInfo("Java version: " + System.getProperty("java.version"));
    Logger.logInfo("Java vendor: " + System.getProperty("java.vendor"));
    Logger.logInfo("Java home: " + System.getProperty("java.home"));
    Logger.logInfo(
        "Java specification: "
            + System.getProperty("java.vm.specification.name")
            + " version: "
            + System.getProperty("java.vm.specification.version")
            + " by "
            + System.getProperty("java.vm.specification.vendor"));
    Logger.logInfo(
        "Java vm: "
            + System.getProperty("java.vm.name")
            + " version: "
            + System.getProperty("java.vm.version")
            + " by "
            + System.getProperty("java.vm.vendor"));
    Logger.logInfo(
        "OS: "
            + System.getProperty("os.arch")
            + " "
            + System.getProperty("os.name")
            + " "
            + System.getProperty("os.version"));

    EventQueue.invokeLater(
        new Runnable() {
          @Override
          public void run() {
            StyleUtil.loadUiStyles();
            Logger.logInfo(UIManager.getInstalledLookAndFeels().toString());
            try {
              for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                  UIManager.setLookAndFeel(info.getClassName());
                  break;
                }
              }
            } catch (Exception e) {
              try {
                UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
              } catch (Exception e1) {
              }
            }
            I18N.setupLocale();
            I18N.setLocale(Settings.getSettings().getLocale());

            if (noConfig) {
              InstallDirectoryDialog installDialog = new InstallDirectoryDialog();
              installDialog.setVisible(true);
            }

            File installDir = new File(Settings.getSettings().getInstallPath());
            if (!installDir.exists()) {
              installDir.mkdirs();
            }
            File dynamicDir = new File(OSUtils.getDynamicStorageLocation());
            if (!dynamicDir.exists()) {
              dynamicDir.mkdirs();
            }

            userManager =
                new UserManager(new File(OSUtils.getDynamicStorageLocation(), "logindata"));
            con = new LauncherConsole();
            if (Settings.getSettings().getConsoleActive()) {
              con.setVisible(true);
            }

            File credits = new File(OSUtils.getDynamicStorageLocation(), "credits.txt");

            try {
              if (!credits.exists()) {
                FileOutputStream fos = new FileOutputStream(credits);
                OutputStreamWriter osw = new OutputStreamWriter(fos);

                osw.write(
                    "FTB Launcher and Modpack Credits " + System.getProperty("line.separator"));
                osw.write("-------------------------------" + System.getProperty("line.separator"));
                osw.write("Launcher Developers:" + System.getProperty("line.separator"));
                osw.write("jjw123" + System.getProperty("line.separator"));
                osw.write("unv_annihilator" + System.getProperty("line.separator"));
                osw.write(
                    "Vbitz"
                        + System.getProperty("line.separator")
                        + System.getProperty("line.separator"));
                osw.write("Web Developers:" + System.getProperty("line.separator"));
                osw.write("captainnana" + System.getProperty("line.separator"));
                osw.write(
                    "Rob"
                        + System.getProperty("line.separator")
                        + System.getProperty("line.separator"));
                osw.write("Modpack Team:" + System.getProperty("line.separator"));
                osw.write("CWW256" + System.getProperty("line.separator"));
                osw.write("Lathanael" + System.getProperty("line.separator"));
                osw.write("Watchful11" + System.getProperty("line.separator"));

                osw.flush();

                TrackerUtils.sendPageView("net/ftb/gui/LaunchFrame.java", "Unique User (Credits)");
              }

              if (!Settings.getSettings().getLoaded() && !Settings.getSettings().getSnooper()) {
                TrackerUtils.sendPageView("net/ftb/gui/LaunchFrame.java", "Unique User (Settings)");
                Settings.getSettings().setLoaded(true);
              }

            } catch (FileNotFoundException e1) {
              Logger.logError(e1.getMessage());
            } catch (IOException e1) {
              Logger.logError(e1.getMessage());
            }

            LaunchFrame frame = new LaunchFrame(2);
            instance = frame;
            frame.setVisible(true);

            Thread.setDefaultUncaughtExceptionHandler(
                new Thread.UncaughtExceptionHandler() {
                  @Override
                  public void uncaughtException(Thread t, Throwable e) {
                    Logger.logError("Unhandled exception in " + t.toString(), e);
                  }
                });

            ModPack.addListener(frame.modPacksPane);
            ModPack.loadXml(getXmls());

            Map.addListener(frame.mapsPane);
            //				Map.loadAll();

            TexturePack.addListener(frame.tpPane);
            //				TexturePack.loadAll();

            UpdateChecker updateChecker = new UpdateChecker(buildNumber);
            if (updateChecker.shouldUpdate()) {
              LauncherUpdateDialog p = new LauncherUpdateDialog(updateChecker);
              p.setVisible(true);
            }
          }
        });
  }
コード例 #2
0
ファイル: LaunchFrame.java プロジェクト: nekosune/AZLauncher
  /**
   * Launch the application.
   *
   * @param args - CLI arguments
   */
  public static void main(String[] args) {
    // AnalyticsConfigData config = new AnalyticsConfigData("UA-37330489-2");
    // tracker = new JGoogleAnalyticsTracker(config, GoogleAnalyticsVersion.V_4_7_2,
    // DispatchMode.MULTI_THREAD);
    // tracker.setEnabled(true);

    if (!Settings.getSettings().getSnooper()) {
      //	tracker.trackPageViewFromReferrer("net/ftb/gui/LaunchFrame.java", "Launcher Start", "Feed
      // The Beast", "http://www.feed-the-beast.com", "/");
    }

    if (new File(Settings.getSettings().getInstallPath(), "AZLauncherLog.txt").exists()) {
      new File(Settings.getSettings().getInstallPath(), "AZLauncherLog.txt").delete();
    }
    if (new File(Settings.getSettings().getInstallPath(), "MinecraftLog.txt").exists()) {
      new File(Settings.getSettings().getInstallPath(), "MinecraftLog.txt").delete();
    }

    DownloadUtils thread = new DownloadUtils();
    thread.start();

    Logger.logInfo("FTBLaunch starting up (version " + version + ")");
    Logger.logInfo("Java version: " + System.getProperty("java.version"));
    Logger.logInfo("Java vendor: " + System.getProperty("java.vendor"));
    Logger.logInfo("Java home: " + System.getProperty("java.home"));
    Logger.logInfo(
        "Java specification: "
            + System.getProperty("java.vm.specification.name")
            + " version: "
            + System.getProperty("java.vm.specification.version")
            + " by "
            + System.getProperty("java.vm.specification.vendor"));
    Logger.logInfo(
        "Java vm: "
            + System.getProperty("java.vm.name")
            + " version: "
            + System.getProperty("java.vm.version")
            + " by "
            + System.getProperty("java.vm.vendor"));
    Logger.logInfo(
        "OS: "
            + System.getProperty("os.arch")
            + " "
            + System.getProperty("os.name")
            + " "
            + System.getProperty("os.version"));

    EventQueue.invokeLater(
        new Runnable() {
          @Override
          public void run() {
            StyleUtil.loadUiStyles();
            try {
              for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                  UIManager.setLookAndFeel(info.getClassName());
                  break;
                }
              }
            } catch (Exception e) {
              try {
                UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
              } catch (Exception e1) {
              }
            }
            I18N.setupLocale();
            I18N.setLocale(Settings.getSettings().getLocale());

            if (noConfig) {
              InstallDirectoryDialog installDialog = new InstallDirectoryDialog();
              installDialog.setVisible(true);
            }

            File installDir = new File(Settings.getSettings().getInstallPath());
            if (!installDir.exists()) {
              installDir.mkdirs();
            }
            File dynamicDir = new File(OSUtils.getDynamicStorageLocation());
            if (!dynamicDir.exists()) {
              dynamicDir.mkdirs();
            }

            userManager =
                new UserManager(new File(OSUtils.getDynamicStorageLocation(), "logindata"));
            con = new LauncherConsole();
            if (Settings.getSettings().getConsoleActive()) {
              con.setVisible(true);
            }

            LaunchFrame frame = new LaunchFrame(2);
            instance = frame;
            frame.setVisible(true);

            Thread.setDefaultUncaughtExceptionHandler(
                new Thread.UncaughtExceptionHandler() {
                  @Override
                  public void uncaughtException(Thread t, Throwable e) {
                    Logger.logError("Unhandled exception in " + t.toString(), e);
                  }
                });

            ModPack.addListener(frame.modPacksPane);
            ModPack.loadXml(getXmls());

            Map.addListener(frame.mapsPane);
            Map.loadAll();

            //				TexturePack.addListener(frame.tpPane);
            //				TexturePack.loadAll();

            UpdateChecker updateChecker = new UpdateChecker(buildNumber);
            if (updateChecker.shouldUpdate()) {
              LauncherUpdateDialog p = new LauncherUpdateDialog(updateChecker);
              p.setVisible(true);
            }
          }
        });
  }