mirror of
https://github.com/Maschell/StreamingPluginClient.git
synced 2024-06-01 06:48:49 +02:00
Change something again
This commit is contained in:
parent
0a7af5411a
commit
ee918128f6
|
@ -41,22 +41,31 @@ import de.mas.wiiu.streaming.gui.StreamWindow;
|
|||
public class Main {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
CommandLineParser parser = new DefaultParser();
|
||||
if(GraphicsEnvironment.isHeadless()) {
|
||||
System.out.println("This program does not support running in a headless environment!");
|
||||
System.exit(2);
|
||||
}else {
|
||||
String ip = null;
|
||||
if(args.length != 0) {
|
||||
CommandLineParser parser = new DefaultParser();
|
||||
|
||||
Options options = new Options();
|
||||
options.addOption("ip", "ip", true, "IP address of your Wii U Console.");
|
||||
Options options = new Options();
|
||||
options.addOption("ip", "ip", true, "IP address of your Wii U Console.");
|
||||
|
||||
CommandLine line = parser.parse(options, args, true);
|
||||
|
||||
|
||||
CommandLine line = parser.parse(options, args);
|
||||
String ip = null;
|
||||
if (line.hasOption("ip")) {
|
||||
ip = line.getOptionValue("ip");
|
||||
}else {
|
||||
HelpFormatter formatter = new HelpFormatter();
|
||||
formatter.printHelp("streamingTool", options);
|
||||
System.exit(2);
|
||||
}
|
||||
} else{
|
||||
|
||||
|
||||
|
||||
if (line.hasOption("ip")) {
|
||||
ip = line.getOptionValue("ip");
|
||||
} else {
|
||||
//Check if this is being run in cmd to prevent headless exceptions
|
||||
if(GraphicsEnvironment.isHeadless()) {
|
||||
HelpFormatter formatter = new HelpFormatter();
|
||||
formatter.printHelp("streamingTool", options);
|
||||
}else {
|
||||
|
||||
//Create a JFrame to show the icon in the taskbar
|
||||
final JFrame frame = new JFrame("Wii U Streaming Client - Enter IP...");
|
||||
|
@ -75,25 +84,26 @@ public class Main {
|
|||
}
|
||||
//Close the JFrame again
|
||||
frame.dispose();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
new Main(ip);
|
||||
} catch (BindException e) {
|
||||
//Create a JFrame to show the icon in the taskbar
|
||||
final JFrame frame = new JFrame("Wii U Streaming Client - "+e.getClass().getName());
|
||||
frame.setUndecorated( true );
|
||||
frame.setVisible( true );
|
||||
frame.setLocationRelativeTo( null );
|
||||
try {
|
||||
new Main(ip);
|
||||
} catch (BindException e) {
|
||||
//Create a JFrame to show the icon in the taskbar
|
||||
final JFrame frame = new JFrame("Wii U Streaming Client - "+e.getClass().getName());
|
||||
frame.setUndecorated( true );
|
||||
frame.setVisible( true );
|
||||
frame.setLocationRelativeTo( null );
|
||||
|
||||
//Display the Message
|
||||
JOptionPane.showMessageDialog(frame, "Can't bind socket. The client is probably already running.", e.getClass().getName(),
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
//Close the JFrame again
|
||||
frame.dispose();
|
||||
//Display the Message
|
||||
JOptionPane.showMessageDialog(frame, "Can't bind socket. The client is probably already running.", e.getClass().getName(),
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
//Close the JFrame again
|
||||
frame.dispose();
|
||||
|
||||
System.exit(-1);
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user