Skip to content

Commit 1fb96d2

Browse files
committed
Remove C#/WinRT reference
1 parent 7d1a248 commit 1fb96d2

File tree

8 files changed

+14
-17
lines changed

8 files changed

+14
-17
lines changed

AdvancedSharpAdbClient/AdvancedSharpAdbClient.csproj

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<PropertyGroup>
2121
<NoWarn>$(NoWarn);NU1603;NU1605;NU1902;NU1903</NoWarn>
2222
<TargetFrameworks>net6.0;net8.0;net9.0;netcoreapp2.1;netcoreapp3.1;netstandard1.3;netstandard2.0;netstandard2.1</TargetFrameworks>
23-
<TargetFrameworks Condition="'$(IsWindows)' == 'True'">$(TargetFrameworks);net2.0;net3.5-client;net4.0-client;net4.5;net4.6.1;net4.8;net8.0-windows10.0.18362.0;net9.0-windows10.0.18362.0</TargetFrameworks>
23+
<TargetFrameworks Condition="'$(IsWindows)' == 'True'">$(TargetFrameworks);net2.0;net3.5-client;net4.0-client;net4.5;net4.6.1;net4.8;net8.0-windows10.0.17763.0;net9.0-windows10.0.17763.0</TargetFrameworks>
2424
<TargetFrameworks Condition="'$(GITHUB_ACTIONS)' != 'True' and '$(IsWindows)' == 'True'">$(TargetFrameworks);netcore5.0;uap10.0;uap10.0.15138.0</TargetFrameworks>
2525
</PropertyGroup>
2626
</When>
@@ -111,7 +111,7 @@
111111
</ItemGroup>
112112

113113
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net5.0-windows'))">
114-
<PackageReference Include="System.Drawing.Common" Version="8.0.8" />
114+
<PackageReference Include="System.Drawing.Common" Version="8.0.10" />
115115
</ItemGroup>
116116

117117
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netstandard2.1'))">
@@ -133,8 +133,7 @@
133133
<DefineConstants>$(DefineConstants);HAS_WINRT</DefineConstants>
134134
</PropertyGroup>
135135

136-
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'uap'))
137-
or $([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0-windows10.0.17763.0'))">
136+
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'uap'))">
138137
<DefineConstants>$(DefineConstants);HAS_WUXC</DefineConstants>
139138
</PropertyGroup>
140139

AdvancedSharpAdbClient/Extensions/UnixFileStatusExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public static string ToPermissionCode(this UnixFileStatus mode)
216216
#else
217217
char[] code = new char[10];
218218
#endif
219-
BitArray array = new(new[] { (int)mode });
219+
BitArray array = new([(int)mode]);
220220

221221
code[9] = array[0]
222222
? array[9] ? 't' : 'x'

AdvancedSharpAdbClient/Polyfills/Extensions/ExceptionExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ public static void ThrowIfLessThan<T>(T value, T other, [CallerArgumentExpressio
7676
/// </summary>
7777
/// <param name="value">The argument to validate as non-negative.</param>
7878
/// <param name="paramName">The name of the parameter with which <paramref name="value"/> corresponds.</param>
79-
#if NET8_0_OR_GREATER
8079
public static void ThrowIfNegative<T>(T value, [CallerArgumentExpression(nameof(value))] string? paramName = null)
80+
#if NET8_0_OR_GREATER
8181
where T : INumberBase<T>
8282
{
8383
ArgumentOutOfRangeException.ThrowIfNegative(value, paramName);
8484
#else
85-
public static void ThrowIfNegative(double value, [CallerArgumentExpression(nameof(value))] string? paramName = null)
85+
where T : struct, IComparable<T>
8686
{
87-
if (value < 0)
87+
if (value.CompareTo(default) < 0)
8888
{
8989
throw new ArgumentOutOfRangeException(paramName, value, $"{paramName} ('{value}') must be a non-negative value.");
9090
}

AdvancedSharpAdbClient/Polyfills/Extensions/StringExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static bool Contains(this string text, string value, StringComparison com
6363
/// <param name="options">A bitwise combination of the enumeration values that specifies whether to trim substrings and include empty substrings.</param>
6464
/// <returns>An array whose elements contain the substrings from this instance that are delimited by <paramref name="separator"/>.</returns>
6565
public static string[] Split(this string text, char separator, StringSplitOptions options = StringSplitOptions.None) =>
66-
text.Split(new[] { separator }, options);
66+
text.Split([separator], options);
6767

6868
/// <summary>
6969
/// Splits a string into a maximum number of substrings based on a specified delimiting
@@ -77,7 +77,7 @@ public static string[] Split(this string text, char separator, StringSplitOption
7777
/// <param name="options">A bitwise combination of the enumeration values that specifies whether to trim substrings and include empty substrings.</param>
7878
/// <returns>An array that contains at most count substrings from this instance that are delimited by <paramref name="separator"/>.</returns>
7979
public static string[] Split(this string text, char separator, int count, StringSplitOptions options = StringSplitOptions.None) =>
80-
text.Split(new[] { separator }, count, options);
80+
text.Split([separator], count, options);
8181

8282
/// <summary>
8383
/// Determines whether this string instance starts with the specified character.

AdvancedSharpAdbClient/Polyfills/Interfaces/ICloneable.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ namespace AdvancedSharpAdbClient.Polyfills
3131
/// </summary>
3232
/// <typeparam name="T">The type of the class.</typeparam>
3333
public interface ICloneable<out T>
34+
#if NET9_0_OR_GREATER
35+
where T : allows ref struct
36+
#endif
3437
{
3538
/// <summary>
3639
/// Creates a new <typeparamref name="T"/> object that is a copy of the current instance.

AdvancedSharpAdbClient/Properties/GlobalUsings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
global using Windows.ApplicationModel;
2323
global using Windows.Foundation;
2424
global using Windows.Foundation.Metadata;
25+
global using Windows.Storage;
2526
global using Windows.Storage.Streams;
2627
global using Buffer = System.Buffer;
2728
global using DateTime = System.DateTime;
@@ -31,7 +32,6 @@
3132

3233
#if HAS_WUXC
3334
global using Windows.Graphics.Imaging;
34-
global using Windows.Storage;
3535
global using Windows.System;
3636
global using Windows.UI.Core;
3737
global using Windows.UI.Xaml.Media.Imaging;

Directory.Build.props

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@
6060
<TargetPlatformVersion>10.0.22621.0</TargetPlatformVersion>
6161
</PropertyGroup>
6262

63-
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0-windows10.0.18362.0'))">
63+
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0-windows10.0.17763.0'))">
6464
<TargetPlatformMinVersion>10.0</TargetPlatformMinVersion>
65-
<WindowsSdkPackageVersion>10.0.18362.42</WindowsSdkPackageVersion>
6665
</PropertyGroup>
6766

6867
</Project>

Directory.Build.targets

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,4 @@
1515
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.14" PrivateAssets="all" IsImplicitlyDefined="true" />
1616
</ItemGroup>
1717

18-
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0-windows10.0.17763.0'))">
19-
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.1.1" PrivateAssets="all" IsImplicitlyDefined="true" />
20-
</ItemGroup>
21-
2218
</Project>

0 commit comments

Comments
 (0)