VFS.md

January 20, 2026 · View on GitHub

Atypical.VirtualFileSystem.Core

Atypical.VirtualFileSystem.Core

VFS Class

Constants used by the Virtual File System.

public record VFS : Atypical.VirtualFileSystem.Core.Contracts.IVirtualFileSystem, Atypical.VirtualFileSystem.Core.Contracts.IVFSCreate, Atypical.VirtualFileSystem.Core.Contracts.IVFSDelete, Atypical.VirtualFileSystem.Core.Contracts.IVFSMove, Atypical.VirtualFileSystem.Core.Contracts.IVFSRename, System.IEquatable<Atypical.VirtualFileSystem.Core.VFS>

Inheritance System.Object 🡒 VFS

Implements IVirtualFileSystem, IVFSCreate, IVFSDelete, IVFSMove, IVFSRename, System.IEquatable<VFS>

Constructors
VFS()Initializes a new instance of the VFS class.
Fields
DIRECTORY_SEPARATORThe directory separator. This is the character used to separate directory names.
ROOT_PATHThe root path. This is the path used to identify the root directory.
Properties
ChangeHistoryGets the change history of the file system.
DirectoriesFinds all directory nodes.
FilesFinds all file nodes.
IndexGets the file index of the file system. Basically, this is a dictionary that maps file paths to file nodes. This is useful for quickly finding a file node by its path.
IsEmptyIndicates whether the file system is empty. This is the case if the root directory is empty.
RootGets the root directory of the file system. This is the entry point for all operations on the file system.
RootPathGets the path of the root directory.
Methods
CreateDirectory(VFSDirectoryPath)Creates a directory node at the specified path. The path must be absolute.
CreateFile(VFSFilePath, string)Creates a file node at the specified path. The path must be absolute.
DeleteDirectory(VFSDirectoryPath)Deletes a directory node at the specified path. The path must be absolute.
DeleteFile(VFSFilePath)Deletes a file node at the specified path. The path must be absolute.
FindDirectories(Func<IDirectoryNode,bool>)Finds all directory nodes that match the specified predicate.
FindDirectories(Regex)Finds all directory nodes that match the specified regular expression. The regular expression must be relative to the root directory.
FindFiles(Func<IFileNode,bool>)Finds all file nodes that match the specified predicate.
FindFiles(Regex)Finds all file nodes that match the specified regular expression.
GetDirectory(VFSDirectoryPath)Gets a directory node by its path. The path must be absolute.
GetFile(VFSFilePath)Gets a file node by its path. The path must be absolute.
GetTree()Gets the tree of the file system.
MoveDirectory(VFSDirectoryPath, VFSDirectoryPath)Moves a directory from one location to another.
MoveFile(VFSFilePath, VFSFilePath)Moves a file node from the source path to the destination path. Both paths must be absolute.
RenameDirectory(VFSDirectoryPath, string)Renames a directory.
RenameFile(VFSFilePath, string)Renames a file node at the specified path. The path must be absolute.
ToString()Returns a string that represents the current object.
TryGetDirectory(VFSDirectoryPath, IDirectoryNode)Try to get a directory node by its path. The path must be absolute. If the directory node does not exist, this method returns false and directory is set to null.
TryGetFile(VFSFilePath, IFileNode)Try to get a file node by its path. The path must be absolute.
Events
DirectoryCreatedEvent triggered when a directory is created.
DirectoryDeletedEvent triggered when a directory is deleted.
DirectoryMovedEvent triggered when a directory is moved.
DirectoryRenamedEvent triggered when a directory is renamed.
FileCreatedEvent triggered when a file is created.
FileDeletedEvent triggered when a file is deleted.
FileMovedEvent triggered when a file is moved.
FileRenamedEvent triggered when a file is renamed.