Interface IGorgonVirtualDirectory
A representation of a virtual directory within a IGorgonFileSystem.
Inherited Members
Namespace: Gorgon.IO
Assembly: Gorgon.FileSystem.dll
Syntax
public interface IGorgonVirtualDirectory : IGorgonNamedObject
Remarks
A virtual directory is a container for sub directories and files.
Directories can be created by creating a IGorgonFileSystemWriter<T> instance and calling its CreateDirectory(string). Likewise, if you wish to delete a directory, call the DeleteDirectory(string, Action<string>, CancellationToken?) method on the IGorgonFileSystemWriter<T> object.
Properties
| Edit this page View SourceDirectories
Property to return the list of any child IGorgonVirtualDirectory items under this virtual directory.
Declaration
IGorgonNamedObjectReadOnlyDictionary<IGorgonVirtualDirectory> Directories { get; }
Property Value
Type | Description |
---|---|
IGorgonNamedObjectReadOnlyDictionary<IGorgonVirtualDirectory> |
FileSystem
Property to return the IGorgonFileSystem that contains this directory.
Declaration
IGorgonFileSystem FileSystem { get; }
Property Value
Type | Description |
---|---|
IGorgonFileSystem |
Files
Property to return the list of IGorgonVirtualFile objects within this directory.
Declaration
IGorgonNamedObjectReadOnlyDictionary<IGorgonVirtualFile> Files { get; }
Property Value
Type | Description |
---|---|
IGorgonNamedObjectReadOnlyDictionary<IGorgonVirtualFile> |
FullPath
Property to return the full path to the directory.
Declaration
string FullPath { get; }
Property Value
Type | Description |
---|---|
string |
MountPoint
Property to return the mount point for this directory.
Declaration
GorgonFileSystemMountPoint MountPoint { get; }
Property Value
Type | Description |
---|---|
GorgonFileSystemMountPoint |
Remarks
This will show where the directory is mounted within the IGorgonFileSystem, the physical path to the directory, and the IGorgonFileSystemProvider used to import the directory.
Parent
Property to return the parent of this directory.
Declaration
IGorgonVirtualDirectory Parent { get; }
Property Value
Type | Description |
---|---|
IGorgonVirtualDirectory |
Remarks
If this value is null, then this will be the root directory for the file system.
Methods
| Edit this page View SourceContainsFile(IGorgonVirtualFile)
Function to determine if this directory, or optionally, any of the sub directories contains the specified file.
Declaration
bool ContainsFile(IGorgonVirtualFile file)
Parameters
Type | Name | Description |
---|---|---|
IGorgonVirtualFile | file | The IGorgonVirtualFile to search for. |
Returns
Type | Description |
---|---|
bool | true if found, false if not. |
Remarks
Use this to determine if a IGorgonVirtualFile exists under this directory or any of its sub directories. This search includes all sub directories for this and child directories. To determine if a file exists in the immediate directory, use the Contains(string) method.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ContainsFile(string)
Function to determine if this directory, or optionally, any of the sub directories contains a IGorgonVirtualFile with the specified file name.
Declaration
bool ContainsFile(string fileName)
Parameters
Type | Name | Description |
---|---|---|
string | fileName | The name of the file to search for. |
Returns
Type | Description |
---|---|
bool | true if found, false if not. |
Remarks
Use this to determine if a IGorgonVirtualFile exists under this directory or any of its sub directories. This search includes all sub directories for this and child directories. To determine if a file exists in the immediate directory, use the Contains(string) method.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
GetDirectoryCount()
Function to retrieve the total number of directories in this directory including any directories under this one.
Declaration
int GetDirectoryCount()
Returns
Type | Description |
---|---|
int | The total number of directories. |
Remarks
Use this to retrieve the total number of IGorgonVirtualDirectory entries under this directory. This search includes all sub directories for this and child directories. To get the count of the immediate subdirectories, use the Count property on the Directories property.
GetFileCount()
Function to retrieve the total number of files in this directory and any directories under this one.
Declaration
int GetFileCount()
Returns
Type | Description |
---|---|
int | The total number of files. |
Remarks
Use this to retrieve the total number of IGorgonVirtualFile entries under this directory. This search includes all sub directories for this and child directories. To get the count of the immediate files, use the Count property on the Files property.
GetParents()
Function to return all the parents up to the root directory.
Declaration
IEnumerable<IGorgonVirtualDirectory> GetParents()
Returns
Type | Description |
---|---|
IEnumerable<IGorgonVirtualDirectory> | A list of all the parents, up to and including the root. |
Remarks
If this value is empty, then there is no parent for this directory. This indicates that the current directory is the root directory for the file system.