/// <inheritdoc /> protected override void UnloadData() { Log?.EnterMethod(nameof(UnloadData)); MyAPIGateway.Session.OnSessionReady -= OnSessionReady; MyAPIGateway.Gui.GuiControlRemoved -= OnGuiControlRemoved; if (WaterModAvailable) { WaterModAPI?.Unregister(); } if (_chatHandler != null) { _chatHandler.Close(); _chatHandler = null; } if (_suitComputer != null) { _suitComputer.Close(); _suitComputer = null; } if (Network != null) { _networkHandler.Close(); _networkHandler = null; Log?.Info("Cap network connections"); Network.Close(); Network = null; } if (Log != null) { Log.Info("Logging stopped"); Log.Flush(); Log.Close(); Log = null; } }
/// <summary> /// Unloads all data. /// </summary> protected override void UnloadData() { Log?.EnterMethod(nameof(UnloadData)); MyAPIGateway.Gui.GuiControlRemoved -= OnGuiControlRemoved; if (DamageHandler != null) { Log?.Info("Stopping damage handler"); DamageHandler = null; } if (Network != null) { _networkHandler.Close(); _networkHandler = null; Log?.Info("Cap network connections"); Network.Close(); Network = null; } if (Log != null) { Log.Info("Logging stopped"); Log.Flush(); Log.Close(); Log = null; } if (Controls != null) { Controls = null; } if (Defs != null) { Defs = null; } Static = null; }