Skip to content

Commit

Permalink
Remove struct default construct
Browse files Browse the repository at this point in the history
  • Loading branch information
wherewhere committed Jul 28, 2024
1 parent 6b718d4 commit 05650ce
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 38 deletions.
5 changes: 4 additions & 1 deletion AdvancedSharpAdbClient.Tests/Models/DeviceDataTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,10 @@ public void EqualityTest(string data, string serial, string product, string mode
Model = model,
Name = name,
TransportId = transportId,
State = DeviceState.Online
State = DeviceState.Online,
Usb = string.Empty,
Features = [],
Message = string.Empty
};

Assert.True(d1 == d2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,13 @@ namespace AdvancedSharpAdbClient.DeviceCommands.Models
/// </summary>
public readonly struct AndroidProcess
{
/// <summary>
/// Initializes a new instance of the <see cref="AndroidProcess"/> struct.
/// </summary>
public AndroidProcess() { }

/// <summary>
/// Initializes a new instance of the <see cref="AndroidProcess"/> struct from it <see cref="string"/> representation.
/// </summary>
/// <param name="line">A <see cref="string"/> which represents a <see cref="AndroidProcess"/>.</param>
/// <param name="cmdLinePrefix">A value indicating whether the output of <c>/proc/{pid}/stat</c> is prefixed with <c>/proc/{pid}/cmdline</c> or not.
/// Because <c>stat</c> does not contain the full process name, this can be useful.</param>
public AndroidProcess(string line, bool cmdLinePrefix = false) : this()
public AndroidProcess(string line, bool cmdLinePrefix = false)
{
ExceptionExtensions.ThrowIfNull(line);

Expand Down
5 changes: 0 additions & 5 deletions AdvancedSharpAdbClient/DeviceMonitor.Async.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,6 @@ private async Task InitializeSocketAsync(CancellationToken cancellationToken)
[EditorBrowsable(EditorBrowsableState.Never)]
private readonly struct ThreadSwitcher : INotifyCompletion
{
/// <summary>
/// Initializes a new instance of the <see cref="ThreadSwitcher"/> struct.
/// </summary>
public ThreadSwitcher() { }

/// <summary>
/// Gets a value that indicates whether the asynchronous operation has completed.
/// </summary>
Expand Down
5 changes: 0 additions & 5 deletions AdvancedSharpAdbClient/Models/ColorData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ public readonly record struct ColorData(uint Offset, uint Length) : IReadOnlyLis
/// </summary>
private const int count = 8;

/// <summary>
/// Initializes a new instance of the <see cref="ColorData"/> struct.
/// </summary>
public ColorData() : this(0, 0) { }

/// <summary>
/// Gets or sets the offset, in bits, within the byte array for a pixel, at which the
/// bytes that contain information for this color are stored.
Expand Down
2 changes: 1 addition & 1 deletion AdvancedSharpAdbClient/Models/DeviceData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace AdvancedSharpAdbClient.Models
/// data retrieved from the Android Debug Bridge.
/// </summary>
/// <param name="data">The data retrieved from the Android Debug Bridge that represents a device.</param>
public DeviceData(string data) : this()
public DeviceData(string data)
{
Match match = Regex.Match(data);
if (match.Success)
Expand Down
9 changes: 2 additions & 7 deletions AdvancedSharpAdbClient/Models/ForwardData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,13 @@ namespace AdvancedSharpAdbClient.Models
[DebuggerDisplay($"{nameof(AdbServerStatus)} \\{{ {nameof(SerialNumber)} = {{{nameof(SerialNumber)}}}, {nameof(LocalSpec)} = {{{nameof(LocalSpec)}}}, {nameof(RemoteSpec)} = {{{nameof(RemoteSpec)}}} }}")]
public readonly struct ForwardData : IEquatable<ForwardData>
{
/// <summary>
/// Initializes a new instance of the <see cref="ForwardData"/> struct.
/// </summary>
public ForwardData() { }

/// <summary>
/// Initializes a new instance of the <see cref="ForwardData"/> struct.
/// </summary>
/// <param name="serialNumber">The serial number of the device for which the port forwarding is configured.</param>
/// <param name="local">The <see cref="string"/> that represents the local (PC) endpoint.</param>
/// <param name="remote">The <see cref="string"/> that represents the remote (device) endpoint.</param>
public ForwardData(string serialNumber, string local, string remote) : this()
public ForwardData(string serialNumber, string local, string remote)
{
SerialNumber = serialNumber;
Local = local;
Expand All @@ -36,7 +31,7 @@ public ForwardData(string serialNumber, string local, string remote) : this()
/// Initializes a new instance of the <see cref="ForwardData"/> class by parsing a <see cref="string"/>.
/// </summary>
/// <param name="value">The <see cref="string"/> value to parse.</param>
public ForwardData(string value) : this()
public ForwardData(string value)
{
string[] parts = value.Split(' ');
SerialNumber = parts[0];
Expand Down
7 changes: 1 addition & 6 deletions AdvancedSharpAdbClient/Models/ForwardSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,11 @@ namespace AdvancedSharpAdbClient.Models
{ "jdwp", ForwardProtocol.JavaDebugWireProtocol }
};

/// <summary>
/// Initializes a new instance of the <see cref="ForwardSpec"/> struct.
/// </summary>
public ForwardSpec() { }

/// <summary>
/// Initializes a new instance of the <see cref="ForwardSpec"/> struct from its <see cref="string"/> representation.
/// </summary>
/// <param name="spec">A <see cref="string"/> which represents a <see cref="ForwardSpec"/>.</param>
public ForwardSpec(string spec) : this()
public ForwardSpec(string spec)
{
ExceptionExtensions.ThrowIfNull(spec);

Expand Down
9 changes: 2 additions & 7 deletions AdvancedSharpAdbClient/Models/FramebufferHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,12 @@ namespace AdvancedSharpAdbClient.Models
/// </summary>
public const int MiniLength = 52;

/// <summary>
/// Initializes a new instance of the <see cref="FramebufferHeader"/> struct.
/// </summary>
public FramebufferHeader() { }

/// <summary>
/// Initializes a new instance of the <see cref="FramebufferHeader"/> struct based on a byte array which contains the data.
/// </summary>
/// <param name="data">The data that feeds the <see cref="FramebufferHeader"/> struct.</param>
/// <remarks>As defined in <see href="https://android.googlesource.com/platform/system/core/+/master/adb/framebuffer_service.cpp"/></remarks>
public FramebufferHeader(byte[] data) : this()
public FramebufferHeader(byte[] data)
{
if (data.Length is < MiniLength or > MaxLength)
{
Expand Down Expand Up @@ -102,7 +97,7 @@ public FramebufferHeader(byte[] data) : this()
/// </summary>
/// <param name="data">The data that feeds the <see cref="FramebufferHeader"/> struct.</param>
/// <remarks>As defined in <see href="https://android.googlesource.com/platform/system/core/+/master/adb/framebuffer_service.cpp"/></remarks>
public FramebufferHeader(ReadOnlySpan<byte> data) : this()
public FramebufferHeader(ReadOnlySpan<byte> data)
{
if (data.Length is < MiniLength or > MaxLength)
{
Expand Down

0 comments on commit 05650ce

Please sign in to comment.