예제 #1
0
        // 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();
        }
예제 #2
0
 private void DeRegisterGrid(ControllableGrid grid)
 {
     if (grid == null)
     {
         return;
     }
     grid.OnWriteToLog -= WriteToLog;
     grid.OnClose      -= OnGridClose;
     grid.Close(null);
     _grids.Remove(grid);
 }
예제 #3
0
 private void Close(MyEntity gyro)
 {
     gyro.OnClose -= Close;
     _gyros.Remove((MyGyro)gyro);
     _gyros.ApplyRemovals();
 }
예제 #4
0
 public void RemoveLine(DrawLine line)
 {
     _drawLines.Remove(line);
     _drawLines.ApplyRemovals();
 }
예제 #5
0
 private void Close(IMyEntity gear)
 {
     ((IMyLandingGear)gear).OnClose -= Close;
     _landingGears.Remove((IMyLandingGear)gear);
     _landingGears.ApplyRemovals();
 }