コード例 #1
0
 public static void saveVariables() {
   VariablesManager vm = ScrollingMenuSign.getInstance().getVariablesManager();
   for (SMSVariables variables : vm.listVariables()) {
     save(variables);
   }
   Debugger.getInstance().debug("saved " + vm.listVariables().size() + " variable sets to file.");
 }
コード例 #2
0
  public static void loadViews() {
    ViewManager vm = ScrollingMenuSign.getInstance().getViewManager();

    for (SMSView view : vm.listViews()) {
      vm.deleteView(view, false);
    }

    for (File f : DirectoryStructure.getViewsFolder().listFiles(ymlFilter)) {
      Debugger.getInstance().debug(2, "loading view: " + f);
      YamlConfiguration conf = YamlConfiguration.loadConfiguration(f);
      SMSView view = vm.loadView(conf);
      if (view != null) {
        view.update(view.getNativeMenu(), new RepaintAction());
      }
    }

    Debugger.getInstance().debug("Loaded " + vm.listViews().size() + " views from file.");
  }
コード例 #3
0
  public static void loadVariables() {
    VariablesManager vm = ScrollingMenuSign.getInstance().getVariablesManager();

    vm.clear();
    for (File f : DirectoryStructure.getVarsFolder().listFiles(ymlFilter)) {
      vm.load(f);
    }
    Debugger.getInstance()
        .debug("Loaded " + vm.listVariables().size() + " variable sets from file.");
  }
コード例 #4
0
  public static void loadMenus() {
    MenuManager mm = ScrollingMenuSign.getInstance().getMenuManager();

    for (SMSMenu menu : mm.listMenus()) {
      menu.deleteTemporary();
    }

    for (File f : DirectoryStructure.getMenusFolder().listFiles(ymlFilter)) {
      try {
        Debugger.getInstance().debug(2, "loading menu: " + f);
        YamlConfiguration conf = YamlConfiguration.loadConfiguration(f);
        SMSMenu menu = new SMSMenu(conf);
        mm.registerMenu(menu.getName(), menu);
        menu.notifyObservers();
      } catch (SMSException e) {
        LogUtils.severe("Can't load menu data from " + f + ": " + e.getMessage());
      }
    }
    Debugger.getInstance().debug("Loaded " + mm.listMenus().size() + " menus from file.");
  }
コード例 #5
0
  public static void loadMacros() {
    for (SMSMacro macro : SMSMacro.listMacros()) {
      macro.deleteTemporary();
    }

    for (File f : DirectoryStructure.getMacrosFolder().listFiles(ymlFilter)) {
      YamlConfiguration conf = YamlConfiguration.loadConfiguration(f);
      SMSMacro m = new SMSMacro(conf);
      SMSMacro.addMacro(m);
    }
    Debugger.getInstance().debug("Loaded " + SMSMacro.listMacros().size() + " macros from file.");
  }
コード例 #6
0
 @Override
 public void run() {
   Debugger.getInstance().debug("database writer thread starting");
   while (true) {
     try {
       DatabaseSavable savable =
           handler.pollDatabaseUpdate(); // block until there's a record available
       if (savable instanceof Results.EndMarker) {
         break;
       }
       Connection conn = handler.getDBConnection();
       if (conn != null) {
         savable.saveToDatabase(conn);
       }
     } catch (InterruptedException e) {
       LogUtils.warning("interrupted while saving database results");
       e.printStackTrace();
     } catch (SQLException e) {
       LogUtils.warning("failed to save results record to database: " + e.getMessage());
     }
   }
   Debugger.getInstance().debug("database writer thread exiting");
 }
コード例 #7
0
  public static void saveMenusAndViews() {
    MenuManager mm = ScrollingMenuSign.getInstance().getMenuManager();
    ViewManager vm = ScrollingMenuSign.getInstance().getViewManager();

    for (SMSMenu menu : mm.listMenus()) {
      save(menu);
    }
    for (SMSView view : vm.listViews()) {
      save(view);
    }
    Debugger.getInstance()
        .debug(
            "saved "
                + mm.listMenus().size()
                + " menus and "
                + vm.listViews().size()
                + " views to file.");
  }
コード例 #8
0
 public void writeLine(String string) {
   writer.println(string);
   Debugger.getInstance().debug("ExternalIO: " + command + ": wrote [" + string + "]");
 }
コード例 #9
0
 public String readLine() throws IOException {
   String string = reader.readLine();
   Debugger.getInstance().debug("ExternalIO: " + command + ": read [" + string + "]");
   return string;
 }
コード例 #10
0
 public static void saveMacros() {
   for (SMSMacro macro : SMSMacro.listMacros()) {
     save(macro);
   }
   Debugger.getInstance().debug("saved " + SMSMacro.listMacros().size() + " macros to file.");
 }