Skip to content

Commit a57adf3

Browse files
committed
Use auto field
1 parent 28930d4 commit a57adf3

11 files changed

Lines changed: 10 additions & 32 deletions

File tree

AdvancedSharpAdbClient/AdbServer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public AdbServer(Func<EndPoint, IAdbSocket> adbSocketFactory, Func<string, IAdbC
154154
/// <summary>
155155
/// <see langword="true"/> if is starting adb server; otherwise, <see langword="false"/>.
156156
/// </summary>
157-
protected static bool IsStarting { get; set; } = false;
157+
protected static bool IsStarting { get; set; }
158158

159159
/// <summary>
160160
/// The path to the adb server. Cached from calls to <see cref="StartServer(string, bool)"/>. Used when restarting

AdvancedSharpAdbClient/DeviceCommands/DeviceClient.cs

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,23 @@ namespace AdvancedSharpAdbClient.DeviceCommands
2121
[DebuggerDisplay($"{{{nameof(ToString)}(),nq}}")]
2222
public partial record class DeviceClient(IAdbClient AdbClient, DeviceData Device) : ICloneable<DeviceClient>, ICloneable
2323
{
24-
/// <summary>
25-
/// The <see cref="IAdbClient"/> to use when communicating with the device.
26-
/// </summary>
27-
private IAdbClient adbClient = AdbClient ?? throw new ArgumentNullException(nameof(AdbClient));
28-
29-
/// <summary>
30-
/// The device on which to process command.
31-
/// </summary>
32-
private DeviceData device = DeviceData.EnsureDevice(ref Device);
33-
3424
/// <summary>
3525
/// Gets the <see cref="IAdbClient"/> to use when communicating with the device.
3626
/// </summary>
3727
public IAdbClient AdbClient
3828
{
39-
get => adbClient;
40-
init => adbClient = value ?? throw new ArgumentNullException(nameof(AdbClient));
41-
}
29+
get;
30+
init => field = value ?? throw new ArgumentNullException(nameof(AdbClient));
31+
} = AdbClient ?? throw new ArgumentNullException(nameof(AdbClient));
4232

4333
/// <summary>
4434
/// Gets the device on which to process command.
4535
/// </summary>
4636
public DeviceData Device
4737
{
48-
get => device;
49-
init => device = DeviceData.EnsureDevice(ref value);
50-
}
38+
get;
39+
init => field = DeviceData.EnsureDevice(ref value);
40+
} = DeviceData.EnsureDevice(ref Device);
5141

5242
/// <summary>
5343
/// Gets the current device screen snapshot.

AdvancedSharpAdbClient/DeviceCommands/NamespaceDoc.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33
// </copyright>
44

55
using System.ComponentModel;
6-
using System.Runtime.CompilerServices;
76

87
namespace AdvancedSharpAdbClient.DeviceCommands
98
{
109
/// <summary>
1110
/// The classes in this namespace provide Device Commands of adb.
1211
/// </summary>
1312
/// <remarks><c>Copyright (c) The Android Open Source Project, Ryan Conrad, Quamotion, yungd1plomat, wherewhere. All rights reserved.</c></remarks>
14-
[CompilerGenerated]
1513
[EditorBrowsable(EditorBrowsableState.Never)]
1614
internal abstract class NamespaceDoc : AdvancedSharpAdbClient.NamespaceDoc;
1715
}

AdvancedSharpAdbClient/DeviceCommands/Receivers/NamespaceDoc.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33
// </copyright>
44

55
using System.ComponentModel;
6-
using System.Runtime.CompilerServices;
76

87
namespace AdvancedSharpAdbClient.DeviceCommands.Receivers
98
{
109
/// <summary>
1110
/// The classes in this namespace provide receivers for <see cref="DeviceCommands"/>.
1211
/// </summary>
1312
/// <remarks><c>Copyright (c) The Android Open Source Project, Ryan Conrad, Quamotion, yungd1plomat, wherewhere. All rights reserved.</c></remarks>
14-
[CompilerGenerated]
1513
[EditorBrowsable(EditorBrowsableState.Never)]
1614
internal abstract class NamespaceDoc : AdvancedSharpAdbClient.Receivers.NamespaceDoc;
1715
}

