using System.Collections.Generic; namespace ZXLT.FileSystem { public sealed class DirectoryInfo : FileSystemInfo { // List directories = new List(); // List files = new List(); public override bool Exists { get; } public override string Name => _name; public override FileSystemInfoType FileSystemInfoType { get; } public DirectoryInfo Parent { get { var parentPath = FullPath.Split("\\")[^1]; var directoryInfo = new DirectoryInfo(System.IO.Path.GetFullPath(parentPath)); return directoryInfo; } } public DirectoryInfo Root => new DirectoryInfo(System.IO.Path.GetPathRoot(this.FullPath)); public DirectoryInfo(string path) { FullPath = System.IO.Path.GetFullPath(path); _name = System.IO.Path.GetDirectoryName(path); } // public DirectoryInfo[] GetDirectories() // { // return directories.ToArray(); // } // // public FileInfo[] GetFiles() // { // return files.ToArray(); // } } }