JsonResult IDriver.Filter(string target, string query) { WebDavRoot lroot = this.GetRoot(target); target = this.GetCorectTarget(target); target = this.DecodeTarget(target, lroot.Directory.RelPath); List <DirInfo> filesFormWebFav = client.GetDirectories(target, true); List <DirInfo> directories = filesFormWebFav.FindAll(d => d.IsDirectory); DirInfo targetDirInfo = directories[0]; DirInfo parentDirInfo = this.GetParent(targetDirInfo); targetDirInfo.HasSubDirectories = filesFormWebFav != null && directories != null && directories.Count > 1; OpenResponseBase answer = new OpenResponseBase(DTOBase.Create(targetDirInfo, parentDirInfo, lroot)); if (filesFormWebFav != null) { filesFormWebFav.Remove(targetDirInfo); foreach (DirInfo dirInfo in filesFormWebFav) { if (!Filter(dirInfo, query)) { continue; } answer.Files.Add(DTOBase.Create(dirInfo, targetDirInfo, lroot)); } } var r = Json(answer); return(r); }
JsonResult IDriver.Open(string target, bool tree) { WebDavRoot lroot = this.GetRoot(target); target = this.GetCorectTarget(target); target = this.DecodeTarget(target, lroot.Directory.RelPath); List <DirInfo> filesFormWebFav = client.GetDirectories(target, true); List <DirInfo> directories = filesFormWebFav.FindAll(d => d.IsDirectory); DirInfo targetDirInfo = directories[0]; DirInfo parentDirInfo = this.GetParent(targetDirInfo); targetDirInfo.HasSubDirectories = filesFormWebFav != null && directories != null && directories.Count > 1; OpenResponseBase answer = new OpenResponseBase(DTOBase.Create(targetDirInfo, parentDirInfo, lroot)); if (filesFormWebFav != null) { filesFormWebFav.Remove(targetDirInfo); foreach (DirInfo dirInfo in filesFormWebFav) { dirInfo.HasSubDirectories = IsConstainsChild(dirInfo); answer.Files.Add(DTOBase.Create(dirInfo, targetDirInfo, lroot)); } } //HttpContext.Current.Session[RetTarget] = answer.CurrentWorkingDirectory.Hash; return(Json(answer)); }