public async Task <IList <IFile> > GetFilesAsync(CancellationToken cancellationToken = default(CancellationToken)) { return(folder.ListFiles() .Where(x => x.IsFile) .Select(x => new AndroidFile(context, x, this)) .Select(x => (IFile)x) .ToList()); }
public override async Task <IReadOnlyList <StorageFile> > GetFilesAsync(CancellationToken ct) { return(await Task.Run(() => { var contents = _directoryDocument .ListFiles() .Where(f => f.IsFile) .Select(d => StorageFile.GetFromSafDocument(d)) .ToArray(); return Task.FromResult((IReadOnlyList <StorageFile>)contents); }, ct)); }
private void ScanFilesInSelectedFolder(DocumentFile folder) { var Items = folder.ListFiles(); foreach (var ItemType in Items) { if (ItemType.IsDirectory) { ScanFilesInSelectedFolder(ItemType); } else { var parentDirName = ItemType.ParentFile.Name; _filenames.Add($"{parentDirName}/{ItemType.Name}"); } } }
public List <string> ObjectList(string storagename, string volpath, bool dir) { List <string> lst = new List <string>(); DocumentFile doc = GetExistingDocumentFile(storagename, volpath); if (doc != null) { // Returns an array of files contained in the directory represented by this file. foreach (DocumentFile file in doc.ListFiles()) { if (dir && file.IsDirectory) { lst.Add(file.Name); } if (!dir && file.IsFile) { lst.Add(file.Name); } } } return(lst); }