Esempio n. 1
0
 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());
 }
Esempio n. 2
0
 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));
 }
Esempio n. 3
0
        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}");
                }
            }
        }
Esempio n. 4
0
            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);
            }