net.fs.utils.Tools Java Examples

The following examples show how to use net.fs.utils.Tools. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClientUI.java    From NSS with Apache License 2.0 5 votes vote down vote up
void setSpeed(int downloadSpeed, int uploadSpeed) {
    config.setDownloadSpeed(downloadSpeed);
    config.setUploadSpeed(uploadSpeed);
    int s1 = (int) ((float) downloadSpeed * 1.1f);
    text_ds.setText(" " + Tools.getSizeStringKB(s1) + "/s ");
    int s2 = (int) ((float) uploadSpeed * 1.1f);
    text_us.setText(" " + Tools.getSizeStringKB(s2) + "/s ");
    Route.localDownloadSpeed = downloadSpeed;
    Route.localUploadSpeed = config.uploadSpeed;

    saveConfig();
}
 
Example #2
Source File: ClientUI.java    From NSS with Apache License 2.0 5 votes vote down vote up
public void updateUISpeed(int conn, int downloadSpeed, int uploadSpeed) {
    String string =
            " 下载:" + Tools.getSizeStringKB(downloadSpeed) + "/s"
                    + " 上传:" + Tools.getSizeStringKB(uploadSpeed) + "/s";
    if (downloadSpeedField != null) {
        downloadSpeedField.setText(string);
    }
}
 
Example #3
Source File: ClientUI.java    From finalspeed-91yun with GNU General Public License v2.0 5 votes vote down vote up
void setSpeed(int downloadSpeed, int uploadSpeed) {
    config.setDownloadSpeed(downloadSpeed);
    config.setUploadSpeed(uploadSpeed);
    int s1 = (int) ((float) downloadSpeed * 1.1f);
    text_ds.setText(" " + Tools.getSizeStringKB(s1) + "/s ");
    int s2 = (int) ((float) uploadSpeed * 1.1f);
    text_us.setText(" " + Tools.getSizeStringKB(s2) + "/s ");
    Route.localDownloadSpeed = downloadSpeed;
    Route.localUploadSpeed = config.uploadSpeed;

    saveConfig();
}
 
Example #4
Source File: ClientUI.java    From finalspeed-91yun with GNU General Public License v2.0 5 votes vote down vote up
public void updateUISpeed(int conn, int downloadSpeed, int uploadSpeed) {
    String string =
            " 下载:" + Tools.getSizeStringKB(downloadSpeed) + "/s"
                    + " 上传:" + Tools.getSizeStringKB(uploadSpeed) + "/s";
    if (downloadSpeedField != null) {
        downloadSpeedField.setText(string);
    }
}
 
Example #5
Source File: ClientUI.java    From finalspeed-91yun with GNU General Public License v2.0 5 votes vote down vote up
public void checkUpdate() {
    for (int i = 0; i < 3; i++) {
        checkingUpdate = true;
        try {
            Properties propServer = new Properties();
            HttpURLConnection uc = Tools.getConnection(updateUrl);
            uc.setUseCaches(false);
            InputStream in = uc.getInputStream();
            propServer.load(in);
            serverVersion = Integer.parseInt(propServer.getProperty("version"));
            break;
        } catch (Exception e) {
            e.printStackTrace();
            try {
                Thread.sleep(3 * 1000);
            } catch (InterruptedException e1) {
                e1.printStackTrace();
            }
        } finally {
            checkingUpdate = false;
        }
    }
    if (this.haveNewVersion()) {
        int option = JOptionPane.showConfirmDialog(mainFrame, "发现新版本,立即更新吗?", "提醒", JOptionPane.WARNING_MESSAGE);
        if (option == JOptionPane.YES_OPTION) {
            openUrl(homeUrl);
        }
    }

}
 
Example #6
Source File: ClientUI.java    From finalspeed with GNU General Public License v2.0 5 votes vote down vote up
void setSpeed(int downloadSpeed, int uploadSpeed) {
    config.setDownloadSpeed(downloadSpeed);
    config.setUploadSpeed(uploadSpeed);
    int s1 = (int) ((float) downloadSpeed * 1.1f);
    text_ds.setText(" " + Tools.getSizeStringKB(s1) + "/s ");
    int s2 = (int) ((float) uploadSpeed * 1.1f);
    text_us.setText(" " + Tools.getSizeStringKB(s2) + "/s ");
    Route.localDownloadSpeed = downloadSpeed;
    Route.localUploadSpeed = config.uploadSpeed;

    saveConfig();
}
 
Example #7
Source File: ClientUI.java    From finalspeed with GNU General Public License v2.0 5 votes vote down vote up
public void updateUISpeed(int conn, int downloadSpeed, int uploadSpeed) {
    String string =
            " 下载:" + Tools.getSizeStringKB(downloadSpeed) + "/s"
                    + " 上传:" + Tools.getSizeStringKB(uploadSpeed) + "/s";
    if (downloadSpeedField != null) {
        downloadSpeedField.setText(string);
    }
}
 
Example #8
Source File: ClientUI.java    From finalspeed with GNU General Public License v2.0 5 votes vote down vote up
public void checkUpdate() {
    for (int i = 0; i < 3; i++) {
        checkingUpdate = true;
        try {
            Properties propServer = new Properties();
            HttpURLConnection uc = Tools.getConnection(updateUrl);
            uc.setUseCaches(false);
            InputStream in = uc.getInputStream();
            propServer.load(in);
            serverVersion = Integer.parseInt(propServer.getProperty("version"));
            break;
        } catch (Exception e) {
            e.printStackTrace();
            try {
                Thread.sleep(3 * 1000);
            } catch (InterruptedException e1) {
                e1.printStackTrace();
            }
        } finally {
            checkingUpdate = false;
        }
    }
    if (this.haveNewVersion()) {
        int option = JOptionPane.showConfirmDialog(mainFrame, "发现新版本,立即更新吗?", "提醒", JOptionPane
                .YES_NO_CANCEL_OPTION);
        if (option == JOptionPane.YES_OPTION) {
            openUrl(homeUrl);
        }
    }

}