Exemplo n.º 1
0
  @Override
  public void onLoad() {
    instance = this;
    log(
        "ThisIsAreku present "
            + this.getDescription().getName().toUpperCase()
            + ", v"
            + getDescription().getVersion());
    log("= " + this.getDescription().getWebsite() + " =");
    this.masterFilter = new MasterFilter();

    ColorConverter.initColorConverter();
    Config.loadConfig();
    loadFilters();
    initializeMasterFilter();

    if (Config.force_filters) {
      Bukkit.getServer()
          .getScheduler()
          .scheduleSyncRepeatingTask(
              this,
              new Runnable() {

                @Override
                public void run() {
                  initializeMasterFilter();
                }
              },
              5,
              Config.force_filters_intv * 20);
    }
  }
  /**
   * Launch the application.
   *
   * @throws IOException
   */
  public static void main(String[] args) throws IOException {
    Config config = new Config();
    config.loadTwitter();
    config.loadConfig();
    String[] twitterAccess = config.getTwitter();
    String CK = twitterAccess[0];
    String CS = twitterAccess[1];
    String AT = twitterAccess[2];
    String ATS = twitterAccess[3];
    if (CK.equals("") || CS.equals("") || AT.equals("") || ATS.equals("")) {
      new OAuth().setVisible(true);
      return;
    }
    if (config.getTargetDir().equals("")) {
      new Settings(true).setVisible(true);
      return;
    }

    EventQueue.invokeLater(
        new Runnable() {
          public void run() {
            try {
              Captter frame = new Captter();
              frame.setVisible(true);
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        });
  }
Exemplo n.º 3
0
 public void init(BaseGUI gui) throws Exception {
   this.gui = gui;
   Config.loadConfig(); // only load config after gui is set (because of homepath)
   ToolTipManager.sharedInstance()
       .setDismissDelay(Integer.MAX_VALUE); // Tooltips should not hide after some time
   gui.initGUI(); // show gui
 }
Exemplo n.º 4
0
  /**
   * Similar to main method but is not static
   *
   * @param args command line parameters
   * @throws Exception if something fails during the execution
   */
  public void doIt(String[] args) throws Exception {

    Config.loadConfig(
        new File("/Users/jzarzuela/Documents/java-Campus/_Util_DivxCleaner/resources/config.xml"));

    String newName =
        Filters.filterName(
            "Llama A La Comadrona - Temporada 1 [HDTV][Cap.103][Español Castellano]/LlaALComad103 [www.newpct.com]");
    System.out.println(newName);
  }
  private ReaderController() {
    bIsConnected = new NetworkUtil(mApp).hasConnectivity();
    ImgLruCacher.purgeDiskCache();

    trd.start();
    mDataHandler = new DataHandler(trd.getLooper());

    mInflator = (LayoutInflater) mApp.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mCs = new CookieStore(mApp);

    mConfig = new Config();
    mConfig.loadConfig();

    mSettings = new Settings();
    mShareHelper = new ShareHelper();

    mNewsHandler = new QueryNewsHandler();
    mapDrawNewsItem = new HashMap<>();

    newsSize =
        Integer.valueOf(
            Util.loadConfigAssets(mApp, "news_config.properties")
                .getProperty("CONFIG_NUM_ARTICLES"));
  }
  /** Create the frame. */
  public Captter() {
    try {
      UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
      SwingUtilities.updateComponentTreeUI(this);
    } catch (ClassNotFoundException
        | InstantiationException
        | IllegalAccessException
        | UnsupportedLookAndFeelException e1) {
    }

    setAlwaysOnTop(true);
    setTitle("Captter created by tao");

    Config config = new Config();
    config.loadTwitter();
    config.loadConfig();
    String[] twitterAccess = config.getTwitter();
    String CK = twitterAccess[0];
    String CS = twitterAccess[1];
    String AT = twitterAccess[2];
    String ATS = twitterAccess[3];

    Configuration jconf =
        new ConfigurationBuilder().setOAuthConsumerKey(CK).setOAuthConsumerSecret(CS).build();
    AccessToken token = new AccessToken(AT, ATS);

    twitter = new TwitterFactory(jconf).getInstance(token);

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(120, 120, 420, 240);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    tweet = new JButton("Tweet(Ctrl+Enter)");
    tweet.setBounds(260, 168, 140, 30);
    tweet.addActionListener(this);
    contentPane.add(tweet);

    textArea.setBounds(0, 0, 400, 130);
    textArea.setFont(new Font("メイリオ", Font.BOLD, 20));
    textArea.setLineWrap(true);
    contentPane.add(textArea);

    textField = new HintTextField();
    textField.setBounds(0, 140, 400, 28);
    textField.setFont(new Font("メイリオ", Font.PLAIN, 12));
    textField.setHint("固定テキスト");
    contentPane.add(textField);

    JSeparator separator = new JSeparator();
    separator.setBounds(0, 130, 400, 10);
    contentPane.add(separator);

    imageField = new JLabel("");
    imageField.setBounds(0, 0, 400, 130);
    contentPane.add(imageField);

    settings = new JButton("設定");
    settings.setBounds(0, 169, 70, 30);
    settings.addActionListener(this);
    contentPane.add(settings);

    convert = new JCheckBox("convert 16:9");
    convert.setSelected(true);
    convert.setBounds(70, 170, 111, 23);
    contentPane.add(convert);

    Quick = new JCheckBox("Quick");
    Quick.setBounds(185, 170, 70, 23);
    contentPane.add(Quick);

    textArea.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyPressed(KeyEvent e) {
            keyPress(e);
          }
        });

    addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            Config config = new Config();
            config.loadConfig();
            boolean[] removes = config.getRemoves();
            if (removes[0]) {
              File convertedDir =
                  new File(
                      new File(System.getProperty("java.class.path")).getParent() + "/converted/");
              String conDirPath = convertedDir.getPath();
              String[] convertedFiles = convertedDir.list();
              for (String s : convertedFiles) {
                if (s.endsWith(".png")) new File(conDirPath + "/" + s).delete();
              }
            }
            if (removes[1]) {
              File captureDir = new File(config.getTargetDir());
              String capDirPath = captureDir.getPath();
              String[] captureFiles = captureDir.list();
              for (String s : captureFiles) {
                if (s.endsWith(".jpg") || s.endsWith(".png") || s.endsWith(".bmp"))
                  new File(capDirPath + "/" + s).delete();
              }
            }
          }
        });

    AutoChecker ac = new AutoChecker(new File(config.getTargetDir()));
    ac.start(new File(config.getTargetDir()));
  }
Exemplo n.º 7
0
 private static void initConfiguration() {
   Config.loadConfig();
 }
Exemplo n.º 8
0
 @Test(expected = FileNotFoundException.class)
 public void loadConfigEmpty() throws Exception {
   final Config config = new Config();
   config.loadConfig("");
 }
Exemplo n.º 9
0
 @Test(expected = NullPointerException.class)
 public void loadConfigNull() throws Exception {
   final Config config = new Config();
   config.loadConfig(null);
 }
Exemplo n.º 10
0
 @Test(expected = FileNotFoundException.class)
 public void loadConfigNotFound() throws Exception {
   final Config config = new Config();
   config.loadConfig("/tmp/filedoesnotexist.conf");
 }
Exemplo n.º 11
0
 @EventHandler
 public void preInit(FMLPreInitializationEvent event) {
   proxy.preInit();
   Config.loadConfig(event);
   BUInit.preInit();
 }