Class ReadDirectoryBase
Recursively iterates over all elements in a directory.
Implements
Inherited Members
Namespace: NanoByte.Common.Storage
Assembly: NanoByte.Common.dll
Syntax
public abstract class ReadDirectoryBase : TaskBase, ITask
Constructors
ReadDirectoryBase(String)
Creates a new directory read task.
Declaration
protected ReadDirectoryBase(string path)
Parameters
Type | Name | Description |
---|---|---|
String | path | The path of the directory to read. |
Fields
Source
The directory to read.
Declaration
protected readonly DirectoryInfo Source
Field Value
Type | Description |
---|---|
DirectoryInfo |
Properties
FollowSymlinks
Controls whether to follow symlinks.
Declaration
public bool FollowSymlinks { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
UnitsByte
true
if UnitsProcessed and UnitsTotal are measured in bytes;
false
if they are measured in generic units.
Declaration
protected override bool UnitsByte { get; }
Property Value
Type | Description |
---|---|
Boolean |
Overrides
Methods
Execute()
The actual code to be executed.
Declaration
protected override void Execute()
Overrides
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
Type | Condition |
---|---|
OperationCanceledException | The operation was canceled. |
IOException | The task ended with IOError. |
WebException | The task ended with WebError. |
HandleDirectory(DirectoryInfo)
Called once for every sub-directory below Source.
Declaration
protected abstract void HandleDirectory(DirectoryInfo directory)
Parameters
Type | Name | Description |
---|---|---|
DirectoryInfo | directory | The directory to handle. |
HandleFile(FileInfo, FileInfo)
Called once for every file below Source.
Declaration
protected abstract void HandleFile(FileInfo file, FileInfo hardlinkTarget = null)
Parameters
Type | Name | Description |
---|---|---|
FileInfo | file | The file to handle. |
FileInfo | hardlinkTarget | A previously handled file that is hardlinked to |