// This should now only get called when the game is exiting private void OnDestroy() { Log.Info("Shutting down"); #if falsae if (HighLogic.LoadedScene == GameScenes.TRACKSTATION) { OnExitMapView(); } else #endif { MapView.OnEnterMapView -= OnEnterMapView; MapView.OnExitMapView -= OnExitMapView; } Log.Debug("Disposing window"); m_window.Dispose(); Log.Debug("Disposing OrbitVisibilityController"); m_visibilityController.OnVisibilityChanged -= OnOrbitVisibilityChanged; m_visibilityController.Dispose(); Log.Debug("Writing configuration file"); string configurationDirectory = Path.GetDirectoryName(ConfigurationFile); if (configurationDirectory != null && !Directory.Exists(configurationDirectory)) { Directory.CreateDirectory(configurationDirectory); } ConfigurationParser.SaveToFile(ConfigurationFile, m_configuration); }
private void OnDestroy() { Logger.Info("Shutting down"); MapView.OnEnterMapView -= OnEnterMapView; MapView.OnExitMapView -= OnExitMapView; Logger.Debug("Disposing ToolbarButton"); m_toolbarButton.Dispose(); Logger.Debug("Disposing window"); m_window.Dispose(); Logger.Debug("Disposing OrbitVisibilityController"); m_visibilityController.OnVisibilityChanged -= OnOrbitVisibilityChanged; m_visibilityController.Dispose(); Logger.Debug("Writing configuration file"); string configurationDirectory = Path.GetDirectoryName(ConfigurationFile); if (configurationDirectory != null && !Directory.Exists(configurationDirectory)) { Directory.CreateDirectory(configurationDirectory); } ConfigurationParser.SaveToFile(ConfigurationFile, m_configuration); }