Ejemplo n.º 1
0
  /** Executes the first run or migration wizards as required. */
  private static void doFirstRun() {
    if (IdentityManager.getGlobalConfig().getOptionBool("general", "firstRun")) {
      IdentityManager.getConfigIdentity().setOption("general", "firstRun", "false");
      getUI().showFirstRunWizard();
      new Timer()
          .schedule(
              new TimerTask() {

                /** {@inheritDoc} */
                @Override
                public void run() {
                  getUI().showFeedbackNag();
                }
              },
              FEEDBACK_DELAY);
    }
  }
Ejemplo n.º 2
0
 /** {@inheritDoc} */
 @Override
 public ValidationResponse validate(final String object) {
   if (object == null || object.isEmpty()) {
     return new ValidationResponse("Cannot be empty");
   } else if (IdentityManager.getGlobalConfig().hasOptionString("protocol", object)) {
     return new ValidationResponse("Cannot already exist");
   } else {
     return new ValidationResponse();
   }
 }
  /**
   * Attempts to fetch information from VLC's web interface.
   *
   * @return True on success, false otherwise
   */
  private boolean fetchInformation() {
    information.clear();
    List<String> res;
    List<String> res2;

    try {
      res =
          Downloader.getPage(
              "http://"
                  + IdentityManager.getGlobalConfig().getOption(getDomain(), "host")
                  + "/old/info.html");
      res2 =
          Downloader.getPage(
              "http://"
                  + IdentityManager.getGlobalConfig().getOption(getDomain(), "host")
                  + "/old/");
      parseInformation(res, res2);
      return true;
    } catch (MalformedURLException ex) {
      return false;
    } catch (IOException ex) {
      return false;
    }
  }
Ejemplo n.º 4
0
  /**
   * Initialises the client.
   *
   * @param args The command line arguments
   */
  private static void init(final String[] args) {
    Thread.setDefaultUncaughtExceptionHandler(new DMDircExceptionHandler());

    for (Handler handler : java.util.logging.Logger.getLogger("").getHandlers()) {
      handler.setLevel(Level.OFF); // Needs to be changed to enable debugging
    }

    // Enable finer debugging for specific components like so:
    // java.util.logging.Logger.getLogger("com.dmdirc.plugins").setLevel(Level.ALL);

    IdentityManager.loadVersion();

    final CommandLineParser clp = new CommandLineParser(args);

    IdentityManager.load();

    final PluginManager pm = PluginManager.getPluginManager();

    ThemeManager.loadThemes();

    clp.applySettings();

    CommandManager.initCommands();

    for (String service : new String[] {"ui", "tabcompletion"}) {
      ensureExists(pm, service);
    }

    loadUI(pm, IdentityManager.getGlobalConfig());

    doFirstRun();

    ActionManager.init();

    pm.doAutoLoad();

    ActionManager.loadActions();

    getUI().getMainWindow();

    ActionManager.processEvent(CoreActionType.CLIENT_OPENED, null);

    UpdateChecker.init();

    clp.processArguments();

    GlobalWindow.init();

    Runtime.getRuntime()
        .addShutdownHook(
            new Thread(
                new Runnable() {
                  /** {@inheritDoc} */
                  @Override
                  public void run() {
                    ActionManager.processEvent(CoreActionType.CLIENT_CLOSED, null);
                    ServerManager.getServerManager().disconnectAll("Unexpected shutdown");
                    IdentityManager.save();
                  }
                },
                "Shutdown thread"));
  }
Ejemplo n.º 5
0
 /**
  * Quits the client nicely, with the default closing message.
  *
  * @param exitCode This is the exit code that will be returned to the operating system when the
  *     client exits
  */
 public static void quit(final int exitCode) {
   quit(IdentityManager.getGlobalConfig().getOption("general", "closemessage"), exitCode);
 }