Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
VNNCC committed Nov 14, 2023
1 parent 78565b5 commit 4f47204
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Snowberry.IPC/BasePipe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public abstract class BasePipe : IDisposable
protected PipeStream? _pipeStream;
protected bool _protectedIsConnected;

protected List<byte> _dynamicPacketBuffer = new();
protected List<byte> _dynamicPacketBuffer = [];
protected bool _useDynamicDataPacketSize;

public BasePipe(string? pipeDebugName, PipeStream pipeStream) : this(pipeDebugName, pipeStream, false)
Expand Down Expand Up @@ -170,7 +170,7 @@ protected virtual async Task HandleDynamicBufferAsync(byte[] buffer, Cancellatio
dynamicBuffer.AddRange(buffer.Take(readLength));
} while (IsConnected && dynamicBuffer.Count < expectedRead);

buffer = dynamicBuffer.ToArray();
buffer = [.. dynamicBuffer];
OnDataReceived(buffer, buffer.Length);
DataReceived?.Invoke(this, new PipeEventArgs(buffer, buffer.Length, usedDynamicallyRead: true));

Expand Down Expand Up @@ -213,7 +213,7 @@ public virtual Task WriteAsync(byte[] data, int offset, int length)
#endif
packet.InsertRange(0, BitConverter.GetBytes(length));

return _pipeStream.WriteAsync(packet.ToArray(), 0, packet.Count);
return _pipeStream.WriteAsync([.. packet], 0, packet.Count);
}

return _pipeStream.WriteAsync(data, offset, length);
Expand Down

0 comments on commit 4f47204

Please sign in to comment.