mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-07 16:49:10 +00:00
Merge pull request #210 from Parabot/feature/alert-download
[FEATURE] Alert of new version
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
package org.parabot;
|
package org.parabot;
|
||||||
|
|
||||||
import org.parabot.api.translations.TranslationHelper;
|
import org.parabot.api.translations.TranslationHelper;
|
||||||
import org.parabot.core.Configuration;
|
|
||||||
import org.parabot.core.Core;
|
import org.parabot.core.Core;
|
||||||
import org.parabot.core.Directories;
|
import org.parabot.core.Directories;
|
||||||
import org.parabot.core.forum.AccountManager;
|
import org.parabot.core.forum.AccountManager;
|
||||||
@@ -10,13 +9,10 @@ import org.parabot.core.network.proxy.ProxySocket;
|
|||||||
import org.parabot.core.network.proxy.ProxyType;
|
import org.parabot.core.network.proxy.ProxyType;
|
||||||
import org.parabot.core.ui.BotUI;
|
import org.parabot.core.ui.BotUI;
|
||||||
import org.parabot.core.ui.ServerSelector;
|
import org.parabot.core.ui.ServerSelector;
|
||||||
import org.parabot.core.ui.utils.UILog;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parabot v2.6
|
* Parabot v2.6
|
||||||
@@ -46,9 +42,11 @@ public final class Landing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!Core.inDebugMode() && Core.hasValidation() && !Core.isValid()) {
|
if (!Core.inDebugMode() && Core.hasValidation() && !Core.isValid()) {
|
||||||
|
if (Core.newVersionAlert() == JOptionPane.YES_OPTION) {
|
||||||
Core.downloadNewVersion();
|
Core.downloadNewVersion();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Core.verbose(TranslationHelper.translate("VALIDATION_ACCOUNT_MANAGER"));
|
Core.verbose(TranslationHelper.translate("VALIDATION_ACCOUNT_MANAGER"));
|
||||||
AccountManager.validate();
|
AccountManager.validate();
|
||||||
|
|||||||
@@ -14,13 +14,11 @@ import java.io.BufferedReader;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The core of parabot
|
* The core of parabot
|
||||||
@@ -251,4 +249,11 @@ public class Core {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alerts the user that there is a new version
|
||||||
|
*/
|
||||||
|
public static int newVersionAlert() {
|
||||||
|
return UILog.alert("Parabot Update", "There's a new version of Parabot! \nDo you wish to download it?\n\nThe current version could have some problems!", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
package org.parabot.core.ui.utils;
|
package org.parabot.core.ui.utils;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Log messages to the log user interface which is attached to the bot user interface
|
* Log messages to the log user interface which is attached to the bot user interface
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class UILog {
|
public class UILog {
|
||||||
|
|
||||||
@@ -21,4 +19,15 @@ public class UILog {
|
|||||||
messageType);
|
messageType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int alert(final String title, final String message) {
|
||||||
|
return alert(title, message, JOptionPane.YES_NO_OPTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int alert(final String title, final String message, int option) {
|
||||||
|
return alert(title, message, option, JOptionPane.DEFAULT_OPTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int alert(final String title, final String message, int optionType, int messageType) {
|
||||||
|
return JOptionPane.showConfirmDialog(null, message, title, optionType, messageType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user