static public IFileStoreWriter WithMappedPath( this IFileStoreWriter originalFileStore, System.Func <IImmutableList <string>, IImmutableList <string> > pathMap) => new DelegatingFileStoreWriter { SetFileContentDelegate = pathAndFileContent => originalFileStore.SetFileContent(pathMap(pathAndFileContent.path), pathAndFileContent.fileContent), AppendFileContentDelegate = pathAndFileContent => originalFileStore.AppendFileContent(pathMap(pathAndFileContent.path), pathAndFileContent.fileContent), DeleteFileDelegate = originalPath => originalFileStore.DeleteFile(pathMap(originalPath)), };
static public IFileStoreWriter ForSubdirectory( this IFileStoreWriter originalFileStore, string directoryName) => WithMappedPath(originalFileStore, originalPath => originalPath.Insert(0, directoryName));
static public IFileStoreWriter ForSubdirectory(this IFileStoreWriter originalFileStore, string directoryName) => ForSubdirectory(originalFileStore, ImmutableList.Create(directoryName));
static public IFileStoreWriter ForSubdirectory( this IFileStoreWriter originalFileStore, IEnumerable <string> directoryPath) => WithMappedPath(originalFileStore, originalPath => originalPath.InsertRange(0, directoryPath));
public FileStoreFromWriterAndReader(IFileStoreWriter writer, IFileStoreReader reader) { this.writer = writer; this.reader = reader; }