A virtual file system implementation in modern C# with comprehensive demo applications.
- ๐ Table of Contents
- ๐ Introduction
- ๐ Features
- ๐ฎ Demo Applications
- ๐ Documentation
- ๐ฅ Installation
- ๐ Use cases
- ๐ค Contributing
- ๐ License
- ๐ฌ Contact
- ๐ Acknowledgements
- ๐ Change log
- โจ Contributors
When writing applications in .NET, you often need to write or read the contents of a file. .NET provides System.IO
namespace dedicated to this purpose. But how do we deal with the filesystem when testing our code?
Virtual File System is an attempt to solve this problem. This library provides a comprehensive virtual file system implementation with full CRUD operations, event-driven architecture, and undo/redo functionality.
๐ฎ New! Check out our interactive Blazor demo application that showcases all VFS features in a professional web interface!
A virtual file system is a data structure that represents a file system in memory. It is used to simulate a file system on a computer. It is useful for testing purposes, for example, when you want to test a file system without actually creating files on the hard drive.
- Create a virtual file system
- Create a virtual file or directory
- Print the contents of a virtual file system as a tree
- Delete a virtual file or directory
- Move a virtual file or directory
- Rename a virtual file or directory
- Read and write content to a virtual file
- Check if a virtual file or directory exists (
TryGetFile,TryGetDirectory) - Get the size of a virtual file or directory (via
Content.Lengthand enumeration) - Get the creation, access, and modification times of a virtual file or directory
- Support for events (file created, file deleted, etc.)
- Support for undo/redo operations with change history
- Advanced search capabilities (by name, content, regex patterns)
- File system analytics and insights
- Copy a virtual file or directory (planned)
- Support for custom metadata on files and directories (planned)
- Support for file and directory permissions (planned)
- Support for symbolic links (planned)
- ...
The Virtual File System library includes comprehensive demo applications that showcase its capabilities in real-world scenarios.
A professional, full-featured web application built with Blazor Server and MudBlazor that provides an interactive demonstration of all VFS features.
# Navigate to the demo application
cd src/Atypical.VirtualFileSystem.DemoBlazorApp
# Run the demo application
dotnet run
# Open your browser to https://localhost:5040The Blazor demo application includes:
- ๐ Dashboard - Welcome page with file system overview and quick actions
- ๐ File Operations - Create, modify, delete files and directories with real-time feedback
- ๐ Advanced Search - Multi-criteria search (name, content, regex patterns, file extensions)
- โ๏ธ File Editor - Full-featured text editor with find/replace, save/reload functionality
- ๐ Analytics - Comprehensive file system analysis with metrics and insights
- ๐ History Management - Visual undo/redo operations with operation tracking
- ๐ Event Monitoring - Real-time event stream with categorized statistics
- ๐ก Responsive Design - Mobile-friendly interface with professional UI/UX
- ๐จ Modern UI - Built with MudBlazor components and Material Design principles
- Event-driven architecture with real-time updates
- State management across components with proper synchronization
- Professional UX with loading states, error handling, and user feedback
- Accessibility support with ARIA labels and keyboard navigation
- Responsive design that works seamlessly on desktop and mobile devices
A command-line interface demonstration showcasing basic VFS operations:
# Navigate to the CLI demo
cd src/Atypical.VirtualFileSystem.DemoCli
# Run the CLI demo
dotnet runThe CLI demo demonstrates file system operations, tree visualization, and event handling in a console environment.
Virtual File System provides a COMPLETE DOCUMENTATION of the library.
All summaries are written in English. If you want to help us translate the documentation, please open an issue to discuss it.
Note: The documentation is generated using Doraku/DefaultDocumentation tool. It is generated automatically when the project is built.
- .NET 6.0 or higher (supported versions: 6.x to 9.x)
- For the Blazor demo: .NET 9.0 or higher
- A C# IDE (Visual Studio, Rider, etc.)
- A C# compiler (dotnet CLI, etc.)
This library targets .NET 8.0 and uses the latest C# features. It is written in C# 12.0 and uses the new init
properties, record types, switch expressions, using declarations and more.
The Blazor demo application showcases modern .NET 9 features and demonstrates real-world usage patterns.
I invite you to read the C# 12.0 documentation to learn more about these features.
VirtualFileSystem is available on NuGet.
You can install it using the .NET CLI:
dotnet add package Atypical.VirtualFileSystemor by adding a package reference to your project file:
<PackageReference Include="Atypical.VirtualFileSystem" Version="0.3.0" />You can also clone the repository and build the project yourself.
git clone
cd VirtualFileSystem
dotnet build// 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();Contributions are welcome! Please read the CONTRIBUTION GUIDELINES first.
This project is licensed under the terms of the BSD-3-Clause license. If you use this library in your project, please consider adding a link to this repository in your project's README.
This project is maintained by Atypical Consulting. If you need help with this project, please contact us from this repository by opening an issue.
You can contact us by opening an issue on this repository.
Please see RELEASES for more information what has changed recently.