// Read messages coming from clients. public override void UpdateBeforeSimulation() { ProfilerShort.Begin("External Debugging"); foreach (var clientInfo in m_clients) { if (clientInfo == null || clientInfo.TcpClient == null || clientInfo.TcpClient.Client == null || !clientInfo.TcpClient.Connected) { if (clientInfo != null && clientInfo.TcpClient != null && clientInfo.TcpClient.Client != null && clientInfo.TcpClient.Client.Connected) { clientInfo.TcpClient.Client.Disconnect(true); clientInfo.TcpClient.Close(); } m_clients.Remove(clientInfo); continue; } if (clientInfo.TcpClient.Connected && clientInfo.TcpClient.Available > 0) { ReadMessagesFromClients(clientInfo); } } m_clients.ApplyRemovals(); ProfilerShort.End(); }
private void DeRegisterGrid(ControllableGrid grid) { if (grid == null) { return; } grid.OnWriteToLog -= WriteToLog; grid.OnClose -= OnGridClose; grid.Close(null); _grids.Remove(grid); }
private void Close(MyEntity gyro) { gyro.OnClose -= Close; _gyros.Remove((MyGyro)gyro); _gyros.ApplyRemovals(); }
public void RemoveLine(DrawLine line) { _drawLines.Remove(line); _drawLines.ApplyRemovals(); }
private void Close(IMyEntity gear) { ((IMyLandingGear)gear).OnClose -= Close; _landingGears.Remove((IMyLandingGear)gear); _landingGears.ApplyRemovals(); }