mirror of
https://github.com/StockSharp/StockSharp.git
synced 2026-12-04 08:32:23 +00:00
Fix.Core and Fix.Dialects arrive from the closed apps repository. They were only there because Fix.Core referenced the closed Licensing project for a single licence check; that check is gone, and with it the reason to keep the FIX protocol out of the open source tree. They are the framework, not a venue - the FIX connector itself goes to the Connectors repository and references these two from here, the same way every connector already references Messages and Media.Names. The obfuscation stub include that both carried is dropped: it names a file at the root of the apps repository, and open sources are not obfuscated. Both build.
44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
namespace StockSharp.Fix.Native;
|
|
|
|
/// <summary>
|
|
/// Data reader base class.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Initialize <see cref="BaseFixReader"/>.
|
|
/// </remarks>
|
|
/// <param name="stream">The stream from which data will be read.</param>
|
|
/// <param name="encoding">Text encoding.</param>
|
|
/// <param name="ownsStream">Whether to dispose the stream when this instance is disposed.</param>
|
|
public abstract class BaseFixReader(Stream stream, Encoding encoding, bool ownsStream = false) : FixBase(stream, encoding, ownsStream)
|
|
{
|
|
private readonly byte[] _buffer = new byte[1];
|
|
|
|
/// <summary>
|
|
/// Get byte.
|
|
/// </summary>
|
|
/// <param name="cancellationToken">Cancellation token.</param>
|
|
/// <returns>Byte.</returns>
|
|
public async ValueTask<byte> ReadByteAsync(CancellationToken cancellationToken)
|
|
{
|
|
await Stream.ReadExactlyAsync(_buffer, 0, 1, cancellationToken).NoWait();
|
|
|
|
var b = _buffer[0];
|
|
|
|
CalcCheckSum(b);
|
|
|
|
return b;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Read <see cref="byte"/> array value.
|
|
/// </summary>
|
|
/// <param name="buffer">Buffer.</param>
|
|
/// <param name="cancellationToken">Cancellation token.</param>
|
|
public async ValueTask ReadBytesAsync(Memory<byte> buffer, CancellationToken cancellationToken)
|
|
{
|
|
await Stream.ReadExactlyAsync(buffer, cancellationToken).NoWait();
|
|
|
|
CalcCheckSum(buffer.Span);
|
|
Dump(buffer.Span);
|
|
}
|
|
} |