Table of Contents

Method ReadDataFileAsStringAsync

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

ReadDataFileAsStringAsync(string, CancellationToken)

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

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

Task<string> ReadDataFileAsStringAsync(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 a single string.

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

ReadDataFileAsStringAsync(string, Encoding, CancellationToken)

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

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

Task<string> ReadDataFileAsStringAsync(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 a single string.

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