public static void LogException(Exception exception) { using (var file = new StreamWriter(GetFileName())) { try { file.WriteLine("Context:"); file.WriteLine( $"Timespinner Version: {TimeSpinnerGame.Constants.GameVersion}, TsRandomizer Version: {Assembly.GetExecutingAssembly().GetName().Version}"); file.WriteLine($"Level: {LevelId}, Room: {RoomId}, Seed: {Seed}"); file.WriteLine(); WriteException(exception, file); file.WriteLine("Settings:"); if (Settings != null) { file.WriteLine($"{GameSettingsLoader.ToJson(Settings, true)}"); } else { file.WriteLine($"{Settings}"); } } catch (Exception e) { try { file.WriteLine("Writing ExceptionLog Failure:"); WriteException(e, file); } catch { } } } }
internal static void SetSettings(this GameSave gameSave, SettingCollection settings) { ExceptionLogger.SetSettingsContext(settings); gameSave.SetValue(SaveFileSettingKey, GameSettingsLoader.ToJson(settings, false)); }