summaryrefslogtreecommitdiff
path: root/src/SMAPI
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI')
-rw-r--r--src/SMAPI/Framework/SCore.cs9
-rw-r--r--src/SMAPI/SemanticVersion.cs17
2 files changed, 21 insertions, 5 deletions
diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs
index 6cb564ce..7567c6db 100644
--- a/src/SMAPI/Framework/SCore.cs
+++ b/src/SMAPI/Framework/SCore.cs
@@ -77,7 +77,7 @@ namespace StardewModdingAPI.Framework
/// <summary>Manages deprecation warnings.</summary>
/// <remarks>This is initialised after the game starts.</remarks>
- private DeprecationManager DeprecationManager;
+ private readonly DeprecationManager DeprecationManager;
/// <summary>Manages SMAPI events for mods.</summary>
private readonly EventManager EventManager;
@@ -134,6 +134,10 @@ namespace StardewModdingAPI.Framework
};
this.MonitorForGame = this.GetSecondaryMonitor("game");
this.EventManager = new EventManager(this.Monitor, this.ModRegistry);
+ this.DeprecationManager = new DeprecationManager(this.Monitor, this.ModRegistry);
+
+ // inject deprecation managers
+ SemanticVersion.DeprecationManager = this.DeprecationManager;
// init logging
this.Monitor.Log($"SMAPI {Constants.ApiVersion} with Stardew Valley {Constants.GameVersion} on {EnvironmentUtility.GetFriendlyPlatformName(Constants.Platform)}", LogLevel.Info);
@@ -340,9 +344,6 @@ namespace StardewModdingAPI.Framework
/// <summary>Initialise SMAPI and mods after the game starts.</summary>
private void InitialiseAfterGameStart()
{
- // load core components
- this.DeprecationManager = new DeprecationManager(this.Monitor, this.ModRegistry);
-
// redirect direct console output
if (this.MonitorForGame.WriteToConsole)
this.ConsoleManager.OnMessageIntercepted += message => this.HandleConsoleMessage(this.MonitorForGame, message);
diff --git a/src/SMAPI/SemanticVersion.cs b/src/SMAPI/SemanticVersion.cs
index a65afeb8..401f62c2 100644
--- a/src/SMAPI/SemanticVersion.cs
+++ b/src/SMAPI/SemanticVersion.cs
@@ -1,5 +1,6 @@
using System;
using Newtonsoft.Json;
+using StardewModdingAPI.Framework;
namespace StardewModdingAPI
{
@@ -12,6 +13,9 @@ namespace StardewModdingAPI
/// <summary>The underlying semantic version implementation.</summary>
private readonly ISemanticVersion Version;
+ /// <summary>Manages deprecation warnings.</summary>
+ internal static DeprecationManager DeprecationManager { get; set; }
+
/*********
** Accessors
@@ -26,7 +30,18 @@ namespace StardewModdingAPI
public int PatchVersion => this.Version.PatchVersion;
/// <summary>An optional build tag.</summary>
- public string Build => this.Version.Build;
+ [Obsolete("Use " + nameof(ISemanticVersion.PrereleaseTag) + " instead")]
+ public string Build
+ {
+ get
+ {
+ SemanticVersion.DeprecationManager?.Warn($"{nameof(ISemanticVersion)}.{nameof(ISemanticVersion.Build)}", "2.8", DeprecationLevel.Notice);
+ return this.Version.PrereleaseTag;
+ }
+ }
+
+ /// <summary>An optional prerelease tag.</summary>
+ public string PrereleaseTag => this.Version.PrereleaseTag;
/*********