Support ancient .NET in Help

This commit is contained in:
Matt Nadareski
2024-02-28 23:14:21 -05:00
parent c2973beb7f
commit 010a2d4cec
4 changed files with 25 additions and 6 deletions

View File

@@ -235,7 +235,7 @@ namespace SabreTools.Help
output = CreatePadding(pre + 4); output = CreatePadding(pre + 4);
} }
output += subsplit[^1]; output += subsplit[subsplit.Length - 1];
continue; continue;
} }
@@ -372,7 +372,7 @@ namespace SabreTools.Help
output = CreatePadding(preAdjusted + 4); output = CreatePadding(preAdjusted + 4);
} }
output += subsplit[^1]; output += subsplit[subsplit.Length - 1];
continue; continue;
} }

View File

@@ -207,14 +207,14 @@ namespace SabreTools.Help
} }
// If we have a match within the flags // If we have a match within the flags
else if (_features[feature]!.ContainsFlag(featurename)) else if (_features[feature]!.ContainsFlag(featurename!))
{ {
realname = feature; realname = feature;
break; break;
} }
// Otherwise, we want to get features with the same start // Otherwise, we want to get features with the same start
else if (_features[feature]!.StartsWith(featurename.TrimStart('-')[0])) else if (_features[feature]!.StartsWith(featurename!.TrimStart('-')[0]))
{ {
startsWith.Add(feature); startsWith.Add(feature);
} }
@@ -284,7 +284,7 @@ namespace SabreTools.Help
private Dictionary<string, Feature?> GetEnabledSubfeatures(string key, Feature? feature) private Dictionary<string, Feature?> GetEnabledSubfeatures(string key, Feature? feature)
{ {
Dictionary<string, Feature?> enabled = []; Dictionary<string, Feature?> enabled = [];
// If the feature is invalid // If the feature is invalid
if (feature == null) if (feature == null)
return enabled; return enabled;
@@ -340,7 +340,9 @@ namespace SabreTools.Help
/// </summary> /// </summary>
private static void Pause() private static void Pause()
{ {
#if NET452_OR_GREATER || NETCOREAPP
if (!Console.IsOutputRedirected) if (!Console.IsOutputRedirected)
#endif
{ {
Console.WriteLine(); Console.WriteLine();
Console.WriteLine("Press enter to continue..."); Console.WriteLine("Press enter to continue...");

View File

@@ -1,10 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks> <!-- Assembly Properties -->
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64</RuntimeIdentifiers>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>1.1.2</Version>
<!-- Package Properties -->
<Authors>Matt Nadareski</Authors>
<Copyright>Copyright (c)2016-2024 Matt Nadareski</Copyright>
<PackageProjectUrl>https://github.com/SabreTools/</PackageProjectUrl>
<RepositoryUrl>https://github.com/SabreTools/SabreTools</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@@ -60,7 +60,11 @@ namespace SabreTools.Help
} }
// Special precautions for wildcarded inputs (potential paths) // Special precautions for wildcarded inputs (potential paths)
#if NETFRAMEWORK
else if (args[i].Contains("*") || args[i].Contains("?"))
#else
else if (args[i].Contains('*') || args[i].Contains('?')) else if (args[i].Contains('*') || args[i].Contains('?'))
#endif
{ {
Inputs.Add(args[i]); Inputs.Add(args[i]);
} }