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 @Override
public void run() { public void run() {
if(MiscTools.checkNewVersion("lYsRWaQB", "uVhntmyKcVECRaOxAbcL4A")) { String new_version = MiscTools.checkNewVersion("lYsRWaQB", "uVhntmyKcVECRaOxAbcL4A");
JOptionPane.showMessageDialog(tthis, "NEW VERSION IS AVAILABLE!"); if(new_version != null) {
JOptionPane.showMessageDialog(tthis, "MegaBasterd NEW VERSION ("+new_version+") is available!\n\n(HELP > ABOUT for more info)");
} else { } else {

View File

@ -62,7 +62,7 @@ import static megabasterd.Transference.MAX_TRANSFERENCE_SPEED_DEFAULT;
*/ */
public final class MainPanel { 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 CONNECTION_TIMEOUT = 30000;
public static final int THROTTLE_SLICE_SIZE=16*1024; public static final int THROTTLE_SLICE_SIZE=16*1024;
public static final int STREAMER_PORT = 1337; public static final int STREAMER_PORT = 1337;
@ -163,9 +163,11 @@ public final class MainPanel {
@Override @Override
public void run() { public void run() {
if(MiscTools.checkNewVersion("lYsRWaQB", "uVhntmyKcVECRaOxAbcL4A")) { String new_version = MiscTools.checkNewVersion("lYsRWaQB", "uVhntmyKcVECRaOxAbcL4A");
JOptionPane.showMessageDialog(getView(), "MegaBasterd NEW VERSION is available!\n\n(HELP > ABOUT for more info)"); if(new_version != null) {
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() { 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; String new_version = null;
boolean invalid_repo = true;
try { try {
MegaAPI ma = new MegaAPI(); MegaAPI ma = new MegaAPI();
HashMap<String, Object> folder_nodes = ma.getFolderNodes(folder_node, folder_key); HashMap<String, Object> folder_nodes = ma.getFolderNodes(folder_node, folder_key);
if(folder_nodes == null || folder_nodes.isEmpty()) { if(folder_nodes != null && !folder_nodes.isEmpty()) {
new_version = false;
} else {
for(Object o:folder_nodes.values()) { for(Object o:folder_nodes.values()) {
HashMap<String,Object> current_node = (HashMap<String,Object>)o; HashMap<String,Object> current_node = (HashMap<String,Object>)o;
if(((String)current_node.get("name")).contains("_"+VERSION.replaceAll(" *beta *", "")+".run")) { new_version = MiscTools.findFirstRegex("([0-9\\.]+)\\.run", (String)current_node.get("name"), 1);
invalid_repo = false; if(new_version!=null && !new_version.equals(VERSION)) {
new_version = false;
break; break;
} else if(((String)current_node.get("name")).contains(".run")) {
invalid_repo = false;
} }
} }
if(invalid_repo) {
new_version = false;
}
} }
} catch (Exception ex) { } catch (Exception ex) {

View File

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