Gorgon
Show / Hide Table of Contents

Interface IGorgonVirtualDirectory

A representation of a virtual directory within a IGorgonFileSystem.

Inherited Members
IGorgonNamedObject.Name
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 Source

Directories

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>
| Edit this page View Source

FileSystem

Property to return the IGorgonFileSystem that contains this directory.

Declaration
IGorgonFileSystem FileSystem { get; }
Property Value
Type Description
IGorgonFileSystem
| Edit this page View Source

Files

Property to return the list of IGorgonVirtualFile objects within this directory.

Declaration
IGorgonNamedObjectReadOnlyDictionary<IGorgonVirtualFile> Files { get; }
Property Value
Type Description
IGorgonNamedObjectReadOnlyDictionary<IGorgonVirtualFile>
| Edit this page View Source

FullPath

Property to return the full path to the directory.

Declaration
string FullPath { get; }
Property Value
Type Description
string
| Edit this page View Source

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.

| Edit this page View Source

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 Source

ContainsFile(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 file parameter is null.

| Edit this page View Source

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 fileName parameter is null.

ArgumentEmptyException

Thrown when the fileName parameter is empty.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

Extension Methods

GorgonDebugExtensions.ValidateObject<T>(T, string)
GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author