Skip to content

Latest commit

 

History

History
65 lines (55 loc) · 9.83 KB

File metadata and controls

65 lines (55 loc) · 9.83 KB

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_SEPARATOR The directory separator. This is the character used to separate directory names.
ROOT_PATH The root path. This is the path used to identify the root directory.
Properties
ChangeHistory Gets the change history of the file system.
Directories Finds all directory nodes.
Files Finds all file nodes.
Index Gets 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.
IsEmpty Indicates whether the file system is empty. This is the case if the root directory is empty.
Root Gets the root directory of the file system. This is the entry point for all operations on the file system.
RootPath Gets 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
DirectoryCreated Event triggered when a directory is created.
DirectoryDeleted Event triggered when a directory is deleted.
DirectoryMoved Event triggered when a directory is moved.
DirectoryRenamed Event triggered when a directory is renamed.
FileCreated Event triggered when a file is created.
FileDeleted Event triggered when a file is deleted.
FileMoved Event triggered when a file is moved.
FileRenamed Event triggered when a file is renamed.