show OS caption (like "Windows 10") instead of internal version when available
This commit is contained in:
parent
5270240c01
commit
5cdf75b463
|
@ -23,7 +23,8 @@ For mod developers:
|
||||||
* Added a simpler API for console commands (see `helper.ConsoleCommands`).
|
* Added a simpler API for console commands (see `helper.ConsoleCommands`).
|
||||||
* Added `GetPrivateProperty` reflection helper.
|
* Added `GetPrivateProperty` reflection helper.
|
||||||
* SMAPI now writes XNA input enums (`Buttons` and `Keys`) to JSON as strings, so mods no longer need to add a `StringEnumConverter` themselves for those.
|
* SMAPI now writes XNA input enums (`Buttons` and `Keys`) to JSON as strings, so mods no longer need to add a `StringEnumConverter` themselves for those.
|
||||||
* Log files now always use `\r\n` to simplify crossplatform viewing.
|
* Logs now show the OS caption (like "Windows 10") instead of its internal version when available.
|
||||||
|
* Logs now always use `\r\n` to simplify crossplatform viewing.
|
||||||
* Several obsolete APIs have been removed (see [deprecation guide](http://canimod.com/guides/updating-a-smapi-mod)),
|
* Several obsolete APIs have been removed (see [deprecation guide](http://canimod.com/guides/updating-a-smapi-mod)),
|
||||||
and all _notice_-level deprecations have been increased to _info_.
|
and all _notice_-level deprecations have been increased to _info_.
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Management;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
#if SMAPI_FOR_WINDOWS
|
#if SMAPI_FOR_WINDOWS
|
||||||
|
@ -87,7 +88,7 @@ namespace StardewModdingAPI
|
||||||
{
|
{
|
||||||
// initialise logging
|
// initialise logging
|
||||||
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-GB"); // for consistent log formatting
|
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-GB"); // for consistent log formatting
|
||||||
this.Monitor.Log($"SMAPI {Constants.ApiVersion} with Stardew Valley {Constants.GameVersion} on {Environment.OSVersion}", LogLevel.Info);
|
this.Monitor.Log($"SMAPI {Constants.ApiVersion} with Stardew Valley {Constants.GameVersion} on {this.GetFriendlyPlatformName()}", LogLevel.Info);
|
||||||
Console.Title = $"SMAPI {Constants.ApiVersion} - running Stardew Valley {Constants.GameVersion}";
|
Console.Title = $"SMAPI {Constants.ApiVersion} - running Stardew Valley {Constants.GameVersion}";
|
||||||
|
|
||||||
// inject compatibility shims
|
// inject compatibility shims
|
||||||
|
@ -582,5 +583,21 @@ namespace StardewModdingAPI
|
||||||
{
|
{
|
||||||
return new Monitor(name, this.ConsoleManager, this.LogFile, this.ExitGameImmediately) { WriteToConsole = this.Monitor.WriteToConsole, ShowTraceInConsole = this.Settings.DeveloperMode };
|
return new Monitor(name, this.ConsoleManager, this.LogFile, this.ExitGameImmediately) { WriteToConsole = this.Monitor.WriteToConsole, ShowTraceInConsole = this.Settings.DeveloperMode };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Get a human-readable name for the current platform.</summary>
|
||||||
|
private string GetFriendlyPlatformName()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
from entry in new ManagementObjectSearcher("SELECT Caption FROM Win32_OperatingSystem").Get().Cast<ManagementObject>()
|
||||||
|
select entry.GetPropertyValue("Caption").ToString()
|
||||||
|
).FirstOrDefault();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return Environment.OSVersion.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,7 @@
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Management" />
|
||||||
<Reference Include="System.Numerics">
|
<Reference Include="System.Numerics">
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
|
Loading…
Reference in New Issue