mirror of
https://github.com/Pathoschild/SMAPI.git
synced 2026-10-12 02:08:51 +00:00
drop Win32_OperatingSystem query for OS name
In newer .NET versions, this fails with a PlatformNotSupportedException ("System.Management currently is only supported for Windows desktop applications").
This commit is contained in:
@@ -39,9 +39,6 @@ This assumes `find-game-folder.targets` has already been imported and validated.
|
||||
<!-- FluentHttpClient + dependencies -->
|
||||
<Copy SourceFiles="$(TargetDir)\Pathoschild.Http.Client.dll" DestinationFolder="$(GamePath)\smapi-internal" />
|
||||
<Copy SourceFiles="$(TargetDir)\System.Net.Http.Formatting.dll" DestinationFolder="$(GamePath)\smapi-internal" />
|
||||
|
||||
<!-- .NET dependencies -->
|
||||
<Copy SourceFiles="$(TargetDir)\System.Management.dll" DestinationFolder="$(GamePath)\smapi-internal" Condition="$(OS) == 'Windows_NT'" />
|
||||
</Target>
|
||||
|
||||
<!-- .NET metadata files -->
|
||||
|
||||
@@ -172,11 +172,6 @@ for folder in ${folders[@]}; do
|
||||
cp "$installAssets/windows-exe-config.xml" "$bundlePath/StardewModdingAPI.exe.config"
|
||||
fi
|
||||
|
||||
# copy .NET dependencies
|
||||
if [ $folder == "windows" ]; then
|
||||
cp "$smapiBin/System.Management.dll" "$bundlePath/smapi-internal"
|
||||
fi
|
||||
|
||||
# copy bundled mods
|
||||
for modName in ${bundleModNames[@]}; do
|
||||
fromPath="src/SMAPI.Mods.$modName/bin/$buildConfig/$runtime/publish"
|
||||
|
||||
@@ -197,11 +197,6 @@ foreach ($folder in $folders) {
|
||||
cp "$installAssets/windows-exe-config.xml" "$bundlePath/StardewModdingAPI.exe.config"
|
||||
}
|
||||
|
||||
# copy .NET dependencies
|
||||
if ($folder -eq "windows") {
|
||||
cp "$smapiBin/System.Management.dll" "$bundlePath/smapi-internal"
|
||||
}
|
||||
|
||||
# copy bundled mods
|
||||
foreach ($modName in $bundleModNames) {
|
||||
$fromPath = "src/SMAPI.Mods.$modName/bin/$buildConfig/$runtime/publish"
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
* Updated dependencies, including...
|
||||
* [Newtonsoft.Json](https://www.newtonsoft.com/json) 13.0.3 → 13.0.4 (see [changes](https://github.com/JamesNK/Newtonsoft.Json/releases/tag/13.0.4));
|
||||
* [Pintail](https://github.com/Nanoray-pl/Pintail) 2.8.1 → 2.9.1 (see [changes](https://github.com/Nanoray-pl/Pintail/blob/master/docs/release-notes.md#291)).
|
||||
* Removed `System.Management.dll`, which SMAPI no longer uses.
|
||||
|
||||
* For the web UI:
|
||||
* Improved mod compatibility list:
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
<PackageVersion Include="Pathoschild.Http.FluentClient" Version="4.4.2" />
|
||||
<PackageVersion Include="Pintail" Version="2.9.1" />
|
||||
<PackageVersion Include="Platonymous.TMXTile" Version="1.5.9" />
|
||||
<PackageVersion Include="System.Management" Version="10.0.1" />
|
||||
<PackageVersion Include="System.Reflection.Emit" Version="4.7.0" />
|
||||
<PackageVersion Include="VdfConverter" Version="1.0.3" />
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
#if SMAPI_FOR_WINDOWS
|
||||
using System.Management;
|
||||
#endif
|
||||
using System.Runtime.InteropServices;
|
||||
using StardewModdingAPI.Toolkit.Utilities;
|
||||
@@ -54,24 +52,8 @@ internal static class LowLevelEnvironmentUtility
|
||||
/// <param name="platform">The current platform.</param>
|
||||
public static string GetFriendlyPlatformName(string platform)
|
||||
{
|
||||
#if SMAPI_FOR_WINDOWS
|
||||
try
|
||||
{
|
||||
string? result = new ManagementObjectSearcher("SELECT Caption FROM Win32_OperatingSystem")
|
||||
.Get()
|
||||
.Cast<ManagementObject>()
|
||||
.Select(entry => entry.GetPropertyValue("Caption").ToString())
|
||||
.FirstOrDefault();
|
||||
|
||||
return result ?? "Windows";
|
||||
}
|
||||
catch
|
||||
{
|
||||
// fallback to default behavior
|
||||
}
|
||||
#endif
|
||||
|
||||
string name = Environment.OSVersion.ToString();
|
||||
|
||||
switch (platform)
|
||||
{
|
||||
case nameof(Platform.Android):
|
||||
@@ -82,6 +64,7 @@ internal static class LowLevelEnvironmentUtility
|
||||
name = $"macOS {name}";
|
||||
break;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
<PackageReference Include="Markdig" />
|
||||
<PackageReference Include="Newtonsoft.Json" />
|
||||
<PackageReference Include="Pathoschild.Http.FluentClient" />
|
||||
<PackageReference Include="System.Management" Condition="'$(OS)' == 'Windows_NT'" />
|
||||
<PackageReference Include="Microsoft.Win32.Registry" Condition="'$(OS)' == 'Windows_NT'" />
|
||||
<PackageReference Include="VdfConverter" Condition="'$(OS)' == 'Windows_NT'" Private="False" />
|
||||
</ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user