### Install Virtual File System via .NET CLI
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/README.md
Installs the Atypical.VirtualFileSystem NuGet package using the .NET command-line interface. This is the recommended way to add the library to your C# project.
```bash
dotnet add package Atypical.VirtualFileSystem
```
--------------------------------
### Add Virtual File System NuGet Package Reference to Project File
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/README.md
Adds a package reference for Atypical.VirtualFileSystem directly to a .NET project file (e.g., .csproj) using XML. This method is an alternative to the .NET CLI for package installation.
```xml
```
--------------------------------
### Register Virtual File System with IServiceCollection
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/ServiceCollectionExtensions.md
Documents the `AddVirtualFileSystem` extension method, which is used to register all necessary services for the virtual file system within the `IServiceCollection` dependency injection container. This method streamlines the setup process by encapsulating the service registration logic.
```APIDOC
Atypical.VirtualFileSystem.Core.Services.ServiceCollectionExtensions.AddVirtualFileSystem(this Microsoft.Extensions.DependencyInjection.IServiceCollection)
- Registers the virtual file system in the dependency injection container.
- Parameters:
- this IServiceCollection: The instance of IServiceCollection to which the virtual file system services will be added.
- Returns: The IServiceCollection instance, allowing for method chaining.
```
--------------------------------
### Define and Use VFSRootPath
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VirtualFileSystem.md
The `VFSRootPath` class represents the root directory of the virtual file system. It provides a constructor for initialization, a method to get its string representation, and an implicit operator for seamless conversion to a string. This class is fundamental for defining the base of the VFS hierarchy.
```APIDOC
VFSRootPath Class:
VFSRootPath(): Constructor
- Represents the root directory of the virtual file system.
ToString(): Method
- Returns a string that represents the current object.
- The string representation of the root directory is the constant ROOT_PATH.
- Returns: string (The string representation of the root path).
implicit operator string(VFSRootPath rootPath): Operator
- Implicit conversion to string.
- This allows you to use a VFSRootPath as a string.
- Parameters:
- rootPath: The VFSRootPath instance to convert.
- Returns: string (The string representation of the VFSRootPath).
```
--------------------------------
### Clone and Build Virtual File System from Source
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/README.md
Instructions to clone the Virtual File System repository from GitHub and build the project locally using the .NET CLI. This allows for development or using the latest unreleased features.
```bash
git clone
cd VirtualFileSystem
dotnet build
```
--------------------------------
### Get Message Property in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSDirectoryMovedArgs.Message.md
This property provides a message string. It is an override and returns a `System.String`.
```csharp
public override string Message { get; }
```
--------------------------------
### VirtualFileSystemFactory Class API Reference
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VirtualFileSystemFactory.md
Comprehensive API documentation for the `VirtualFileSystemFactory` class, detailing its constructor and the method available for creating instances of `IVirtualFileSystem`.
```APIDOC
VirtualFileSystemFactory Class API:
Constructors:
VirtualFileSystemFactory()
- Initializes a new instance of the VirtualFileSystemFactory class.
Methods:
CreateFileSystem()
- Creates a new instance of IVirtualFileSystem.
```
--------------------------------
### Get Message Property in C# for VFSFileCreatedArgs
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSFileCreatedArgs.Message.md
Retrieves the message associated with a virtual file system event. This property is read-only, overrides a base class implementation, and returns a System.String.
```csharp
public override string Message { get; }
```
--------------------------------
### VFS Core Methods for File and Directory Management
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFS.md
This section details the primary methods available in the Atypical Virtual File System (VFS) for managing files and directories, including operations for finding, getting, moving, renaming, and attempting to retrieve nodes.
```APIDOC
FindFiles(regex: System.Text.RegularExpressions.Regex) -> collection of file nodes
- Finds all file nodes that match the specified regular expression.
- Parameters:
- regex: The regular expression to match.
GetDirectory(path: Atypical.VirtualFileSystem.Core.VFSDirectoryPath) -> directory node
- Gets a directory node by its path. The path must be absolute.
- Parameters:
- path: The absolute path to the directory.
GetFile(path: Atypical.VirtualFileSystem.Core.VFSFilePath) -> file node
- Gets a file node by its path. The path must be absolute.
- Parameters:
- path: The absolute path to the file.
GetTree() -> file system tree structure
- Gets the tree of the file system.
MoveDirectory(sourcePath: Atypical.VirtualFileSystem.Core.VFSDirectoryPath, destinationPath: Atypical.VirtualFileSystem.Core.VFSDirectoryPath)
- Moves a directory from one location to another.
- Parameters:
- sourcePath: The current absolute path of the directory.
- destinationPath: The new absolute path for the directory.
MoveFile(sourcePath: Atypical.VirtualFileSystem.Core.VFSFilePath, destinationPath: Atypical.VirtualFileSystem.Core.VFSFilePath)
- Moves a file node from the source path to the destination path. Both paths must be absolute.
- Parameters:
- sourcePath: The current absolute path of the file.
- destinationPath: The new absolute path for the file.
RenameDirectory(path: Atypical.VirtualFileSystem.Core.VFSDirectoryPath, newName: string)
- Renames a directory.
- Parameters:
- path: The absolute path of the directory to rename.
- newName: The new name for the directory.
RenameFile(path: Atypical.VirtualFileSystem.Core.VFSFilePath, newName: string)
- Renames a file node at the specified path. The path must be absolute.
- Parameters:
- path: The absolute path of the file to rename.
- newName: The new name for the file.
ToString() -> string
- Returns a string that represents the current object.
TryGetDirectory(path: Atypical.VirtualFileSystem.Core.VFSDirectoryPath, out directory: Atypical.VirtualFileSystem.Core.Contracts.IDirectoryNode) -> bool
- 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`.
- Parameters:
- path: The absolute path to the directory.
- directory: (out) When this method returns, contains the directory node if found, or `null` if not found.
TryGetFile(path: Atypical.VirtualFileSystem.Core.VFSFilePath, out file: Atypical.VirtualFileSystem.Core.Contracts.IFileNode) -> bool
- Try to get a file node by its path. The path must be absolute.
- Parameters:
- path: The absolute path to the file.
- file: (out) When this method returns, contains the file node if found, or `null` if not found.
```
--------------------------------
### Create Virtual File System and Print ASCII Tree in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/README.md
Demonstrates how to initialize a virtual file system, create multiple files and directories programmatically, and then retrieve its hierarchical structure as an ASCII tree string using the `GetTree()` method. Directories are automatically created if they don't exist.
```csharp
// sample output (the order of the files is alphabetical)
string expected = """
vfs://
├── superheroes
│ ├── batman.txt
│ ├── superman.txt
│ └── wonderwoman.txt
├── villains
│ ├── joker.txt
│ ├── lexluthor.txt
│ └── penguin.txt
└── world
├── gotham.txt
├── metropolis.txt
└── themyscira.txt
""";
// create a virtual file system
IVirtualFileSystem vfs = new VFS()
// add some files (directories are created automatically)
.CreateFile("superheroes/batman.txt")
.CreateFile("superheroes/superman.txt")
.CreateFile("superheroes/wonderwoman.txt")
.CreateFile("villains/joker.txt")
.CreateFile("villains/lexluthor.txt")
.CreateFile("villains/penguin.txt")
.CreateFile("world/gotham.txt")
.CreateFile("world/metropolis.txt")
.CreateFile("world/themyscira.txt");
// get the string representation of the virtual file system
string tree = vfs.GetTree();
```
--------------------------------
### Get Path Property of VFSDirectoryCreatedArgs in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSDirectoryCreatedArgs.Path.md
This C# property, 'Path', is part of the 'VFSDirectoryCreatedArgs' class. It is a read-only property that returns an instance of 'VFSDirectoryPath', representing the path of the directory that was created.
```csharp
public Atypical.VirtualFileSystem.Core.VFSDirectoryPath Path { get; }
```
--------------------------------
### VFSPath Constructor API Documentation
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSPath.VFSPath(string).md
Detailed API documentation for the VFSPath constructor, including its purpose, parameters, and the exceptions it may throw during instantiation.
```APIDOC
VFSPath(string path) Constructor:
Description: Creates a new instance of VFSPath.
Signature: protected VFSPath(string path);
Parameters:
path:
Type: System.String
Description: The path to the file system entry.
Exceptions:
System.ArgumentNullException:
Description: Thrown when the path is null.
System.ArgumentException:
Description: Thrown when the path is invalid.
```
--------------------------------
### Get IsDirectory Property Value in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/DirectoryNode.IsDirectory.md
Retrieves a boolean value indicating whether the current node represents a directory. This property is read-only and overrides the base implementation from `IVirtualFileSystemNode`.
```csharp
public override bool IsDirectory { get; }
```
--------------------------------
### Get VFSPath IsRoot Property in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSPath.IsRoot.md
Retrieves a boolean value indicating whether the current VFSPath instance represents the root directory. This property is read-only and returns a System.Boolean.
```csharp
public bool IsRoot { get; }
```
--------------------------------
### DirectoryNode Constructor API Reference
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/DirectoryNode.DirectoryNode(VFSDirectoryPath).md
Comprehensive API documentation for the `DirectoryNode` class constructor. It details the constructor's purpose, the parameters it accepts, their types, and a description of each parameter, outlining how to create a new directory node with a specified path.
```APIDOC
DirectoryNode(VFSDirectoryPath directoryPath) Constructor
- Initializes a new instance of the DirectoryNode class.
- Creates a new directory node with the current date and time as creation and last modification date.
Parameters:
directoryPath: VFSDirectoryPath
- The path of the directory.
```
--------------------------------
### VFSDirectoryPath Class API Reference
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSDirectoryPath.md
Detailed API documentation for the `VFSDirectoryPath` class, including its constructor for initialization, the `ToString()` method for string representation, and implicit operators for seamless conversion between `VFSDirectoryPath` objects and strings.
```APIDOC
VFSDirectoryPath Class API Reference:
Constructors:
VFSDirectoryPath(string path)
- Description: Initializes a new instance of the VFSDirectoryPath class. The file path is relative to the root of the virtual file system.
- Parameters:
- path (string): The directory path.
Methods:
ToString()
- Description: Returns a string that represents the current object. The string representation of the directory path is the path itself.
- Returns: string - The string representation of the directory path.
Operators:
implicit operator VFSDirectoryPath(string path)
- Description: Implicit conversion from string to VFSDirectoryPath. This allows you to use a string as a VFSDirectoryPath.
- Parameters:
- path (string): The string to convert.
- Returns: VFSDirectoryPath - The converted directory path object.
implicit operator string(VFSDirectoryPath directoryPath)
- Description: Implicit conversion from VFSDirectoryPath to string. This allows you to use a VFSDirectoryPath as a string.
- Parameters:
- directoryPath (VFSDirectoryPath): The directory path object to convert.
- Returns: string - The string representation of the directory path.
```
--------------------------------
### Get Timestamp Property in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSFileCreatedArgs.Timestamp.md
Retrieves the timestamp when a virtual file system file was created. This read-only property returns a `System.DateTimeOffset` value, indicating the exact moment of file creation.
```csharp
public System.DateTimeOffset Timestamp { get; }
```
--------------------------------
### Initialize VirtualFileSystemFactory in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VirtualFileSystemFactory.VirtualFileSystemFactory().md
This constructor initializes a new instance of the `VirtualFileSystemFactory` class. It provides the default mechanism for creating virtual file system instances without requiring any parameters.
```csharp
public VirtualFileSystemFactory();
```
--------------------------------
### Get Message Property in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSDirectoryCreatedArgs.Message.md
This C# property getter retrieves the message associated with a `VFSDirectoryCreatedArgs` instance. It is a public, read-only property that overrides a base class member, returning a `System.String`.
```csharp
public override string Message { get; }
```
--------------------------------
### Get MessageTemplate Property in VFSDirectoryCreatedArgs
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSDirectoryCreatedArgs.MessageTemplate.md
This property provides the message template string for the `VFSDirectoryCreatedArgs` class. It is an override, indicating it inherits from a base class. The property is read-only.
```csharp
public override string MessageTemplate { get; }
```
--------------------------------
### VFSFilePath Class Constructor Documentation
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSFilePath.VFSFilePath(string).md
Documents the constructor for the `Atypical.VirtualFileSystem.Core.VFSFilePath` class, which initializes a new instance with a specified file path. The path is relative to the virtual file system root.
```APIDOC
VFSFilePath(string) Constructor:
Initializes a new instance of the VFSFilePath class.
The file path is relative to the root of the virtual file system.
Signature:
public VFSFilePath(string path);
Parameters:
path: System.String
The path of the file.
```
--------------------------------
### Get Root Path of Virtual File System in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/IVirtualFileSystem.RootPath.md
Retrieves the absolute path of the root directory within the virtual file system. This property is read-only and returns an instance of `VFSPath`.
```csharp
Atypical.VirtualFileSystem.Core.VFSPath RootPath { get; }
```
--------------------------------
### DirectoryNode Class API Reference
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/DirectoryNode.md
Comprehensive API documentation for the `DirectoryNode` class, detailing its constructors, properties, and methods. This includes how to initialize a directory node, access its child directories and files, and perform operations like adding or removing child nodes.
```APIDOC
DirectoryNode Class API:
Constructors:
DirectoryNode(VFSDirectoryPath path)
- Description: Initializes a new instance of the DirectoryNode class. Creates a new directory node with the current date and time as creation and last modification date.
- Parameters:
- path: The path of the directory.
Properties:
Directories
- Description: Gets the child directories of the node.
Files
- Description: Gets the child files of the node.
IsDirectory
- Description: Indicates whether the node is a directory.
IsFile
- Description: Indicates whether the node is a file.
Methods:
AddChild(IVirtualFileSystemNode childNode)
- Description: Adds a child node to the current directory.
- Parameters:
- childNode: The child node to add.
RemoveChild(IVirtualFileSystemNode childNode)
- Description: Removes a child node from the current directory.
- Parameters:
- childNode: The child node to remove.
ToString()
- Description: Returns a string that represents the path of the directory.
```
--------------------------------
### Get VFSPath Depth Property in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSPath.Depth.md
This C# property provides the hierarchical depth of a virtual file system entry. The root directory is at depth 0, and the depth increments for each level down the hierarchy.
```csharp
public int Depth { get; }
```
--------------------------------
### VFSRootPath Class API Reference
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSRootPath.md
Comprehensive API documentation for the `VFSRootPath` class, detailing its constructor, methods, and operators for managing the virtual file system's root directory.
```APIDOC
VFSRootPath Class
- Description: Represents the root directory of the virtual file system.
- Inheritance: System.Object → VFSPath → VFSDirectoryPath → VFSRootPath
- Implements: System.IEquatable
Constructors:
VFSRootPath()
- Description: Represents the root directory of the virtual file system.
Methods:
ToString()
- Description: Returns a string that represents the current object.
- Details: The string representation of the root directory is the constant ROOT_PATH.
Operators:
implicit operator string(VFSRootPath)
- Description: Implicit conversion to string.
- Details: This allows you to use a VFSRootPath as a string.
```
--------------------------------
### Manage VFSPath String Operations
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VirtualFileSystem.md
This section documents methods for performing string-based operations on `VFSPath` objects. It includes functionality to check if a path matches a regular expression or starts with a specific string. These methods are crucial for path validation and navigation within the virtual file system.
```APIDOC
VFSPath Methods:
IsMatch(Regex regex): Method
- Indicates whether the specified regular expression finds a match in the path.
- Parameters:
- regex: A System.Text.RegularExpressions.Regex object to match against the path.
- Returns: bool (true if a match is found, false otherwise).
StartsWith(string path): Method
- Determines whether the path starts with the specified path.
- Parameters:
- path: The string path to compare against the beginning of the current path.
- Returns: bool (true if the path starts with the specified string, false otherwise).
```
--------------------------------
### Get MessageTemplate Property in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSFileDeletedArgs.MessageTemplate.md
Retrieves the message template string from the `VFSFileDeletedArgs` class. This property is read-only and overrides a base class property, returning a `System.String`.
```csharp
public override string MessageTemplate { get; }
```
--------------------------------
### Create Virtual File System Instances
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VirtualFileSystem.md
The `VirtualFileSystemFactory` class is responsible for creating new instances of the `IVirtualFileSystem` interface. It offers a constructor to initialize the factory and a method to generate a new file system instance, serving as the entry point for VFS creation.
```APIDOC
VirtualFileSystemFactory Class:
VirtualFileSystemFactory(): Constructor
- Initializes a new instance of the VirtualFileSystemFactory class.
CreateFileSystem(): Method
- Creates a new instance of IVirtualFileSystem.
- Returns: IVirtualFileSystem (A new instance of the virtual file system).
```
--------------------------------
### Get VFS RootPath Property in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFS.RootPath.md
Retrieves the path of the root directory for the virtual file system. This read-only property returns an instance of `Atypical.VirtualFileSystem.Core.VFSPath`, which represents the absolute path of the root directory.
```csharp
public Atypical.VirtualFileSystem.Core.VFSPath RootPath { get; }
```
--------------------------------
### VFS Class API Reference
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFS.md
Comprehensive API documentation for the `Atypical.VirtualFileSystem.Core.VFS` class, detailing its constructor, constant fields, properties for accessing file system state, and methods for directory and file manipulation.
```APIDOC
VFS Class API Reference:
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)
- 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)
- Finds all file nodes that match the specified predicate.
```
--------------------------------
### Get OldName Property in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSFileRenamedArgs.OldName.md
Retrieves the old name of a file after it has been renamed. This property is part of the `VFSFileRenamedArgs` class, used in file system event arguments to provide context about the rename operation.
```csharp
public string OldName { get; }
```
--------------------------------
### Create Virtual File System Instance in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/IVirtualFileSystemFactory.CreateFileSystem().md
This method, part of the `IVirtualFileSystemFactory` interface, creates and returns a new instance of `IVirtualFileSystem`. It serves as the entry point for obtaining a virtual file system object.
```csharp
Atypical.VirtualFileSystem.Core.Contracts.IVirtualFileSystem CreateFileSystem();
```
--------------------------------
### Initialize VFSRootPath Constructor in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSRootPath.VFSRootPath().md
This constructor initializes a new instance of the `VFSRootPath` class, which represents the root directory of a virtual file system. It takes no parameters and sets up the foundational path for the VFS.
```csharp
public VFSRootPath();
```
--------------------------------
### Get SourcePath Property in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSDirectoryMovedArgs.SourcePath.md
This property, part of the `VFSDirectoryMovedArgs` class, provides the original path of a directory that has been moved within the virtual file system. It is a read-only property, returning a `VFSDirectoryPath` object.
```csharp
public Atypical.VirtualFileSystem.Core.VFSDirectoryPath SourcePath { get; }
```
--------------------------------
### VFSFilePath Class API Reference
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSFilePath.md
This section details the constructors, methods, and operators available for the `VFSFilePath` class, facilitating its instantiation, string representation, and implicit conversions.
```APIDOC
VFSFilePath Class API Reference:
Constructors:
VFSFilePath(string path)
- Description: Initializes a new instance of the VFSFilePath class.
- Parameters:
- path: The file path relative to the root of the virtual file system.
Methods:
ToString()
- Description: Returns a string that represents the current object.
- Returns: A string representing the file path relative to the root of the virtual file system.
Operators:
implicit operator VFSFilePath(string path)
- Description: Implicit conversion from string to VFSFilePath.
- Parameters:
- path: The string representation of the file path.
- Returns: A new VFSFilePath instance.
implicit operator string(VFSFilePath filePath)
- Description: Implicit conversion from VFSFilePath to string.
- Parameters:
- filePath: The VFSFilePath instance to convert.
- Returns: The string representation of the VFSFilePath.
```
--------------------------------
### Get UndoStack Property in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/IChangeHistory.UndoStack.md
This property provides read-only access to the collection of virtual file system events that can be undone. It represents the history of changes available for reversal within the virtual file system.
```csharp
System.Collections.Generic.IReadOnlyCollection UndoStack { get; }
```
--------------------------------
### Get Timestamp of Renamed File in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSFileRenamedArgs.Timestamp.md
This C# property, `Timestamp`, is part of the `VFSFileRenamedArgs` class. It provides a read-only `System.DateTimeOffset` value representing the exact time a virtual file system (VFS) file was renamed.
```csharp
public System.DateTimeOffset Timestamp { get; }
```
--------------------------------
### IVirtualFileSystemFactory Interface API Reference
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/IVirtualFileSystemFactory.md
This section provides a detailed API reference for the methods exposed by the `IVirtualFileSystemFactory` interface. It outlines the functionality, parameters, and return types for each method available for creating virtual file system instances.
```APIDOC
IVirtualFileSystemFactory Interface Methods:
CreateFileSystem()
- Description: Creates a new instance of IVirtualFileSystem.
- Returns: IVirtualFileSystem
```
--------------------------------
### Create a new Virtual File System instance in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VirtualFileSystemFactory.CreateFileSystem().md
This method creates and returns a new instance of `IVirtualFileSystem`. It is part of the `VirtualFileSystemFactory` class and provides a way to obtain a fully functional virtual file system.
```csharp
public Atypical.VirtualFileSystem.Core.Contracts.IVirtualFileSystem CreateFileSystem();
```
--------------------------------
### Get Message Property in VFSFileRenamedArgs (C#)
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSFileRenamedArgs.Message.md
This C# property getter retrieves the message associated with the VFSFileRenamedArgs event arguments. It is an overridden property that provides access to a string value representing the event's message.
```csharp
public override string Message { get; }
```
--------------------------------
### Get String Representation of VFSDirectoryPath
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSDirectoryPath.ToString().md
This method overrides the default `ToString()` method to return the string representation of the virtual file system directory path itself. It's a standard .NET method for object representation.
```csharp
public override string ToString();
```
--------------------------------
### IVirtualFileSystemFactory Interface Methods
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VirtualFileSystem.md
Defines a factory interface for creating instances of IVirtualFileSystem.
```APIDOC
IVirtualFileSystemFactory Interface:
CreateFileSystem() Method
- Description: Creates a new instance of IVirtualFileSystem.
- Returns: A new IVirtualFileSystem instance.
```
--------------------------------
### Get MessageTemplate Property in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSDirectoryDeletedArgs.MessageTemplate.md
This C# code snippet defines the MessageTemplate property, which is an override and returns a string. It is part of the VFSDirectoryDeletedArgs class, used within the Atypical.VirtualFileSystem.Core namespace to provide a message template.
```csharp
public override string MessageTemplate { get; }
```
--------------------------------
### VFSPath Class API Reference
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSPath.md
Comprehensive API documentation for the `VFSPath` abstract class, detailing its constructors, properties, and methods for managing virtual file system paths within the Atypical.VirtualFileSystem.Core library.
```APIDOC
VFSPath Class:
Represents a file system entry (file or directory) in the virtual file system.
Inherits from System.Object.
Derived by VFSDirectoryPath, VFSFilePath.
Implements System.IComparable, System.IEquatable.
Constructors:
VFSPath(string pathValue)
- Description: Creates a new instance of VFSPath.
- Parameters:
- pathValue: The string representation of the path.
Properties:
Depth: int
- Description: Gets the depth of the file system entry. The root directory has a depth of 0. The depth of a file is the depth of its parent directory plus one. The depth of a directory is the depth of its parent directory plus one.
HasParent: bool
- Description: Indicates whether the path has a parent directory.
IsRoot: bool
- Description: Gets a value indicating whether the directory is the root directory.
Name: string
- Description: Gets the name of the file system entry. The name of the root directory is ROOT_PATH. The name of a file is the name of the file with its extension.
Parent: VFSPath
- Description: Gets the path of the parent directory.
Value: string
- Description: Gets the path of the file system entry with the VFS prefix.
Methods:
Equals(VFSPath other): bool
- Description: Indicates whether the current object is equal to another object of the same type.
- Parameters:
- other: The VFSPath object to compare with.
- Returns: True if the objects are equal, false otherwise.
GetAbsoluteParentPath(int depthFromRoot): VFSPath
- Description: Gets the absolute path of the parent directory with specified depth from root. The root directory has a depth of 0. The depth of a file is the depth of its parent directory plus one. The depth of a directory is the depth of its parent directory plus one.
- Parameters:
- depthFromRoot: The desired depth from the root directory.
- Returns: The VFSPath object representing the parent directory at the specified depth.
GetHashCode(): int
- Description: Serves as the default hash function.
- Returns: A hash code for the current object.
IsMatch(Regex regex): bool
- Description: Indicates whether the specified regular expression finds a match in the path.
- Parameters:
- regex: The regular expression to match against the path.
- Returns: True if a match is found, false otherwise.
StartsWith(string prefix): bool
- Description: Determines whether the path starts with the specified path.
- Parameters:
- prefix: The string to compare the beginning of the path with.
- Returns: True if the path starts with the prefix, false otherwise.
```
--------------------------------
### Initialize ChangeHistory Class with Virtual File System
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/ChangeHistory.ChangeHistory(IVirtualFileSystem).md
This constructor initializes a new instance of the `ChangeHistory` class. It requires an `IVirtualFileSystem` instance, which it then tracks for changes. This is the primary entry point for setting up change tracking within the virtual file system.
```APIDOC
ChangeHistory(IVirtualFileSystem) Constructor
Description: Initializes a new instance of the ChangeHistory class.
Signature:
public ChangeHistory(Atypical.VirtualFileSystem.Core.Contracts.IVirtualFileSystem vfs);
Parameters:
vfs: IVirtualFileSystem
Description: The virtual file system to track changes of.
```
--------------------------------
### Get Timestamp of Virtual Directory Creation in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSDirectoryCreatedArgs.Timestamp.md
This property retrieves the exact `System.DateTimeOffset` when a virtual directory was created. It is a read-only property, providing the creation timestamp for events related to virtual file system directory creation.
```csharp
public System.DateTimeOffset Timestamp { get; }
```
--------------------------------
### Get Directory Node by Path in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFS.GetDirectory(VFSDirectoryPath).md
Defines the C# method signature for retrieving a directory node from the virtual file system using its absolute path. The method returns an `IDirectoryNode` interface.
```csharp
public Atypical.VirtualFileSystem.Core.Contracts.IDirectoryNode GetDirectory(Atypical.VirtualFileSystem.Core.VFSDirectoryPath directoryPath);
```
--------------------------------
### VirtualFileSystemException Constructor (C#)
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VirtualFileSystemException.VirtualFileSystemException(string).md
Documents the constructor for the `VirtualFileSystemException` class, including its signature and parameter details for initializing the exception with a specific error message.
```APIDOC
VirtualFileSystemException(string message) Constructor
Initializes a new instance of the Atypical.VirtualFileSystem.Core.VirtualFileSystemException class with a message that describes the error.
Signature:
public VirtualFileSystemException(string message);
Parameters:
message: System.String
The error message that explains the reason for the exception.
```
--------------------------------
### Get MessageWithMarkup Property in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSFileRenamedArgs.MessageWithMarkup.md
This C# code snippet defines the `MessageWithMarkup` property within the `VFSFileRenamedArgs` class. It is an overridden property that returns a string, providing a message with markup for a virtual file system file renamed event.
```csharp
public override string MessageWithMarkup { get; }
```
--------------------------------
### VFS.CreateDirectory Method API Documentation
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFS.CreateDirectory(VFSDirectoryPath).md
Comprehensive API documentation for the `CreateDirectory` method within the `Atypical.VirtualFileSystem.Core.VFS` class, used for creating directory nodes in a virtual file system. The path provided must be absolute.
```APIDOC
VFS.CreateDirectory(VFSDirectoryPath) Method:
Description: Creates a directory node at the specified path. The path must be absolute.
Signature:
public Atypical.VirtualFileSystem.Core.Contracts.IVirtualFileSystem CreateDirectory(Atypical.VirtualFileSystem.Core.VFSDirectoryPath directoryPath);
Parameters:
- directoryPath:
Type: VFSDirectoryPath
Description: The path of the directory node.
Returns:
- Type: IVirtualFileSystem
Description: The file system.
```
--------------------------------
### Get Destination Path of Moved Directory in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSDirectoryMovedArgs.DestinationPath.md
This C# property provides read-only access to the destination path of a virtual file system directory that has been moved. It returns an instance of `VFSDirectoryPath`, representing the new location of the directory.
```csharp
public Atypical.VirtualFileSystem.Core.VFSDirectoryPath DestinationPath { get; }
```
--------------------------------
### IVFSCreate Interface Methods and Events API Documentation
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/IVFSCreate.md
Comprehensive API documentation for the `IVFSCreate` interface, detailing its methods for creating virtual file system nodes and the events triggered upon successful creation. This includes `CreateDirectory`, `CreateFile` methods, and `DirectoryCreated`, `FileCreated` events.
```APIDOC
IVFSCreate Interface:
Methods:
CreateDirectory(VFSDirectoryPath path)
- Description: Creates a directory node at the specified path. The path must be absolute.
- Parameters:
- path: The absolute path for the new directory (VFSDirectoryPath).
CreateFile(VFSFilePath path, string content)
- Description: Creates a file node at the specified path. The path must be absolute.
- Parameters:
- path: The absolute path for the new file (VFSFilePath).
- content: The string content of the file.
Events:
DirectoryCreated
- Description: Event triggered when a directory is created.
FileCreated
- Description: Event triggered when a file is created.
```
--------------------------------
### Get MessageWithMarkup Property in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSDirectoryCreatedArgs.MessageWithMarkup.md
Retrieves the `MessageWithMarkup` property from the `VFSDirectoryCreatedArgs` class. This property provides a string representation of a message, potentially including markup, and is read-only, indicating its value is set internally or at object creation.
```csharp
public override string MessageWithMarkup { get; }
```
--------------------------------
### Get String Representation of DirectoryNode Path in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/DirectoryNode.ToString().md
This method overrides the default `ToString()` method to return the full path of the directory node as a string. It is useful for debugging or displaying the directory's location.
```C#
public override string ToString();
```
--------------------------------
### VFSEventArgs.ToMarkup Method API Reference
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSEventArgs.ToMarkup(string,object[]).md
Comprehensive API documentation for the `ToMarkup` method, detailing its purpose, parameters (color and arguments), and the type of the returned markup message.
```APIDOC
VFSEventArgs.ToMarkup(string color, object[] args)
- Transforms a message into a markup message with the specified color.
- Parameters:
- color: System.String
The color to use in the markup.
- args: System.Object[]
The arguments to format the message.
- Returns: System.String
The markup message.
```
--------------------------------
### Get VFSPath Value Property in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSPath.Value.md
This C# property, `Value`, is part of the `Atypical.VirtualFileSystem.Core.VFSPath` class. It provides read-only access to the full path of a virtual file system entry, including its VFS prefix. The property returns a `System.String`.
```csharp
public string Value { get; }
```
--------------------------------
### VirtualFileSystemException Class Constructors API
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VirtualFileSystemException.md
API documentation for the constructors of the `VirtualFileSystemException` class. It details how to initialize new instances of this exception, including options for providing a custom error message and/or an inner exception.
```APIDOC
VirtualFileSystemException()
- Initializes a new instance of the VirtualFileSystemException class.
VirtualFileSystemException(message: string, innerException: Exception)
- Initializes a new instance of the VirtualFileSystemException class with a message and an inner exception that is the cause of this exception.
- Parameters:
- message: string - The error message.
- innerException: Exception - The inner exception that caused this exception.
VirtualFileSystemException(message: string)
- Initializes a new instance of the VirtualFileSystemException class with a message that describes the error.
- Parameters:
- message: string - The error message.
```
--------------------------------
### Get Parent Directory Path in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSPath.Parent.md
This property retrieves the path of the parent directory for a given virtual file system path. It returns a `VFSDirectoryPath` object, which can be null if the current path represents the root directory.
```csharp
public Atypical.VirtualFileSystem.Core.VFSDirectoryPath? Parent { get; }
```
--------------------------------
### DirectoryNode Constructor C# Signature
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/DirectoryNode.DirectoryNode(VFSDirectoryPath).md
This snippet presents the C# constructor signature for the `DirectoryNode` class. It shows how a new instance of a directory node is initialized by providing a virtual file system directory path.
```csharp
public DirectoryNode(Atypical.VirtualFileSystem.Core.VFSDirectoryPath directoryPath);
```
--------------------------------
### C# VFSNode Path Property Definition
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSNode.Path.md
Defines the `Path` property for the `VFSNode` class. This property is used to get or set the virtual file system path of a node. It implements the `Path` contract from `IVirtualFileSystemNode` and is typed as `Atypical.VirtualFileSystem.Core.VFSPath`.
```csharp
public Atypical.VirtualFileSystem.Core.VFSPath Path { get; set; }
```
--------------------------------
### API Documentation for VFSIndex.GetPathsStartingWith Method
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSIndex.GetPathsStartingWith(VFSDirectoryPath).md
Comprehensive API documentation for the `GetPathsStartingWith` method within the `Atypical.VirtualFileSystem.Core.VFSIndex` class. This method is used to retrieve an immutable array of virtual file system paths that begin with a specified directory path.
```APIDOC
VFSIndex.GetPathsStartingWith(VFSDirectoryPath) Method
public System.Collections.Immutable.ImmutableArray GetPathsStartingWith(Atypical.VirtualFileSystem.Core.VFSDirectoryPath directoryPath);
- Description: Gets the paths starting with the specified directory path.
- Parameters:
- directoryPath: VFSDirectoryPath - The directory path to use as a prefix for filtering paths.
- Returns: System.Collections.Immutable.ImmutableArray - An immutable array containing VFSPath objects that start with the provided directory path.
```
--------------------------------
### Get Source Path of Renamed File in VFSFileRenamedArgs (C#)
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSFileRenamedArgs.Path.md
This property retrieves the original path of a file after it has been renamed within the virtual file system. It is a read-only property that returns an instance of `VFSFilePath`, representing the file's source path.
```csharp
public Atypical.VirtualFileSystem.Core.VFSFilePath Path { get; }
```
--------------------------------
### VirtualFileSystemException Constructor API Reference
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VirtualFileSystemException.VirtualFileSystemException(string,Exception).md
Documents the constructor for the `VirtualFileSystemException` class, detailing its parameters and their purpose for initializing an exception with a specific message and an inner exception.
```APIDOC
VirtualFileSystemException(string message, System.Exception innerException)
- Initializes a new instance of the VirtualFileSystemException class with a message and an inner exception that is the cause of this exception.
- Parameters:
- message: System.String
The error message that explains the reason for the exception.
- innerException: System.Exception
The exception that is the cause of the current exception, or a null reference if no inner exception is specified.
```
--------------------------------
### Get MessageTemplate Property Definition in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSDirectoryMovedArgs.MessageTemplate.md
Defines the `MessageTemplate` property as a read-only string within the `VFSDirectoryMovedArgs` class. This property overrides a base class member, providing a specific message template for directory moved events.
```csharp
public override string MessageTemplate { get; }
```
--------------------------------
### VFSNode Class API Reference
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VFSNode.md
Comprehensive API documentation for the `Atypical.VirtualFileSystem.Core.VFSNode` abstract class, detailing its constructor, properties, and methods. This class forms the fundamental building block for representing files and directories in a virtual file system, providing common attributes and operations.
```APIDOC
VFSNode Class API Reference:
Constructors:
- VFSNode(VFSPath path)
- Description: Initializes a new instance of the VFSNode class. This constructor is used by derived classes.
- Parameters:
- path: The VFSPath for the node.
Properties:
- CreationTime: DateTimeOffset
- Description: Gets the creation time of the node.
- IsDirectory: bool
- Description: Indicates whether the node is a directory.
- IsFile: bool
- Description: Indicates whether the node is a file.
- LastAccessTime: DateTimeOffset
- Description: Gets the last access time of the node.
- LastWriteTime: DateTimeOffset
- Description: Gets the last write time of the node.
- Path: VFSPath
- Description: Gets the path of the node.
Methods:
- UpdatePath(VFSPath newPath)
- Description: Updates the path of the node.
- Parameters:
- newPath: The new VFSPath for the node.
```
--------------------------------
### VFSNode Class Definition and Properties
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/VirtualFileSystem.md
This documentation outlines the VFSNode class, which serves as the base for all virtual file system entries (files and directories). It details its constructor, properties like creation time, type indicators, and methods for path updates.
```APIDOC
VFSNode Class:
Description: Represents a node in a virtual file system. A node can be a file or a directory.
VFSNode(VFSPath) Constructor
- Description: Initializes a new instance of the VFSNode class. This constructor is used by derived classes.
- Parameters:
- VFSPath: The path of the node.
CreationTime Property
- Description: Gets the creation time of the node.
IsDirectory Property
- Description: Indicates whether the node is a directory.
IsFile Property
- Description: Indicates whether the node is a file.
LastAccessTime Property
- Description: Gets the last access time of the node.
LastWriteTime Property
- Description: Gets the last write time of the node.
Path Property
- Description: Gets the creation time of the node.
UpdatePath(VFSPath) Method
- Description: Updates the path of the node.
- Parameters:
- VFSPath: The new path for the node.
```
--------------------------------
### Get Root Directory Property in C#
Source: https://github.com/atypical-consulting/virtualfilesystem/blob/main/docs/api/IVirtualFileSystem.Root.md
Defines the `Root` property within the `IVirtualFileSystem` interface, which provides access to the file system's root directory. This property is read-only and returns an object implementing the `IRootNode` interface.
```csharp
Atypical.VirtualFileSystem.Core.Contracts.IRootNode Root { get; }
```