public DirectoryInMemory(DirectoryInfo directoryInfo, ILogger logger) { DirectoryInfo = directoryInfo; Logger = logger; try { foreach (FileSystemInfo fileSystemInfo in DirectoryInfo.EnumerateFileSystemInfos()) { if (fileSystemInfo is DirectoryInfo subDirectoryInfo) { DirectoryInMemory directoryInMemory = new DirectoryInMemory(subDirectoryInfo, logger, this); SubDirectories.Add(directoryInMemory); } else if (fileSystemInfo is FileInfo fileInfo) { FileInMemory fileInMemory = new FileInMemory(fileInfo, this); Files.Add(fileInMemory); } } } catch (Exception e) { Logger.LogWarning($"Cannot read contents of \"{directoryInfo.FullName}\"", e); } }
internal void RemoveFile(FileInMemory fileInMemory) { Files.Remove(fileInMemory); }