using System; using System.Collections.Generic; using ZXL.Helper; namespace ZXLT.FileSystem { class FileBase { } class Directory : FileBase { DirectoryInfo directoryInfo; List directories = new List(); List files = new List(); public Directory(DirectoryInfo directoryInfo) { this.directoryInfo = directoryInfo; } public void AddDirectory(Directory dir) { directories.Add(dir); } public void AddFile(File file) { files.Add(file); } public void RemoveDirectory(Directory dir) { directories.Remove(dir); } public void RemoveFile(File file) { files.Remove(file); } public void Clear() { directories.Clear(); } } class File : FileBase { FileInfo fileInfo; public File(FileInfo fileInfo) { this.fileInfo = fileInfo; } } interface IFileSystem { event Action OnUpdateFileSystem; void CreateDirectory(string path); void DeleteDirectory(string path); void DeleteFile(string path); void MoveDirectory(string sourcePath, string destPath); void MoveFile(string sourcePath, string destPath); void RenameDirectory(string sourcePath, string destPath); void RenameFile(string sourcePath, string destPath); } public class FileSystem : IFileSystem { Directory rootDirectory; SortedDictionary fileBases = new SortedDictionary(); public event Action OnUpdateFileSystem; void UpdateFileSystem(FileSystemInfo systemInfo) { OnUpdateFileSystem?.Invoke(systemInfo); } public void CreateDirectory(string path) { var directory = new Directory(new DirectoryInfo(path)); fileBases.Add(path, directory); FileHelper.CreateDirectory(path); } public void CreateFile(string path) { var file = new File(new FileInfo(path)); fileBases.Add(path, file); FileHelper.CreateDirectory(path); } public void DeleteDirectory(string path) { throw new NotImplementedException(); } public void DeleteFile(string path) { throw new NotImplementedException(); } public void MoveDirectory(string sourcePath, string destPath) { throw new NotImplementedException(); } public void MoveFile(string sourcePath, string destPath) { throw new NotImplementedException(); } public void RenameDirectory(string sourcePath, string destPath) { throw new NotImplementedException(); } public void RenameFile(string sourcePath, string destPath) { throw new NotImplementedException(); } } }