Table of Contents

Method ReadDataFileAsBytesAsync

Namespace
WhalesSecret.TradeScriptLib.API
Assembly
WhalesSecret.TradeScriptLib.dll

ReadDataFileAsBytesAsync(string, CancellationToken)

Reads contents of a trade script data file and interprets it as a binary data.

Task<byte[]> ReadDataFileAsBytesAsync(string filename, CancellationToken cancellationToken = default)

Parameters

filename string

Name of the data file to read. The name must not include any path. The file must exist in the trade script data folder.

cancellationToken CancellationToken

Cancellation token to monitor for cancellation requests.

Returns

Task<byte[]>

Contents of the data file as an array of bytes.

Exceptions

NotFoundException

Thrown if the data file with the given name does not exist.

FileAccessException

Thrown if the specified data file cannot be open or read.

FileNameInvalidException

Thrown if the filename contains a directory separator.

OperationCanceledException

Thrown if the operation was cancelled using cancellationToken.

InvalidArgumentException

Thrown if filename is null.