忽略版本更新功能
This commit is contained in:
@@ -32,6 +32,8 @@ public interface IUpdateChecker {
|
||||
|
||||
boolean isForceUpdate();
|
||||
|
||||
boolean isManualUpdate();
|
||||
|
||||
/**
|
||||
* Get the <b>cached</b> newest version number, use "process" method to
|
||||
* download!
|
||||
|
||||
@@ -86,23 +86,23 @@ public class MessageBox {
|
||||
/**
|
||||
* Show MsgBox with title and options
|
||||
*
|
||||
* @param Msg The Message
|
||||
* @param Title The title of MsgBox.
|
||||
* @param Option The type of MsgBox.
|
||||
* @param msg The Message
|
||||
* @param title The title of MsgBox.
|
||||
* @param optionType The type of MsgBox.
|
||||
*
|
||||
* @return user operation.
|
||||
*/
|
||||
public static int Show(String Msg, String Title, int Option) {
|
||||
switch (Option) {
|
||||
public static int Show(Object msg, String title, int optionType) {
|
||||
switch (optionType) {
|
||||
case YES_NO_OPTION:
|
||||
case YES_NO_CANCEL_OPTION:
|
||||
case OK_CANCEL_OPTION:
|
||||
return SwingUtils.invokeAndWait(() -> JOptionPane.showConfirmDialog(null, Msg, Title, Option - 10));
|
||||
return SwingUtils.invokeAndWait(() -> JOptionPane.showConfirmDialog(null, msg, title, optionType - 10));
|
||||
default:
|
||||
SwingUtils.invokeAndWait(() -> JOptionPane.showMessageDialog(null, Msg, Title, Option));
|
||||
SwingUtils.invokeAndWait(() -> JOptionPane.showMessageDialog(null, msg, title, optionType));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show MsgBox with options
|
||||
@@ -112,8 +112,8 @@ public class MessageBox {
|
||||
*
|
||||
* @return User Operation
|
||||
*/
|
||||
public static int Show(String Msg, int Option) {
|
||||
return Show(Msg, TITLE, Option);
|
||||
public static int Show(Object msg, int optionType) {
|
||||
return Show(msg, TITLE, optionType);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,8 +123,8 @@ public class MessageBox {
|
||||
*
|
||||
* @return User Operation
|
||||
*/
|
||||
public static int Show(String Msg) {
|
||||
return Show(Msg, TITLE, INFORMATION_MESSAGE);
|
||||
public static int Show(Object msg) {
|
||||
return Show(msg, TITLE, INFORMATION_MESSAGE);
|
||||
}
|
||||
|
||||
public static int ShowLocalized(String msg) {
|
||||
|
||||
@@ -29,13 +29,13 @@ public final class UpdateChecker implements IUpdateChecker {
|
||||
public static final String VERSION_URL = "http://client.api.mcgogogo.com:81/version.php?type=";
|
||||
public static final String UPDATE_LINK_URL = "http://client.api.mcgogogo.com:81/update_link.php?type=";
|
||||
|
||||
|
||||
public boolean OUT_DATED = false;
|
||||
|
||||
public String versionString;
|
||||
public VersionNumber base;
|
||||
private VersionNumber value;
|
||||
private boolean isforceUpdate = false;
|
||||
private boolean isManualUpdate = false;
|
||||
|
||||
public String type;
|
||||
private Map<String, String> download_link = null;
|
||||
@@ -50,6 +50,8 @@ public final class UpdateChecker implements IUpdateChecker {
|
||||
return new OverridableSwingWorker() {
|
||||
@Override
|
||||
protected void work() throws Exception {
|
||||
isManualUpdate = showMessage;
|
||||
|
||||
if (value == null) {
|
||||
versionString = NetUtils.get(VERSION_URL + type);
|
||||
Map<String, Object> versionInfo = C.GSON.fromJson(versionString, Map.class);
|
||||
@@ -58,15 +60,19 @@ public final class UpdateChecker implements IUpdateChecker {
|
||||
if (versionInfo.containsKey("force"))
|
||||
isforceUpdate = (boolean)versionInfo.get("force");
|
||||
}
|
||||
|
||||
|
||||
if (value == null) {
|
||||
HMCLog.warn("Failed to check update...");
|
||||
if (showMessage)
|
||||
if (showMessage) {
|
||||
MessageBox.Show(C.i18n("update.failed"));
|
||||
} else if (VersionNumber.isOlder(base, value))
|
||||
}
|
||||
} else if (VersionNumber.isOlder(base, value)) {
|
||||
OUT_DATED = true;
|
||||
if (OUT_DATED)
|
||||
}
|
||||
|
||||
if (OUT_DATED) {
|
||||
publish(value);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -81,6 +87,11 @@ public final class UpdateChecker implements IUpdateChecker {
|
||||
return isforceUpdate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isManualUpdate() {
|
||||
return isManualUpdate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized OverridableSwingWorker<Map<String, String>> requestDownloadLink() {
|
||||
return new OverridableSwingWorker() {
|
||||
|
||||
@@ -168,6 +168,7 @@ ui.message.launching=启动中
|
||||
ui.message.making=生成中
|
||||
ui.message.sure_remove=真的要删除配置%s吗?
|
||||
ui.message.update_java=请更新您的Java
|
||||
ui.message.recommend_tip=点击打开链接
|
||||
|
||||
ui.label.settings=选项
|
||||
ui.label.crashing=<html>Hello Minecraft!遇到了无法处理的错误,请复制下列内容并通过mcbbs、贴吧、Github或Minecraft Forum反馈bug。</html>
|
||||
@@ -369,6 +370,7 @@ update.should_open_link=是否更新?
|
||||
update.newest_version=最新版本为:
|
||||
update.failed=检查更新失败
|
||||
update.found=(发现更新!)
|
||||
update.ignore=不再提醒此版本更新
|
||||
|
||||
logwindow.terminate_game=结束游戏进程
|
||||
logwindow.tieba=贴吧
|
||||
|
||||
@@ -168,6 +168,7 @@ ui.message.launching=\u542f\u52a8\u4e2d
|
||||
ui.message.making=\u751f\u6210\u4e2d
|
||||
ui.message.sure_remove=\u771f\u7684\u8981\u5220\u9664\u914d\u7f6e%s\u5417\uff1f
|
||||
ui.message.update_java=\u8bf7\u66f4\u65b0\u60a8\u7684Java
|
||||
ui.message.recommend_tip=\u70b9\u51fb\u6253\u5f00\u94fe\u63a5
|
||||
|
||||
ui.label.settings=\u9009\u9879
|
||||
ui.label.crashing=<html>Hello Minecraft!\u9047\u5230\u4e86\u65e0\u6cd5\u5904\u7406\u7684\u9519\u8bef\uff0c\u8bf7\u590d\u5236\u4e0b\u5217\u5185\u5bb9\u5e76\u901a\u8fc7mcbbs\u3001\u8d34\u5427\u3001Github\u6216Minecraft Forum\u53cd\u9988bug\u3002</html>
|
||||
@@ -369,6 +370,7 @@ update.should_open_link=\u662f\u5426\u66f4\u65b0\uff1f
|
||||
update.newest_version=\u6700\u65b0\u7248\u672c\u4e3a\uff1a
|
||||
update.failed=\u68c0\u67e5\u66f4\u65b0\u5931\u8d25
|
||||
update.found=(\u53d1\u73b0\u66f4\u65b0!)
|
||||
update.ignore=\u4e0d\u518d\u63d0\u9192\u6b64\u7248\u672c\u66f4\u65b0
|
||||
|
||||
logwindow.terminate_game=\u7ed3\u675f\u6e38\u620f\u8fdb\u7a0b
|
||||
logwindow.tieba=\u8d34\u5427
|
||||
|
||||
@@ -168,6 +168,7 @@ ui.message.launching=Launching...
|
||||
ui.message.making=Generating...
|
||||
ui.message.sure_remove=Sure to remove profile %s?
|
||||
ui.message.update_java=Please upgrade your Java.
|
||||
ui.message.recommend_tip=Click to open link
|
||||
|
||||
ui.label.settings=Settings
|
||||
ui.label.crashing=<html>Hello Minecraft! Launcher has crashed!</html>
|
||||
@@ -369,6 +370,7 @@ update.should_open_link=Are you willing to upgrade this app?
|
||||
update.newest_version=Newest version:
|
||||
update.failed=Failed to check for updates.
|
||||
update.found=(Found Update!)
|
||||
update.ignore=Do not remind this version update.
|
||||
|
||||
logwindow.terminate_game=Terminate Game
|
||||
logwindow.tieba=Baidu Tieba
|
||||
|
||||
@@ -168,6 +168,7 @@ ui.message.launching=Launching...
|
||||
ui.message.making=Generating...
|
||||
ui.message.sure_remove=Sure to remove profile %s?
|
||||
ui.message.update_java=Please upgrade your Java.
|
||||
ui.message.recommend_tip=Click to open link
|
||||
|
||||
ui.label.settings=Settings
|
||||
ui.label.crashing=<html>Hello Minecraft! Launcher has crashed!</html>
|
||||
@@ -369,6 +370,7 @@ update.should_open_link=Are you willing to upgrade this app?
|
||||
update.newest_version=Newest version:
|
||||
update.failed=Failed to check for updates.
|
||||
update.found=(Found Update!)
|
||||
update.ignore=Do not remind this version update.
|
||||
|
||||
logwindow.terminate_game=Terminate Game
|
||||
logwindow.tieba=Baidu Tieba
|
||||
|
||||
@@ -168,6 +168,7 @@ ui.message.launching=啟動中
|
||||
ui.message.making=生成中
|
||||
ui.message.sure_remove=真的要删除配置%s吗?
|
||||
ui.message.update_java=请更新您的Java
|
||||
ui.message.recommend_tip=點擊打開連接
|
||||
|
||||
ui.label.settings=選項
|
||||
ui.label.crashing=<html>Hello Minecraft! Launcher遇到了無法處理的錯誤,請複制下列內容並通過mcbbs、貼吧或Minecraft Forum反饋bug。 </html>
|
||||
@@ -369,6 +370,7 @@ update.should_open_link=是否更新?
|
||||
update.newest_version=最新版本為:
|
||||
update.failed=檢查更新失敗
|
||||
update.found=(發現更新!)
|
||||
update.ignore=不再提醒此版本更新
|
||||
|
||||
logwindow.terminate_game=結束遊戲進程
|
||||
logwindow.tieba=貼吧
|
||||
|
||||
@@ -168,6 +168,7 @@ ui.message.launching=\u555f\u52d5\u4e2d
|
||||
ui.message.making=\u751f\u6210\u4e2d
|
||||
ui.message.sure_remove=\u771f\u7684\u8981\u5220\u9664\u914d\u7f6e%s\u5417\uff1f
|
||||
ui.message.update_java=\u8bf7\u66f4\u65b0\u60a8\u7684Java
|
||||
ui.message.recommend_tip=\u9ede\u64ca\u6253\u958b\u9023\u63a5
|
||||
|
||||
ui.label.settings=\u9078\u9805
|
||||
ui.label.crashing=<html>Hello Minecraft! Launcher\u9047\u5230\u4e86\u7121\u6cd5\u8655\u7406\u7684\u932f\u8aa4\uff0c\u8acb\u8907\u5236\u4e0b\u5217\u5167\u5bb9\u4e26\u901a\u904emcbbs\u3001\u8cbc\u5427\u6216Minecraft Forum\u53cd\u994bbug\u3002 </html>
|
||||
@@ -369,6 +370,7 @@ update.should_open_link=\u662f\u5426\u66f4\u65b0\uff1f
|
||||
update.newest_version=\u6700\u65b0\u7248\u672c\u70ba\uff1a
|
||||
update.failed=\u6aa2\u67e5\u66f4\u65b0\u5931\u6557
|
||||
update.found=(\u767c\u73fe\u66f4\u65b0!)
|
||||
update.ignore=\u4e0d\u518d\u63d0\u9192\u6b64\u7248\u672c\u66f4\u65b0
|
||||
|
||||
logwindow.terminate_game=\u7d50\u675f\u904a\u6232\u9032\u7a0b
|
||||
logwindow.tieba=\u8cbc\u5427
|
||||
|
||||
Reference in New Issue
Block a user