This commit is contained in:
tonikelope 2016-10-12 20:52:13 +02:00
parent 193a763f54
commit 10009ee927
4 changed files with 17 additions and 30 deletions

View File

@ -168,9 +168,11 @@ public final class AboutDialog extends javax.swing.JDialog {
@Override
public void run() {
if(MiscTools.checkNewVersion("lYsRWaQB", "uVhntmyKcVECRaOxAbcL4A")) {
String new_version = MiscTools.checkNewVersion("lYsRWaQB", "uVhntmyKcVECRaOxAbcL4A");
if(new_version != null) {
JOptionPane.showMessageDialog(tthis, "NEW VERSION IS AVAILABLE!");
JOptionPane.showMessageDialog(tthis, "MegaBasterd NEW VERSION ("+new_version+") is available!\n\n(HELP > ABOUT for more info)");
} else {

View File

@ -62,7 +62,7 @@ import static megabasterd.Transference.MAX_TRANSFERENCE_SPEED_DEFAULT;
*/
public final class MainPanel {
public static final String VERSION="1.25";
public static final String VERSION="1.26";
public static final int CONNECTION_TIMEOUT = 30000;
public static final int THROTTLE_SLICE_SIZE=16*1024;
public static final int STREAMER_PORT = 1337;
@ -163,9 +163,11 @@ public final class MainPanel {
@Override
public void run() {
if(MiscTools.checkNewVersion("lYsRWaQB", "uVhntmyKcVECRaOxAbcL4A")) {
String new_version = MiscTools.checkNewVersion("lYsRWaQB", "uVhntmyKcVECRaOxAbcL4A");
if(new_version != null) {
JOptionPane.showMessageDialog(getView(), "MegaBasterd NEW VERSION is available!\n\n(HELP > ABOUT for more info)");
JOptionPane.showMessageDialog(getView(), "MegaBasterd NEW VERSION ("+new_version+") is available!\n\n(HELP > ABOUT for more info)");
}
}});
}

View File

@ -893,45 +893,28 @@ public final class MiscTools {
private MiscTools() {
}
public static boolean checkNewVersion(String folder_node, String folder_key) {
public static String checkNewVersion(String folder_node, String folder_key) {
boolean new_version = true;
boolean invalid_repo = true;
String new_version = null;
try {
MegaAPI ma = new MegaAPI();
HashMap<String, Object> folder_nodes = ma.getFolderNodes(folder_node, folder_key);
if(folder_nodes == null || folder_nodes.isEmpty()) {
new_version = false;
} else {
if(folder_nodes != null && !folder_nodes.isEmpty()) {
for(Object o:folder_nodes.values()) {
HashMap<String,Object> current_node = (HashMap<String,Object>)o;
new_version = MiscTools.findFirstRegex("([0-9\\.]+)\\.run", (String)current_node.get("name"), 1);
if(((String)current_node.get("name")).contains("_"+VERSION.replaceAll(" *beta *", "")+".run")) {
invalid_repo = false;
new_version = false;
if(new_version!=null && !new_version.equals(VERSION)) {
break;
} else if(((String)current_node.get("name")).contains(".run")) {
invalid_repo = false;
}
}
if(invalid_repo) {
new_version = false;
}
}
} catch (Exception ex) {

View File

@ -8,8 +8,8 @@ import java.util.concurrent.ConcurrentLinkedQueue;
*/
public interface Transference {
int MIN_WORKERS = 1;
int MAX_WORKERS = 10;
int MIN_WORKERS = 2;
int MAX_WORKERS = 20;
int MAX_SIM_TRANSFERENCES=20;
int WORKERS_DEFAULT = 2;
int SIM_TRANSFERENCES_DEFAULT=2;