summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2016-11-04 23:31:06 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2016-11-04 23:31:06 -0400
commit067d5f6b693c9e30ff5f4f2b1cd363b036a7b3cc (patch)
treed8944318130aa74d7c6ddade88dd26f3fb30758f /src
parent4716b4cd2170308fd8c76f24dd85c879168038a3 (diff)
downloadSMAPI-067d5f6b693c9e30ff5f4f2b1cd363b036a7b3cc.tar.gz
SMAPI-067d5f6b693c9e30ff5f4f2b1cd363b036a7b3cc.tar.bz2
SMAPI-067d5f6b693c9e30ff5f4f2b1cd363b036a7b3cc.zip
add minimum game version check (#163)
Diffstat (limited to 'src')
-rw-r--r--src/StardewModdingAPI/Constants.cs3
-rw-r--r--src/StardewModdingAPI/Program.cs15
2 files changed, 14 insertions, 4 deletions
diff --git a/src/StardewModdingAPI/Constants.cs b/src/StardewModdingAPI/Constants.cs
index e5752dfd..48304de5 100644
--- a/src/StardewModdingAPI/Constants.cs
+++ b/src/StardewModdingAPI/Constants.cs
@@ -25,6 +25,9 @@ namespace StardewModdingAPI
/// <summary>SMAPI's current semantic version.</summary>
public static readonly Version Version = new Version(1, 0, 0, $"alpha-{DateTime.UtcNow.ToString("yyyyMMddHHmm")}");
+ /// <summary>The minimum supported version of Stardew Valley.</summary>
+ public const string MinimumGameVersion = "1.1";
+
/// <summary>The GitHub repository to check for updates.</summary>
public const string GitHubRepository = "cjsu/SMAPI";
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs
index 01cb3ac5..8c38a88b 100644
--- a/src/StardewModdingAPI/Program.cs
+++ b/src/StardewModdingAPI/Program.cs
@@ -69,12 +69,19 @@ namespace StardewModdingAPI
try
{
Log.SyncColour($"Launching SMAPI {Constants.Version} with Stardew Valley {Game1.version} on {Environment.OSVersion}", ConsoleColor.DarkGray); // make sure this is the first line, to simplify troubleshooting instructions
- Log.Debug("Initialising...");
- // set window title
- Console.Title = Constants.ConsoleTitle;
+ // verify version
+ if (String.Compare(Game1.version, Constants.MinimumGameVersion, StringComparison.InvariantCultureIgnoreCase) < 0)
+ {
+ Log.Error($"Oops! You're running Stardew Valley {Game1.version}, but the oldest supported version is {Constants.MinimumGameVersion}. Please update your game before using SMAPI. If you're on the Steam beta channel, note that the beta channel may not receive the latest updates.");
+ Log.Debug("Shutting down. Press any key to continue...");
+ Console.ReadKey();
+ return;
+ }
- // verify paths
+ // initialise
+ Log.Debug("Initialising...");
+ Console.Title = Constants.ConsoleTitle;
Program.VerifyPath(Program.ModPath);
Program.VerifyPath(Constants.LogDir);
if (!File.Exists(Program.GameExecutablePath))