private void GetDirInfo() { var di = new DirectoryInfo(FullPath); Name = di.Name; Created = di.CreationTime; LastWrite = di.LastWriteTime; var dirs = Directory.EnumerateDirectories(FullPath).AsParallel(); var files = Directory.EnumerateFiles(FullPath); if (dirs.Count() == 0 && files.Count() == 0) { TerminalLeaf = true; } if (dirs.Count() > 0) { foreach (var d in dirs) { ChildDirectories.Add(Path.GetFileName(d)); } } if (files.Count() > 0) { foreach (var f in files) { ChildFiles.Add(Path.GetFileName(f)); } } }
public IFile GetFile(string fileName) { InMemoryFile file; lock (ChildFiles) { file = ChildFiles.FirstOrDefault(x => x.Name.Equals(fileName, _stringComparison)); if (file == null) { file = new InMemoryFile(Path.Combine(fileName).FullPath) { Parent = this }; ChildFiles.Add(file); } file.FileSystem = FileSystem; } return(file); }