Skip to content
Marek Fišera edited this page Sep 2, 2016 · 5 revisions

FileSystems provides abstraction of file system. Whole module is based on Models.Features, so contracts are separated into small features and implementations can implement only supported one. All features are places in namespace Neptuo.FileSystems.Features. There are features for

  • Enumerating and searching for directories and files.
  • Creating, reading and modifying files and directories.

Wrapper around System.IO file system is placed in project Neptuo.FileSystems.Local. From version 1.0.1 there are also extension methods for simple calling feature contracts.

Reading file system structure

For reading structure of file system there are feature interfaces IDirectoryEnumerator, for enumerating directories, and IFileEnumerator, for enumerating files, that are contained in current folder.

For advanced file and directory searching there are feature instances in namespace Neptuo.FileSystems.Features.Searching. These contracts enables searching directly in content of directory or in the whole file system sub-tree.

File content

Working with file content is splitted into three interface features:

  • IFileContentReader is for reading content of file.
  • IFileContentAppender is for appending content at the end of already existing content.
  • IFileContentUpdater is for overriding file content.

All these contracts are asynchronous with extension methods that run synchronously.

Creating and deleting files and folders

For creating file there is IFileCreator which is typically implemented by directory implementation. This file creator creates files in concrete directory. Same design is used for creating directories by IDirectoryCreator.

For deleting files and directories there is IFileDeleter and IDirectoryDeleter which deletes current file or directory.

Events

In namespace Neptuo.FileSystems.Events are defined event objects (compatible with Events) for subscription of notifications about changes in file system.

Local (using FileSystemWatcher) dispatcher of these events is implemented in package Neptuo.FileSystems.Events.Local, but currently the only supported events are those for file changes. Directory change events are not supported by now.

Clone this wiki locally