use of jgnash.bootloader.BootLoaderDialog in project jgnash by ccavanaugh.
the class jGnash method main.
public static void main(final String[] args) {
boolean bypassBootLoader = false;
final CommandLine commandLine = new CommandLine(new jGnashFx.CommandLineOptions());
commandLine.setToggleBooleanFlags(false);
commandLine.setUsageHelpWidth(80);
try {
final CommandLine.ParseResult pr = commandLine.parseArgs(args);
final jGnashFx.CommandLineOptions options = commandLine.getCommand();
if (CommandLine.printHelpIfRequested(pr)) {
System.exit(0);
}
bypassBootLoader = options.bypassBootloader;
} catch (final CommandLine.UnmatchedArgumentException uae) {
commandLine.usage(System.err, CommandLine.Help.Ansi.AUTO);
System.exit(1);
} catch (final Exception e) {
logSevere(jGnash.class, e);
System.exit(1);
}
if (BootLoader.getOS() != null) {
if (bypassBootLoader || BootLoader.doFilesExist()) {
launch(args);
} else {
EventQueue.invokeLater(() -> {
final BootLoaderDialog d = new BootLoaderDialog();
d.setVisible(true);
final Thread thread = new Thread(() -> {
if (!BootLoader.downloadFiles(d.getActiveFileConsumer(), d.getPercentCompleteConsumer())) {
System.exit(-1);
}
});
thread.start();
});
}
} else {
JOptionPane.showMessageDialog(null, "Unsupported operating system", "Error", JOptionPane.ERROR_MESSAGE);
System.exit(BootLoader.FAILED_EXIT);
}
}
Aggregations