mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
Replace polyfills with PolyShim
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
<GenerateDependencyFile>true</GenerateDependencyFile>
|
<GenerateDependencyFile>true</GenerateDependencyFile>
|
||||||
<NoWarn>$(NoWarn);RS1025;RS1026</NoWarn>
|
<NoWarn>$(NoWarn);RS1025;RS1026</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!--
|
<!--
|
||||||
Because this project only has a single target framework, the condition in
|
Because this project only has a single target framework, the condition in
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.5.0" PrivateAssets="all" />
|
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.5.0" PrivateAssets="all" />
|
||||||
|
<PackageReference Include="PolyShim" Version="1.0.0" PrivateAssets="all" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.1;netstandard2.0</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
|
||||||
<IsPackable>true</IsPackable>
|
<IsPackable>true</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
@@ -27,11 +27,8 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="all" />
|
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="all" />
|
||||||
<PackageReference Include="PolySharp" Version="1.12.1" PrivateAssets="all" />
|
<PackageReference Include="PolyShim" Version="1.0.0" PrivateAssets="all" />
|
||||||
</ItemGroup>
|
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
|
||||||
|
|
||||||
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
|
|
||||||
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!-- Embed the analyzer inside the package -->
|
<!-- Embed the analyzer inside the package -->
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
// ReSharper disable CheckNamespace
|
|
||||||
|
|
||||||
#if NETSTANDARD2_0
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
internal static class CollectionPolyfills
|
|
||||||
{
|
|
||||||
public static void Deconstruct<TKey, TValue>(this KeyValuePair<TKey, TValue> pair, out TKey key, out TValue value)
|
|
||||||
{
|
|
||||||
key = pair.Key;
|
|
||||||
value = pair.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TValue GetValueOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dic, TKey key) =>
|
|
||||||
dic.TryGetValue(key!, out var result) ? result! : default!;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace System.Linq
|
|
||||||
{
|
|
||||||
internal static class LinqPolyfills
|
|
||||||
{
|
|
||||||
public static HashSet<T> ToHashSet<T>(this IEnumerable<T> source, IEqualityComparer<T> comparer) =>
|
|
||||||
new(source, comparer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
// ReSharper disable CheckNamespace
|
|
||||||
|
|
||||||
#if NETSTANDARD2_0
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
|
|
||||||
internal static class RegexPolyfills
|
|
||||||
{
|
|
||||||
public static Match[] ToArray(this MatchCollection matches) =>
|
|
||||||
matches.Cast<Match>().ToArray();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
// ReSharper disable CheckNamespace
|
|
||||||
|
|
||||||
#if NETSTANDARD2_0
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
internal static class StreamPolyfills
|
|
||||||
{
|
|
||||||
public static void Write(this Stream stream, byte[] buffer) =>
|
|
||||||
stream.Write(buffer, 0, buffer.Length);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
// ReSharper disable CheckNamespace
|
|
||||||
|
|
||||||
#if NETSTANDARD2_0
|
|
||||||
internal static class StringPolyfills
|
|
||||||
{
|
|
||||||
public static bool StartsWith(this string str, char c) =>
|
|
||||||
str.Length > 0 && str[0] == c;
|
|
||||||
|
|
||||||
public static bool EndsWith(this string str, char c) =>
|
|
||||||
str.Length > 0 && str[^1] == c;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
Reference in New Issue
Block a user