Пример #1
0
        public static async Task <IReadOnlyCollection <Blob> > ToBlobsAsync(PagedAsyncEnumerable <Objects, Object> pae, ListOptions options)
        {
            var result = new List <Blob>();

#pragma warning disable IDE0008 // Use explicit type (async enumerator conflict)
            using (var enumerator = pae.GetEnumerator())
#pragma warning restore IDE0008 // Use explicit type
            {
                while (await enumerator.MoveNext().ConfigureAwait(false))
                {
                    Object go = enumerator.Current;

                    Blob blob = ToBlob(go);

                    if (options.FilePrefix != null && !blob.Name.StartsWith(options.FilePrefix))
                    {
                        continue;
                    }

                    if (options.BrowseFilter != null && !options.BrowseFilter(blob))
                    {
                        continue;
                    }

                    result.Add(blob);

                    if (options.MaxResults != null && result.Count >= options.MaxResults.Value)
                    {
                        break;
                    }
                }
            }

            return(result);
        }