Example #1
0
        public async Task <IEnumerable <StorageFile> > GetRemoteFiles(Func <string, bool> filter = null, bool recursive = false)
        {
            if (filter == null)
            {
                filter = item => true;
            }

            var items    = new List <StorageFile>();
            var subItems = (await GetRemoteItems()).ToList();

            if (recursive)
            {
                foreach (var subItem in subItems.Where(subItem => subItem.IsCollection))
                {
                    var subDirectory = new StorageDirectory(RelativePathParts.Merge(subItem.GetName()));
                    items.AddRange(await subDirectory.GetRemoteFiles(filter, true));
                }
            }

            items.AddRange(subItems
                           .Where(item => !item.IsCollection && filter(item.GetName()))
                           .Select(item => new StorageFile(RelativePathParts, item)));

            return(items);
        }
Example #2
0
 protected override async Task <bool> ExistsRemote()
 {
     return((await _parentFoder.GetRemoteFiles(itemName => itemName.StartsWith(Name, StringComparison.OrdinalIgnoreCase))).Any());
 }
		public async Task<IEnumerable<StorageFile>> GetRemoteFiles(Func<string, bool> filter = null, bool recursive = false)
		{
			if (filter == null)
				filter = item => true;

			var items = new List<StorageFile>();
			var subItems = (await GetRemoteItems()).ToList();

			if (recursive)
			{
				foreach (var subItem in subItems.Where(subItem => subItem.IsCollection))
				{
					var subDirectory = new StorageDirectory(RelativePathParts.Merge(subItem.GetName()));
					items.AddRange(await subDirectory.GetRemoteFiles(filter, true));
				}
			}

			items.AddRange(subItems
					.Where(item => !item.IsCollection && filter(item.GetName()))
					.Select(item => new StorageFile(RelativePathParts, item)));

			return items;
		}