コード例 #1
0
        /// <summary>
        /// Parses a blob prefix entry in a blob listing response.
        /// </summary>
        /// <returns>Blob listing entry</returns>
        private IListBlobEntry ParseBlobPrefixEntry()
        {
            ListBlobPrefixEntry commonPrefix = new ListBlobPrefixEntry();

            this.reader.ReadStartElement();
            while (this.reader.IsStartElement())
            {
                if (this.reader.IsEmptyElement)
                {
                    this.reader.Skip();
                }
                else
                {
                    switch (this.reader.Name)
                    {
                    case Constants.NameElement:
                        commonPrefix.Name = reader.ReadElementContentAsString();
                        break;

                    default:
                        reader.Skip();
                        break;
                    }
                }
            }

            this.reader.ReadEndElement();

            return(commonPrefix);
        }
コード例 #2
0
        /// <summary>
        /// Parses a blob prefix entry in a blob listing response.
        /// </summary>
        /// <returns>Blob listing entry</returns>
        private static async Task <ListBlobPrefixEntry> ParseBlobPrefixEntryAsync(XmlReader reader, CancellationToken token)
        {
            token.ThrowIfCancellationRequested();

            ListBlobPrefixEntry commonPrefix = new ListBlobPrefixEntry();

            await reader.ReadStartElementAsync().ConfigureAwait(false);

            while (await reader.IsStartElementAsync().ConfigureAwait(false))
            {
                token.ThrowIfCancellationRequested();

                if (reader.IsEmptyElement)
                {
                    await reader.SkipAsync().ConfigureAwait(false);
                }
                else
                {
                    switch (reader.Name)
                    {
                    case Constants.NameElement:
                        commonPrefix.Name = await reader.ReadElementContentAsStringAsync().ConfigureAwait(false);

                        break;

                    default:
                        await reader.SkipAsync().ConfigureAwait(false);

                        break;
                    }
                }
            }

            await reader.ReadEndElementAsync().ConfigureAwait(false);

            return(commonPrefix);
        }