diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-11-01 18:08:05 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-11-01 18:08:05 -0400 |
commit | 7af9a92842790dd374734307c79a51deb45c1d99 (patch) | |
tree | 51fa71567bf1cd9e4be5dcb0d189e6499e27f960 | |
parent | 310f705f1912d0bcbf406a8d7d76fdf1347d0459 (diff) | |
download | SMAPI-7af9a92842790dd374734307c79a51deb45c1d99.tar.gz SMAPI-7af9a92842790dd374734307c79a51deb45c1d99.tar.bz2 SMAPI-7af9a92842790dd374734307c79a51deb45c1d99.zip |
fix mod versions not being displayed correctly (#160)
-rw-r--r-- | src/StardewModdingAPI/Constants.cs | 2 | ||||
-rw-r--r-- | src/StardewModdingAPI/Program.cs | 4 | ||||
-rw-r--r-- | src/StardewModdingAPI/Version.cs | 13 |
3 files changed, 13 insertions, 6 deletions
diff --git a/src/StardewModdingAPI/Constants.cs b/src/StardewModdingAPI/Constants.cs index 6bdd10ef..86689f96 100644 --- a/src/StardewModdingAPI/Constants.cs +++ b/src/StardewModdingAPI/Constants.cs @@ -43,7 +43,7 @@ namespace StardewModdingAPI /// <summary> /// Title for the API console /// </summary> - public static string ConsoleTitle => $"Stardew Modding API Console - Version {Version.VersionString} - Mods Loaded: {ModsLoaded}"; + public static string ConsoleTitle => $"Stardew Modding API Console - Version {Constants.Version} - Mods Loaded: {Constants.ModsLoaded}"; /// <summary> /// Path for log files to be output to. diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs index 2ee8c8f5..14b4a5f0 100644 --- a/src/StardewModdingAPI/Program.cs +++ b/src/StardewModdingAPI/Program.cs @@ -53,7 +53,7 @@ namespace StardewModdingAPI try
{
Log.AsyncY("SDV Version: " + Game1.version);
- Log.AsyncY("SMAPI Version: " + Constants.Version.VersionString);
+ Log.AsyncY("SMAPI Version: " + Constants.Version);
ConfigureUI();
CreateDirectories();
StartGame();
@@ -104,7 +104,7 @@ namespace StardewModdingAPI // Change the game's version
Log.AsyncY("Injecting New SDV Version...");
- Game1.version += $"-Z_MODDED | SMAPI {Constants.Version.VersionString}";
+ Game1.version += $"-Z_MODDED | SMAPI {Constants.Version}";
// add error interceptors
#if SMAPI_FOR_WINDOWS
diff --git a/src/StardewModdingAPI/Version.cs b/src/StardewModdingAPI/Version.cs index 73bb9ef0..cce68ad8 100644 --- a/src/StardewModdingAPI/Version.cs +++ b/src/StardewModdingAPI/Version.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System; +using Newtonsoft.Json; namespace StardewModdingAPI { @@ -20,9 +21,10 @@ namespace StardewModdingAPI /// <summary>An optional build tag.</summary> public string Build { get; set; } - /// <summary>A string representation of the version.</summary> + /// <summary>Obsolete.</summary> [JsonIgnore] - public string VersionString => $"{MajorVersion}.{MinorVersion}.{PatchVersion} {Build}"; + [Obsolete("Use `Version.ToString()` instead.")] + public string VersionString => this.ToString(); /********* @@ -40,6 +42,11 @@ namespace StardewModdingAPI this.PatchVersion = patch; this.Build = build; } + + /// <summary>Get a string representation of the version.</summary> + public override string ToString() + { + return $"{this.MajorVersion}.{this.MinorVersion}.{this.PatchVersion} {this.Build}".Trim(); } } } |