// called right before main loop returns, do all saving/cleanup in here private void Cleanup() { // shut down networking, kicking all players. _network.Shutdown("Server Shutdown"); // shutdown entities _entities.Shutdown(); // Wrtie down exception log var logPath = _config.GetCVar <string>("log.path"); var pathToWrite = Path.Combine(PathHelpers.ExecutableRelativeFile(logPath), "Runtime-" + DateTime.Now.ToString("yyyy-MM-dd-THH-mm-ss") + ".txt"); File.WriteAllText(pathToWrite, runtimeLog.Display(), EncodingHelpers.UTF8); //TODO: This should prob shutdown all managers in a loop. }
// called right before main loop returns, do all saving/cleanup in here private void Cleanup() { // shut down networking, kicking all players. _network.Shutdown($"Server shutting down: {_shutdownReason}"); // shutdown entities _entities.Shutdown(); // Wrtie down exception log var logPath = _config.GetCVar <string>("log.path"); var relPath = PathHelpers.ExecutableRelativeFile(logPath); Directory.CreateDirectory(relPath); var pathToWrite = Path.Combine(relPath, "Runtime-" + DateTime.Now.ToString("yyyy-MM-dd-THH-mm-ss") + ".txt"); File.WriteAllText(pathToWrite, runtimeLog.Display(), EncodingHelpers.UTF8); AppDomain.CurrentDomain.ProcessExit -= ProcessExiting; //TODO: This should prob shutdown all managers in a loop. }