Пример #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
 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();
 }
Пример #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();
 }