/// <summary> /// Gets the download block list. /// </summary> /// <param name="typesOfBlocks">The types of blocks.</param> /// <param name="options">An object that specifies any additional options for the request.</param> /// <param name="setResult">The result report delegate.</param> /// <returns>A <see cref="TaskSequence"/> that gets the download block list.</returns> internal TaskSequence GetDownloadBlockList(BlockListingFilter typesOfBlocks, BlobRequestOptions options, Action <IEnumerable <ListBlockItem> > setResult) { var request = ProtocolHelper.GetWebRequest(this.ServiceClient, options, (timeout) => BlobRequest.GetBlockList(this.TransformedAddress, timeout, this.SnapshotTime, typesOfBlocks, null)); this.ServiceClient.Credentials.SignRequest(request); // Retrieve the stream var requestStreamTask = request.GetResponseAsyncWithTimeout(this.ServiceClient, options.Timeout); yield return(requestStreamTask); // Copy the data using (var response = requestStreamTask.Result as HttpWebResponse) { using (var responseStream = response.GetResponseStream()) { var blockListResponse = new GetBlockListResponse(responseStream); setResult(ParseResponse(blockListResponse)); } this.ParseSizeAndLastModified(response); } }