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
stringName of the data file to read. The name must not include any path. The file must exist in the trade script data folder.
cancellationToken
CancellationTokenCancellation token to monitor for cancellation requests.
Returns
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
orencoding
isnull
.
- 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
stringName of the data file to read. The name must not include any path. The file must exist in the trade script data folder.
encoding
EncodingEncoding applied to the contents of the file.
cancellationToken
CancellationTokenCancellation token to monitor for cancellation requests.
Returns
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
orencoding
isnull
.
- See Also