static public IFileStoreReader WithMappedPath( this IFileStoreReader originalFileStore, System.Func <IImmutableList <string>, IImmutableList <string> > pathMap) => new DelegatingFileStoreReader { GetFileContentDelegate = originalPath => originalFileStore.GetFileContent(pathMap(originalPath)), ListFilesInDirectoryDelegate = originalPath => originalFileStore.ListFilesInDirectory(pathMap(originalPath)), };
static public IFileStoreReader ForSubdirectory( this IFileStoreReader originalFileStore, string directoryName) => WithMappedPath(originalFileStore, originalPath => originalPath.Insert(0, directoryName));
static public IFileStoreReader ForSubdirectory( this IFileStoreReader originalFileStore, IEnumerable <string> directoryPath) => WithMappedPath(originalFileStore, originalPath => originalPath.InsertRange(0, directoryPath));
static public IFileStoreReader ForSubdirectory(this IFileStoreReader originalFileStore, string directoryName) => ForSubdirectory(originalFileStore, ImmutableList.Create(directoryName));
static public IEnumerable <IImmutableList <string> > ListFiles(this IFileStoreReader fileStore) => fileStore.ListFilesInDirectory(ImmutableList <string> .Empty);
public FileStoreFromWriterAndReader(IFileStoreWriter writer, IFileStoreReader reader) { this.writer = writer; this.reader = reader; }