Skip to content

Commit 13b7943

Browse files
committed
Add TypeForwardedTo
1 parent 2394ef0 commit 13b7943

File tree

10 files changed

+19
-40
lines changed

10 files changed

+19
-40
lines changed

AdvancedSharpAdbClient.Tests/AdvancedSharpAdbClient.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</PackageReference>
2626
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
2727
<PackageReference Include="NSubstitute" Version="5.1.0" />
28-
<PackageReference Include="xunit" Version="2.9.0" />
28+
<PackageReference Include="xunit" Version="2.9.2" />
2929
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" PrivateAssets="all">
3030
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3131
</PackageReference>

AdvancedSharpAdbClient.Tests/Dummys/DummyAdbSocket.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,5 @@ public async Task ReconnectAsync(bool isForce, CancellationToken cancellationTok
314314
SyncRequests = SyncRequests,
315315
ShellStreams = ShellStreams
316316
};
317-
318-
object ICloneable.Clone() => Clone();
319317
}
320318
}

AdvancedSharpAdbClient.Tests/Dummys/DummyTcpSocket.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,10 @@ public async ValueTask<int> SendAsync(ReadOnlyMemory<byte> buffer, SocketFlags s
114114

115115
public byte[] GetBytesSent() => OutputStream.ToArray();
116116

117-
public DummyTcpSocket Clone()
117+
public DummyTcpSocket Clone() => new()
118118
{
119-
DummyTcpSocket socket = new()
120-
{
121-
Connected = true,
122-
ReceiveBufferSize = ReceiveBufferSize
123-
};
124-
return socket;
125-
}
126-
127-
object ICloneable.Clone() => Clone();
119+
Connected = true,
120+
ReceiveBufferSize = ReceiveBufferSize
121+
};
128122
}
129123
}

AdvancedSharpAdbClient/AdbCommandLineClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public virtual List<string> ExecuteAdbCommand(string command, int timeout = 5000
131131
#endif
132132
public virtual bool CheckAdbFileExists(string adbPath) => adbPath == "adb" ||
133133
#if HAS_WINRT
134-
StorageFile.GetFileFromPathAsync(Extensions.GetFullPath(adbPath)).AwaitByTaskCompleteSource() is StorageFile file && file.IsOfType(StorageItemTypes.File);
134+
(StorageFile.GetFileFromPathAsync(Extensions.GetFullPath(adbPath)).AwaitByTaskCompleteSource() is StorageFile file && file.IsOfType(StorageItemTypes.File));
135135
#else
136136
File.Exists(adbPath);
137137
#endif

AdvancedSharpAdbClient/Models/FramebufferHeader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ private PixelFormat StandardizePixelFormat(ref byte[] buffer)
342342
int blueIndex = (int)Blue.Offset / 8;
343343
int greenIndex = (int)Green.Offset / 8;
344344
int alphaIndex = (int)Alpha.Offset / 8;
345-
345+
346346
byte[] array = new byte[(int)Size * 4];
347347
// Loop over the array and re-order as required
348348
for (int i = 0; i < (int)Size; i += 4)

AdvancedSharpAdbClient/Polyfills/Interfaces/ICloneable.cs

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Copyright (c) The Android Open Source Project, Ryan Conrad, Quamotion, yungd1plomat, wherewhere. All rights reserved.
33
// </copyright>
44

5-
using System;
6-
75
#if !NETFRAMEWORK && !NETCOREAPP2_0_OR_GREATER && !NETSTANDARD2_0_OR_GREATER && !UAP10_0_15138_0
86
// Licensed to the .NET Foundation under one or more agreements.
97
// The .NET Foundation licenses this file to you under the MIT license.
@@ -22,6 +20,9 @@ internal interface ICloneable
2220
object Clone();
2321
}
2422
}
23+
#else
24+
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ICloneable))]
25+
#endif
2526

2627
namespace AdvancedSharpAdbClient.Polyfills
2728
{
@@ -38,23 +39,3 @@ public interface ICloneable<out T>
3839
T Clone();
3940
}
4041
}
41-
#else
42-
namespace AdvancedSharpAdbClient.Polyfills
43-
{
44-
/// <summary>
45-
/// Supports cloning, which creates a new instance of a class with the same value as an existing instance.
46-
/// </summary>
47-
/// <typeparam name="T">The type of the class.</typeparam>
48-
public interface ICloneable<out T> : ICloneable
49-
#if NET9_0_OR_GREATER
50-
where T : allows ref struct
51-
#endif
52-
{
53-
/// <summary>
54-
/// Creates a new <typeparamref name="T"/> object that is a copy of the current instance.
55-
/// </summary>
56-
/// <returns>A new <typeparamref name="T"/> object that is a copy of this instance.</returns>
57-
new T Clone();
58-
}
59-
}
60-
#endif

AdvancedSharpAdbClient/Polyfills/Interfaces/IReadOnlyCollection.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@ internal interface IReadOnlyCollection<T> : IEnumerable<T>
2020
int Count { get; }
2121
}
2222
}
23+
#else
24+
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.IReadOnlyCollection<>))]
2325
#endif

AdvancedSharpAdbClient/Polyfills/Interfaces/IReadOnlyList.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ internal interface IReadOnlyList<T> : IReadOnlyCollection<T>
2121
T this[int index] { get; }
2222
}
2323
}
24+
#else
25+
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.IReadOnlyList<>))]
2426
#endif

AdvancedSharpAdbClient/Polyfills/StringHandler.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,4 +361,6 @@ private void AppendOrInsertAlignmentIfNeeded(int startingPos, int alignment)
361361
}
362362
}
363363
}
364+
#else
365+
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.DefaultInterpolatedStringHandler))]
364366
#endif

AdvancedSharpAdbClient/SyncService.Async.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ public virtual async Task PullAsync(string remotePath, IOutputStream stream, Act
390390
cancellationToken.ThrowIfCancellationRequested();
391391
}
392392

393-
finish: return;
393+
finish: return;
394394
}
395395
finally
396396
{
@@ -480,7 +480,7 @@ public async IAsyncEnumerable<FileStatistics> GetDirectoryAsyncListing(string re
480480

481481
try
482482
{
483-
start:
483+
start:
484484
// create the stat request message.
485485
await Socket.SendSyncRequestAsync(SyncCommand.LIST, remotePath, cancellationToken).ConfigureAwait(false);
486486
IsProcessing = true;
@@ -510,7 +510,7 @@ public async IAsyncEnumerable<FileStatistics> GetDirectoryAsyncListing(string re
510510
isLocked = true;
511511
}
512512

513-
finish:
513+
finish:
514514
yield break;
515515
}
516516
finally

0 commit comments

Comments
 (0)