public void completeConnection(DXChild c) { if (c != null) { switch (c.waitForConnection()) { case -1: ErrorDialog ed = new ErrorDialog(); ed.post("Connection to server {0} failed: {1}", c.getServer(), c.failed()); closeConnection(c); break; case 0: if (resource.executeProgram) getExecCtl().executeOnce(); break; case 1: InfoDialog id = new InfoDialog(); id.post("Connection to server {0} has been queued", c.getServer()); break; } } else if (!serverInfo.autoStart) { connectToServer(serverInfo.port, null); } // Let the application packet know that a new connection to // the server has been created. if (applicationPacket != null) applicationPacket.handleServerConnection(); if (resource.executeOnChange) getExecCtl().enableExecOnChange(); }
public DXChild startServer() { List<String> args = new List<String>(); int i = 0; args.Add("dx"); if (serverInfo.autoStart) { args.Add("-exonly"); args.Add("-local"); if (serverInfo.memorySize > 0) { args.Add("-memory"); args.Add(serverInfo.memorySize.ToString()); } if (serverInfo.executive != null) { serverInfo.executive.Trim(); if (serverInfo.executive.Length > 0) { args.Add("-exec"); args.Add(serverInfo.executive); } } if (serverInfo.workingDirectory != null) { serverInfo.workingDirectory.Trim(); if (serverInfo.workingDirectory.Length > 0) { args.Add("-directory"); if (serverInfo.workingDirectory.Contains(" ") && !serverInfo.workingDirectory.Contains("\"")) args.Add("\"" + serverInfo.workingDirectory + "\""); else args.Add(serverInfo.workingDirectory); } } if (serverInfo.userModules != null && serverInfo.userModules.Length > 0) { args.Add("-mdf"); args.Add(serverInfo.userModules); } if (serverInfo.executiveFlags != null) { serverInfo.executiveFlags.Trim(); if (serverInfo.executiveFlags.Length > 0) args.Add(serverInfo.executiveFlags); } String[] argArr = new String[args.Count]; for (int j = 0; j < args.Count; j++) argArr[j] = args[j]; DXChild c = new DXChild(serverInfo.server, argArr, false); if (c.failed() != null) { argArr[0] = this.getUIRoot() + "/bin/dx"; c = new DXChild(serverInfo.server, argArr, false); } serverInfo.children.Insert(0, c); return c; } else return null; }