// 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(); }
protected override void Unload() { MyAPIGateway.Entities.OnEntityAdd -= OnEntityAdd; foreach (ControllableGrid grid in _grids) { DeRegisterGrid(grid); } _grids.ApplyRemovals(); _grids.ClearList(); // Unload code above base base.Unload(); }
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(); }