improve ByteChannelWebSocket

This commit is contained in:
Vinzenz Schroeter 2024-04-13 12:33:08 +02:00
parent de3d298475
commit 40eba7a7c7
5 changed files with 79 additions and 111 deletions

View file

@ -6,6 +6,7 @@ namespace DisplayCommands;
public sealed class Cp437Grid(ushort width, ushort height) : IEquatable<Cp437Grid>
{
private readonly ByteGrid _byteGrid = new(width, height);
private readonly Encoding _encoding = Encoding.GetEncoding(437);
public ushort Height { get; } = height;
@ -13,8 +14,6 @@ public sealed class Cp437Grid(ushort width, ushort height) : IEquatable<Cp437Gri
internal Memory<byte> Data => _byteGrid.Data;
private readonly Encoding _encoding = Encoding.GetEncoding(437);
public char this[ushort x, ushort y]
{
get => ByteToChar(_byteGrid[x, y]);
@ -68,4 +67,4 @@ public sealed class Cp437Grid(ushort width, ushort height) : IEquatable<Cp437Gri
public override int GetHashCode() => HashCode.Combine(_byteGrid, Height, Width);
public static bool operator ==(Cp437Grid? left, Cp437Grid? right) => Equals(left, right);
public static bool operator !=(Cp437Grid? left, Cp437Grid? right) => !Equals(left, right);
}
}