This commit is contained in:
huanghongxun
2015-12-17 18:06:19 +08:00
parent 81443b8252
commit 2b17095c88
15 changed files with 521 additions and 14 deletions

View File

@@ -183,7 +183,11 @@ public class FileDownloadTask extends Task implements PreviousResult<File>, Prev
}
public static void download(String url, String file, DownloadListener dl) throws Throwable {
((Task) new FileDownloadTask(url, new File(file)).setProgressProviderListener(dl)).executeTask();
download(url, new File(file), dl);
}
public static void download(String url, File file, DownloadListener dl) throws Throwable {
((Task) new FileDownloadTask(url, file).setProgressProviderListener(dl)).executeTask();
}
@Override

View File

@@ -1,7 +1,7 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -27,7 +27,7 @@ import java.io.UnsupportedEncodingException;
import java.lang.management.ManagementFactory;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URI;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.net.URLDecoder;
@@ -41,6 +41,16 @@ import org.jackhuang.hellominecraft.HMCLog;
*/
public final class Utils {
@SuppressWarnings("ResultOfObjectAllocationIgnored")
public static boolean isURL(String s) {
try {
new URL(s);
return true;
} catch (MalformedURLException ex) {
return false;
}
}
public static String[] getURL() {
URL[] urls = ((URLClassLoader) Utils.class.getClassLoader()).getURLs();
String[] urlStrings = new String[urls.length];
@@ -133,7 +143,8 @@ public final class Utils {
}
}
if (background == null) return init;
if (background == null)
return init;
return background;
}

View File

@@ -30,7 +30,7 @@ public class Selector extends javax.swing.JDialog {
* The index of the chosen in select list.
*/
public int sel;
public static int failedToSel = -1;
public static final int FAILED_TO_SELECT = -1;
/**
* @param parent null
@@ -44,7 +44,7 @@ public class Selector extends javax.swing.JDialog {
setLocationRelativeTo(null);
this.selList = selList;
this.sel = failedToSel;
this.sel = FAILED_TO_SELECT;
this.msg = msg;
jLabel1.setText(msg);
for (String s : selList)
@@ -127,7 +127,7 @@ public class Selector extends javax.swing.JDialog {
}// </editor-fold>//GEN-END:initComponents
private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed
sel = failedToSel;
sel = FAILED_TO_SELECT;
this.dispose();
}//GEN-LAST:event_btnCancelActionPerformed

View File

@@ -313,6 +313,12 @@ logwindow.title=\u65e5\u5fd7
selector.choose=\u9009\u62e9
serverlistview.title=\u9009\u62e9\u670d\u52a1\u5668
serverlistview.name=\u540d\u79f0
serverlistview.type=\u7c7b\u578b
serverlistview.version=\u7248\u672c
serverlistview.info=\u4fe1\u606f
minecraft.invalid=\u65e0\u6548\u7684
minecraft.invalid_jar=\u65e0\u6548\u7684jar\u5305
minecraft.not_a_file=\u4e0d\u662f\u6587\u4ef6

View File

@@ -313,6 +313,12 @@ logwindow.title=Log
selector.choose=Choose
serverlistview.title=Choose a server
serverlistview.name=Name
serverlistview.type=Type
serverlistview.version=Version
serverlistview.info=Information
minecraft.invalid=Invalid
minecraft.invalid_jar=Invalid Jar
minecraft.not_a_file=Not a file

View File

@@ -313,6 +313,12 @@ logwindow.title=\u65e5\u5fd7
selector.choose=\u9078\u64c7
serverlistview.title=\u9078\u64c7\u670d\u52d9\u5668
serverlistview.name=\u540d\u79f0
serverlistview.type=\u7c7b\u578b
serverlistview.version=\u7248\u672c
serverlistview.info=\u4fe1\u606f
minecraft.invalid=\u7121\u6548\u7684
minecraft.invalid_jar=\u7121\u6548\u7684jar\u5305
minecraft.not_a_file=\u4e0d\u662f\u6587\u4ef6

View File

@@ -310,6 +310,12 @@ logwindow.title=\u65e5\u5fd7
selector.choose=\u9009\u62e9
serverlistview.title=\u9009\u62e9\u670d\u52a1\u5668
serverlistview.name=\u540d\u79f0
serverlistview.type=\u7c7b\u578b
serverlistview.version=\u7248\u672c
serverlistview.info=\u4fe1\u606f
minecraft.invalid=\u65e0\u6548\u7684
minecraft.invalid_jar=\u65e0\u6548\u7684jar\u5305
minecraft.not_a_file=\u4e0d\u662f\u6587\u4ef6