public void Refresh() { ViewCells?.Clear(); ViewCells = new List <ViewCell>(); foreach (var directory in CurrentPath.EnumerateDirectories()) { var cell = new DirectoryCell(directory, Settings); ViewCells.Add(cell); } foreach (var file in CurrentPath.EnumerateFiles()) { if (DisplayFilter != null && !DisplayFilter.Contains(file.Extension.ToLower().Trim('.'))) { continue; } var cell = new FileCell(file, Settings); if (IsExchangePath || CurrentPath.FullName == AddonPath.FullName) { cell.CanDelete = true; } else { cell.CanDelete = false; } ViewCells.Add(cell); } }
public IEnumerable <ViewCell> GetViewCells(int page) { var baseCell = ViewCells.Select(k => k); if (CountsPerPage != 0) { baseCell = baseCell.Skip(page * (int)CountsPerPage).Take((int)CountsPerPage); } return(IncludeHidden ? baseCell : baseCell.Where(k => !k.IsHidden)); }
public void NavigateSubFolder(string childName) { Refresh(); CheckSubFolderAccess(childName); var dirs = ViewCells.Where(k => k is DirectoryCell); if (!IncludeHidden) { dirs = dirs.Where(k => !k.IsHidden); } CurrentPath = ((DirectoryCell)dirs.First(k => k.Name == childName)).Directory; Refresh(); }
public void NavigateSubFolder(Guid childGuid) { Refresh(); var child = ViewCells.FirstOrDefault(k => k.Guid == childGuid); CheckSubFolderAccess(child?.Name); var dirs = ViewCells.Where(k => k is DirectoryCell); if (!IncludeHidden) { dirs = dirs.Where(k => !k.IsHidden); } CurrentPath = ((DirectoryCell)dirs.First(k => k.Guid == childGuid)).Directory; Refresh(); }
public FileCell SearchChildFile(string childName) { var filteredList = ViewCells.Where(path => path is FileCell); if (!IncludeHidden) { filteredList = filteredList.Where(k => !k.IsHidden); } var file = (FileCell)filteredList.FirstOrDefault(k => k.Name == childName); if (file == null) { throw new FileNotFoundException("No such file or no access to the file. File name: " + childName); } return(file); }