private void connectToEventEndpoint() { try { if (_eventendpoint != null && _eventendpoint.IsConnected) { return; } var instance = new InstanceLocator("event").GetInstance(_path); if (instance == null) { return; } _eventendpoint = new SocketClient(); _eventendpoint.IncomingMessage += Handle_eventIncomingMessage; _eventendpoint.Connect(instance.Port); if (_eventendpoint.IsConnected) { startBackgroundShutdownHandler(); return; } _bus.Publish(new ExternalCommandMessage("EditorEngine", "shutdown")); } catch (Exception ex) { Debug.WriteError(ex.ToString()); } }
private bool isConnected() { try { if (_client != null && _client.IsConnected) { return(true); } var instance = new InstanceLocator("editor").GetInstance(_path); if (instance == null) { return(false); } _client = new SocketClient(); _client.IncomingMessage += Handle_clientIncomingMessage; _client.Connect(instance.Port); if (_client.IsConnected) { startBackgroundShutdownHandler(); return(true); } _client = null; return(false); } catch (Exception ex) { Debug.WriteError(ex.ToString()); return(false); } }
public int CreateAndWaitForExit(string executable, string arguments) { var process = new Process { StartInfo = new ProcessStartInfo(executable, arguments) { RedirectStandardOutput = true, WorkingDirectory = Path.GetDirectoryName(executable), WindowStyle = ProcessWindowStyle.Hidden, UseShellExecute = false, CreateNoWindow = true } }; Debug.WriteDebug(string.Format("Launching: {0} {1}", executable, arguments)); process.Start(); return(WaitForExit(process)); }
private void send(string message) { Debug.WriteDebug("Sending to editor engine: " + message); _client.Send(message); }
void Handle_clientIncomingMessage(object sender, IncomingMessageArgs e) { Debug.WriteDebug("Dispatching editor message: " + e.Message); _bus.Publish(new ExternalCommandMessage("EditorEngine", e.Message)); }