summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Framework/Monitor.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2016-11-16 17:36:28 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2016-11-16 17:36:28 -0500
commit19bb255c988f161ce00586cb516de830732efe31 (patch)
tree3c631751827ddebf97c020f5c1d4b976aa83582e /src/StardewModdingAPI/Framework/Monitor.cs
parent92cf3ab65e550e6f4170efbc52d37dc6d355c89f (diff)
downloadSMAPI-19bb255c988f161ce00586cb516de830732efe31.tar.gz
SMAPI-19bb255c988f161ce00586cb516de830732efe31.tar.bz2
SMAPI-19bb255c988f161ce00586cb516de830732efe31.zip
add emergency interrupt feature (#168)
Diffstat (limited to 'src/StardewModdingAPI/Framework/Monitor.cs')
-rw-r--r--src/StardewModdingAPI/Framework/Monitor.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/StardewModdingAPI/Framework/Monitor.cs b/src/StardewModdingAPI/Framework/Monitor.cs
index 4fe1df04..cf46a474 100644
--- a/src/StardewModdingAPI/Framework/Monitor.cs
+++ b/src/StardewModdingAPI/Framework/Monitor.cs
@@ -65,6 +65,22 @@ namespace StardewModdingAPI.Framework
this.LogImpl(this.Source, message, Monitor.Colors[level], level);
}
+ /// <summary>Immediately exit the game without saving. This should only be invoked when an irrecoverable fatal error happens that risks save corruption or game-breaking bugs.</summary>
+ /// <param name="reason">The reason for the shutdown.</param>
+ public void ExitGameImmediately(string reason)
+ {
+ Program.ExitGameImmediately(this.Source, reason);
+ Program.gamePtr.Exit();
+ }
+
+ /// <summary>Log a fatal error message.</summary>
+ /// <param name="message">The message to log.</param>
+ internal void LogFatal(string message)
+ {
+ Console.BackgroundColor = ConsoleColor.Red;
+ this.LogImpl(this.Source, message, ConsoleColor.White, LogLevel.Error);
+ }
+
/// <summary>Log a message for the player or developer, using the specified console color.</summary>
/// <param name="source">The name of the mod logging the message.</param>
/// <param name="message">The message to log.</param>