formatting
This commit is contained in:
parent
d4d0abd013
commit
1f0e6ba8fa
19 changed files with 88 additions and 79 deletions
|
@ -16,6 +16,13 @@ public sealed class ByteGrid(ushort width, ushort height) : IEquatable<ByteGrid>
|
|||
set => Data.Span[GetIndex(x, y)] = value;
|
||||
}
|
||||
|
||||
public bool Equals(ByteGrid? other)
|
||||
{
|
||||
if (ReferenceEquals(null, other)) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
return Height == other.Height && Width == other.Width && Data.Span.SequenceEqual(other.Data.Span);
|
||||
}
|
||||
|
||||
private int GetIndex(ushort x, ushort y)
|
||||
{
|
||||
Debug.Assert(x < Width);
|
||||
|
@ -25,15 +32,11 @@ public sealed class ByteGrid(ushort width, ushort height) : IEquatable<ByteGrid>
|
|||
|
||||
public void Clear() => Data.Span.Clear();
|
||||
|
||||
public bool Equals(ByteGrid? other)
|
||||
{
|
||||
if (ReferenceEquals(null, other)) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
return Height == other.Height && Width == other.Width && Data.Span.SequenceEqual(other.Data.Span);
|
||||
}
|
||||
|
||||
public override bool Equals(object? obj) => ReferenceEquals(this, obj) || (obj is ByteGrid other && Equals(other));
|
||||
|
||||
public override int GetHashCode() => HashCode.Combine(Height, Width, Data);
|
||||
|
||||
public static bool operator ==(ByteGrid? left, ByteGrid? right) => Equals(left, right);
|
||||
|
||||
public static bool operator !=(ByteGrid? left, ByteGrid? right) => !Equals(left, right);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<NoWarn>CA1805,CA1848</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0"/>
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0"/>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.1"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -7,7 +7,7 @@ public interface IDisplayConnection
|
|||
ValueTask SendCp437DataAsync(ushort x, ushort y, Cp437Grid grid);
|
||||
|
||||
ValueTask SendBrightnessAsync(byte brightness);
|
||||
|
||||
|
||||
ValueTask SendCharBrightnessAsync(ushort x, ushort y, ByteGrid luma);
|
||||
|
||||
ValueTask SendHardResetAsync();
|
||||
|
@ -17,8 +17,8 @@ public interface IDisplayConnection
|
|||
public ValueTask SendBitmapLinearWindowAsync(ushort x, ushort y, PixelGrid pixels);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the IPv4 address that is associated with the interface with which the display is reachable.
|
||||
/// Returns the IPv4 address that is associated with the interface with which the display is reachable.
|
||||
/// </summary>
|
||||
/// <returns>IPv4 as text</returns>
|
||||
public string GetLocalIPv4();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,5 +13,5 @@ internal enum DisplayCommand : ushort
|
|||
BitmapLinearWin = 0x0013,
|
||||
BitmapLinearAnd = 0x0014,
|
||||
BitmapLinearOr = 0x0015,
|
||||
BitmapLinearXor = 0x0016,
|
||||
}
|
||||
BitmapLinearXor = 0x0016
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ namespace DisplayCommands.Internals;
|
|||
|
||||
internal sealed class DisplayConnection(IOptions<DisplayConfiguration> options) : IDisplayConnection, IDisposable
|
||||
{
|
||||
private readonly UdpClient _udpClient = new(options.Value.Hostname, options.Value.Port);
|
||||
private readonly ArrayPool<byte> _arrayPool = ArrayPool<byte>.Shared;
|
||||
private readonly UdpClient _udpClient = new(options.Value.Hostname, options.Value.Port);
|
||||
|
||||
public ValueTask SendClearAsync()
|
||||
{
|
||||
|
@ -119,8 +119,5 @@ internal sealed class DisplayConnection(IOptions<DisplayConfiguration> options)
|
|||
_arrayPool.Return(buffer);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_udpClient.Dispose();
|
||||
}
|
||||
}
|
||||
public void Dispose() => _udpClient.Dispose();
|
||||
}
|
||||
|
|
|
@ -6,5 +6,5 @@ internal enum DisplaySubCommand : ushort
|
|||
BitmapCompressZ = 0x677a,
|
||||
BitmapCompressBz = 0x627a,
|
||||
BitmapCompressLz = 0x6c7a,
|
||||
BitmapCompressZs = 0x7a73,
|
||||
}
|
||||
BitmapCompressZs = 0x7a73
|
||||
}
|
||||
|
|
|
@ -56,4 +56,4 @@ public sealed class PixelGrid(ushort width, ushort height) : IEquatable<PixelGri
|
|||
var bitInByteMask = (byte)(1 << bitInByteIndex);
|
||||
return (byteIndex, bitInByteMask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue