Fixed null filenames passed to existing instance when none were provided as parameters

git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@185 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d
This commit is contained in:
Jared Gould 2006-07-26 23:39:05 +00:00
parent ac6e2d94f1
commit 488a6085ec
1 changed files with 26 additions and 20 deletions

View File

@ -432,35 +432,39 @@ public class ECUEditor extends JFrame implements WindowListener, PropertyChangeL
// instance already open, pass filename
System.out.println("instance found");
// pass filename code here
try {
Socket socket = new java.net.Socket(serverName,serverPort); // create socket and connect
pw = new java.io.PrintWriter(socket.getOutputStream(), true); // create reader and writer
br = new java.io.BufferedReader(new java.io.InputStreamReader(socket.getInputStream()));
System.out.println("Connected to Server");
// pass filename if file present
if (args.length > 0) {
try {
Socket socket = new java.net.Socket(serverName,serverPort); // create socket and connect
pw = new java.io.PrintWriter(socket.getOutputStream(), true); // create reader and writer
br = new java.io.BufferedReader(new java.io.InputStreamReader(socket.getInputStream()));
System.out.println("Connected to Server");
pw.println(args[0]); // send msg to the server
System.out.println("Sent message to server");
String answer = br.readLine(); // get data from the server
System.out.println("Response from the server >" + answer);
pw.println(args[0]); // send msg to the server
System.out.println("Sent message to server");
String answer = br.readLine(); // get data from the server
System.out.println("Response from the server >" + answer);
pw.close(); // close everything
br.close();
sock.close();
pw.close(); // close everything
br.close();
socket.close();
} catch (Throwable e) {
System.out.println("Error " + e.getMessage());
e.printStackTrace();
}
// after sending filename, exit
System.exit(0);
} catch (Throwable e) {
System.out.println("Error " + e.getMessage());
e.printStackTrace();
}
// after sending filename, exit
System.exit(0);
}
}
// launch editor
ECUEditor editor = new ECUEditor();
// listen for files
// open files, if passed
try {
if (args.length > 0) {
editor.openImage(new File(args[0]));
@ -469,6 +473,8 @@ public class ECUEditor extends JFrame implements WindowListener, PropertyChangeL
ex.printStackTrace();
}
// listen for files
try {
while (true) {