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
filenamestringName of the data file to read. The name must not include any path. The file must exist in the trade script data folder.
cancellationTokenCancellationTokenCancellation 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
filenamecontains a directory separator.- OperationCanceledException
Thrown if the operation was cancelled using
cancellationToken.- InvalidArgumentException
Thrown if
filenameorencodingisnull.
- 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
filenamestringName of the data file to read. The name must not include any path. The file must exist in the trade script data folder.
encodingEncodingEncoding applied to the contents of the file.
cancellationTokenCancellationTokenCancellation 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
filenamecontains a directory separator.- OperationCanceledException
Thrown if the operation was cancelled using
cancellationToken.- InvalidArgumentException
Thrown if
filenameorencodingisnull.
- See Also