mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-05-20 16:27:12 +02:00
6.2
-Autorestart fix
This commit is contained in:
parent
1da66820c5
commit
cf68cf8f30
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.tonikelope</groupId>
|
||||
<artifactId>MegaBasterd</artifactId>
|
||||
<version>6.1</version>
|
||||
<version>6.2</version>
|
||||
<packaging>jar</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -48,7 +48,7 @@ import javax.swing.UIManager;
|
||||
*/
|
||||
public final class MainPanel {
|
||||
|
||||
public static final String VERSION = "6.1";
|
||||
public static final String VERSION = "6.2";
|
||||
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
||||
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
|
||||
public static final int STREAMER_PORT = 1337;
|
||||
@ -61,6 +61,7 @@ public final class MainPanel {
|
||||
public static final String DEFAULT_USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0";
|
||||
public static final String ICON_FILE = "/images/mbasterd_32.png";
|
||||
public static final ExecutorService THREAD_POOL = newCachedThreadPool();
|
||||
private static Boolean _app_image;
|
||||
private static String _proxy_host;
|
||||
private static int _proxy_port;
|
||||
private static boolean _use_proxy;
|
||||
@ -79,16 +80,23 @@ public final class MainPanel {
|
||||
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
|
||||
defaults.put("nimbusOrange", defaults.get("nimbusFocus"));
|
||||
|
||||
_app_image = false;
|
||||
|
||||
if (args.length > 0) {
|
||||
|
||||
_app_image = args[0].equals("appimage");
|
||||
|
||||
if (args.length > 1) {
|
||||
try {
|
||||
Logger.getLogger(MainPanel.class.getName()).log(Level.INFO, "{0} Waiting {1} seconds before start...", new Object[]{Thread.currentThread().getName(), args[0]});
|
||||
Thread.sleep(Long.parseLong(args[0]) * 1000);
|
||||
Logger.getLogger(MainPanel.class.getName()).log(Level.INFO, "{0} Waiting {1} seconds before start...", new Object[]{Thread.currentThread().getName(), args[1]});
|
||||
Thread.sleep(Long.parseLong(args[1]) * 1000);
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(MainPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
final MainPanel main_panel = new MainPanel();
|
||||
|
||||
invokeLater(new Runnable() {
|
||||
@ -99,6 +107,10 @@ public final class MainPanel {
|
||||
});
|
||||
}
|
||||
|
||||
public static Boolean getApp_image() {
|
||||
return _app_image;
|
||||
}
|
||||
|
||||
public static String getFont() {
|
||||
return _font;
|
||||
}
|
||||
@ -759,7 +771,7 @@ public final class MainPanel {
|
||||
|
||||
if (restart) {
|
||||
JOptionPane.showMessageDialog(getView(), LabelTranslatorSingleton.getInstance().translate("MegaBasterd will restart"), LabelTranslatorSingleton.getInstance().translate("Restart required"), JOptionPane.WARNING_MESSAGE);
|
||||
restartApplication(1);
|
||||
restartApplication();
|
||||
} else {
|
||||
exit(0);
|
||||
}
|
||||
@ -787,7 +799,7 @@ public final class MainPanel {
|
||||
|
||||
if (restart) {
|
||||
JOptionPane.showMessageDialog(getView(), LabelTranslatorSingleton.getInstance().translate("MegaBasterd will restart"), LabelTranslatorSingleton.getInstance().translate("Restart required"), JOptionPane.WARNING_MESSAGE);
|
||||
restartApplication(1);
|
||||
restartApplication();
|
||||
} else {
|
||||
exit(0);
|
||||
}
|
||||
|
@ -1076,7 +1076,10 @@ public final class MiscTools {
|
||||
}
|
||||
}
|
||||
|
||||
public static void restartApplication(int delay) {
|
||||
public static void restartApplication() {
|
||||
|
||||
if (!MainPanel.getApp_image()) {
|
||||
|
||||
StringBuilder cmd = new StringBuilder();
|
||||
|
||||
cmd.append(System.getProperty("java.home")).append(File.separator).append("bin").append(File.separator).append("java ");
|
||||
@ -1087,17 +1090,16 @@ public final class MiscTools {
|
||||
|
||||
cmd.append("-cp ").append(ManagementFactory.getRuntimeMXBean().getClassPath()).append(" ");
|
||||
|
||||
cmd.append(MainPanel.class.getName()).append(" ");
|
||||
|
||||
cmd.append(String.valueOf(delay));
|
||||
cmd.append(MainPanel.class.getName()).append(" native 1");
|
||||
|
||||
try {
|
||||
Runtime.getRuntime().exec(cmd.toString());
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
System.exit(0);
|
||||
System.exit(2);
|
||||
}
|
||||
|
||||
public static MegaAPI checkMegaAccountLoginAndShowMasterPassDialog(MainPanel main_panel, Container container, String email) throws Exception {
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 176 KiB After Width: | Height: | Size: 181 KiB |
Loading…
x
Reference in New Issue
Block a user