public List<DirectoryItem> ListDirectory() { if (!exist) { throw new System.IO.DirectoryNotFoundException(); } var ret = new List<DirectoryItem>(); var list = DirectoryBase.ListItems(Disk.iNodes[inodeIndex]); foreach (var pair in list) { var item = new DirectoryItem(pair.Key, this.path + pair.Key, pair.Value); ret.Add(item); } return ret; }
public DokanError GetFileInformation(string fileName, out FileInformation fileInfo, DokanFileInfo info) { //Console.WriteLine("GetFileInformation: {0}, isDirectory = {1}", fileName, info.IsDirectory); if (fileName == "\\" || info.IsDirectory) { Directory dir = new Directory(fileName); if (!dir.Exists()) { //Console.WriteLine("GetFileInformation: PathNotFound"); fileInfo = new FileInformation(); return DokanError.ErrorPathNotFound; } String name; String path; if (fileName == "\\") { name = "\\"; path = "\\"; } else { name = Util.GetPathFileName(fileName); path = fileName; } fileInfo = new DirectoryItem(name, path, dir.GetSelfINodeIndex()).GetFileInformation(); //Console.WriteLine("GetFileInformation: Success"); return DokanError.ErrorSuccess; } { Directory dir = new Directory(Util.GetPathDirectory(fileName)); if (!dir.Exists()) { fileInfo = new FileInformation(); return DokanError.ErrorPathNotFound; } String name = Util.GetPathFileName(fileName); if (!dir.Contains(name)) { fileInfo = new FileInformation(); return DokanError.ErrorPathNotFound; } fileInfo = dir.GetItemInfo(name).GetFileInformation(); //Console.WriteLine("GetFileInformation: Success"); return DokanError.ErrorSuccess; } }