Table of Contents

Method ReadDataFileAsLinesAsync

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

ReadDataFileAsLinesAsync(string, CancellationToken)

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

Internally, this method uses ReadAllLinesAsync(string, Encoding, CancellationToken).

Task<string[]> ReadDataFileAsLinesAsync(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<string[]>

Contents of the data file as an array of string lines.

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 or encoding is null.

See Also

ReadDataFileAsLinesAsync(string, Encoding, CancellationToken)

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

Internally, this method uses ReadAllLinesAsync(string, Encoding, CancellationToken).

Task<string[]> ReadDataFileAsLinesAsync(string filename, Encoding encoding, 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.

encoding Encoding

Encoding applied to the contents of the file.

cancellationToken CancellationToken

Cancellation token to monitor for cancellation requests.

Returns

Task<string[]>

Contents of the data file as an array of string lines.

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 or encoding is null.

See Also