AdvancedSharpAdbClient/Logs/AndroidLogEntry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class AndroidLogEntry : LogEntry
1717
/// <summary>
1818
/// Maps Android log priorities to chars used to represent them in the system log.
1919
/// </summary>
20-
private static readonly Dictionary<Priority, char> PriorityFormatters = new(6)
20+
private static readonly Dictionary<Priority, char> PriorityFormatters = new(7)
2121
{
2222
{ Priority.Verbose, 'V' },
2323
{ Priority.Debug, 'D' },

AdvancedSharpAdbClient/Logs/NamespaceDoc.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33
// </copyright>
44

55
using System.ComponentModel;
6-
using System.Runtime.CompilerServices;
76

87
namespace AdvancedSharpAdbClient.Logs
98
{
109
/// <summary>
1110
/// The classes in this namespace provide access to the Android system log.
1211
/// </summary>
1312
/// <remarks><c>Copyright (c) The Android Open Source Project, Ryan Conrad, Quamotion, yungd1plomat, wherewhere. All rights reserved.</c></remarks>
14-
[CompilerGenerated]
1513
[EditorBrowsable(EditorBrowsableState.Never)]
1614
internal abstract class NamespaceDoc : AdvancedSharpAdbClient.NamespaceDoc;
1715
}

AdvancedSharpAdbClient/Models/InstallProgress.EventArgs.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public override string ToString()
9292
#if NET
9393
new StringBuilder().Append(CollectionsMarshal.AsSpan(split));
9494
#else
95-
new(new string(split.ToArray()));
95+
new(new string([.. split]));
9696
#endif
9797

9898
if (PackageRequired > 0)

AdvancedSharpAdbClient/Models/NamespaceDoc.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33
// </copyright>
44

55
using System.ComponentModel;
6-
using System.Runtime.CompilerServices;
76

87
namespace AdvancedSharpAdbClient.Models
98
{
109
/// <summary>
1110
/// The classes in this namespace provide models for <see cref="AdvancedSharpAdbClient"/>.
1211
/// </summary>
1312
/// <remarks><c>Copyright (c) The Android Open Source Project, Ryan Conrad, Quamotion, yungd1plomat, wherewhere. All rights reserved.</c></remarks>
14-
[CompilerGenerated]
1513
[EditorBrowsable(EditorBrowsableState.Never)]
1614
internal abstract class NamespaceDoc : AdvancedSharpAdbClient.NamespaceDoc;
1715
}

AdvancedSharpAdbClient/NamespaceDoc.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// </copyright>
44

55
using System.ComponentModel;
6-
using System.Runtime.CompilerServices;
76

87
namespace AdvancedSharpAdbClient
98
{
@@ -43,7 +42,6 @@ namespace AdvancedSharpAdbClient
4342
/// Copyright (c) The Android Open Source Project, Ryan Conrad, Quamotion, yungd1plomat, wherewhere. All rights reserved.
4443
/// </c>
4544
/// </remarks>
46-
[CompilerGenerated]
4745
[EditorBrowsable(EditorBrowsableState.Never)]
4846
internal abstract class NamespaceDoc;
4947
}

AdvancedSharpAdbClient/Receivers/MultiLineReceiver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public MultiLineReceiver() { }
2222
/// Gets or sets a value indicating whether [trim lines].
2323
/// </summary>
2424
/// <value><see langword="true"/> if [trim lines]; otherwise, <see langword="false"/>.</value>
25-
public bool TrimLines { get; set; } = false;
25+
public bool TrimLines { get; set; }
2626

2727
/// <summary>
2828
/// Gets or sets a value indicating whether the receiver parses error messages.

0 commit comments

Comments
 (0)