Support ancient .NET

This commit is contained in:
Matt Nadareski
2023-11-07 21:18:17 -05:00
parent 1f340bd244
commit 38e37b1a63
3 changed files with 21 additions and 2 deletions

View File

@@ -16,6 +16,10 @@ namespace SabreTools.Models.Charts
/// `name` - Display name of the tier.
/// `unlock_id` - Name used for associating a song with this tier, and for checking unlock requirements.
/// </summary>
#if NET20 || NET35
public Dictionary<string, System.Tuple<string?, string?>>? Sections { get; set; }
#else
public Dictionary<string, (string? Name, string? UnlockId)>? Sections { get; set; }
#endif
}
}

View File

@@ -100,7 +100,7 @@ namespace SabreTools.Models.Metadata
string[]? asArray = Read<string[]>(key);
if (asArray != null)
#if NET48
#if NETFRAMEWORK
return string.Join(",", asArray);
#else
return string.Join(',', asArray);
@@ -140,7 +140,11 @@ namespace SabreTools.Models.Metadata
/// </summary>
private bool ValidateKey(string key)
{
#if NET20 || NET35
if (key == null || string.IsNullOrEmpty(key.TrimEnd(' ')))
#else
if (string.IsNullOrWhiteSpace(key))
#endif
return false;
else if (!ContainsKey(key))
return false;

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<!-- Assembly Properties -->
<TargetFrameworks>net48;netcoreapp3.1;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net6.0;net7.0;net8.0</TargetFrameworks>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
@@ -24,6 +24,17 @@
<None Include="README.md" Pack="true" PackagePath=""/>
</ItemGroup>
<!-- Support for old .NET versions -->
<ItemGroup Condition="$(TargetFramework.StartsWith(`net4`))">
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith(`net3`))">
<PackageReference Include="NetLegacySupport.Tuple" Version="1.1.1" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith(`net2`))">
<PackageReference Include="NetLegacySupport.Tuple" Version="1.1.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>