Class ReadFile
Reads a file from disk to a stream.
public sealed class ReadFile : TaskBase, ITask
- Inheritance
-
ReadFile
- Implements
- Inherited Members
- Extension Methods
Constructors
ReadFile(string, Action<Stream>, string?)
Reads a file from disk to a stream.
public ReadFile(string path, Action<Stream> callback, string? name = null)
Parameters
path
stringThe path of the file to read.
callback
Action<Stream>Called with a stream providing the file content.
name
stringA name describing the task in human-readable form.
Properties
Name
A name describing the task in human-readable form.
public override string Name { get; }
Property Value
UnitsByte
true
if UnitsProcessed and UnitsTotal are measured in bytes;
false
if they are measured in generic units.
protected override bool UnitsByte { get; }
Property Value
Methods
Execute()
The actual code to be executed.
protected override void Execute()
Remarks
State is automatically set to Started before calling this method, to Complete after a successful exit and to an appropriate error state in case on an exception. You can set additional TaskStates during execution.
Exceptions
- OperationCanceledException
The operation was canceled.
- IOException
The task ended with IOError.
- WebException
The task ended with WebError.