protected VFile FindFiles(string pathString) { pathString = pathString.Trim('\\').Replace("\\\\", "\\"); if (pathString == "") { if (RootNode == null || !RootNode.IsLoaded) { LoadFile(RootNode); } return(RootNode); } string[] path = pathString.Split('\\'); VFile currentNode = RootNode; foreach (string dirName in path) { try { if (currentNode.GetType() != typeof(Folder)) { return(null); } if (!((Folder)currentNode).IsLoaded) { //И так работает все медленно, не будем ставить lock если это можно lock (currentNode) { if (!((Folder)currentNode).IsLoaded) { LoadFile((Folder)currentNode); } } } //currentNode = currentNode.ChildNodes.First(value => value.Name == dirName); currentNode = ((Folder)currentNode).FindInChilds(dirName); if (currentNode == null) { _log.Debug("Не нашел: " + pathString); return(null); } } catch (Exception) { _log.Debug("Не нашел(exception): " + pathString); return(null); } } if (currentNode.GetType() == typeof(Folder) && !((Folder)currentNode).IsLoaded) { LoadFile((Folder)currentNode); } return(currentNode); }
public override NtStatus DeleteDirectory(string filename, DokanFileInfo info) { VFile node = FindFiles(filename); if (node == null && node.GetType() == typeof(Folder) && ((Folder)node).Property.ContainsKey("inStorage")) { RootNode.Childs.Remove(node); API.VkStorage.Remove(StorageKey, ((Folder)node).Property["gid"]); return(DokanResult.Success); } return(DokanResult.Error); }