/// <summary> /// Selects the protocol response. /// </summary> /// <param name="protocolItem">The protocol item.</param> /// <param name="service">The service.</param> /// <param name="container">The container.</param> /// <returns>The parsed <see cref="IListBlobItem"/>.</returns> internal static IListBlobItem SelectProtocolResponse(IListBlobEntry protocolItem, CloudBlobClient service, CloudBlobContainer container) { BlobEntry blob = protocolItem as BlobEntry; if (blob != null) { var attributes = blob.Attributes; CloudBlob cloudBlob; if (attributes.Properties.BlobType == BlobType.BlockBlob) { cloudBlob = new CloudBlockBlob(attributes, service, ConvertDateTimeToSnapshotString(attributes.Snapshot)); } else if (attributes.Properties.BlobType == BlobType.PageBlob) { cloudBlob = new CloudPageBlob(attributes, service, ConvertDateTimeToSnapshotString(attributes.Snapshot)); } else { cloudBlob = new CloudBlob(attributes, service, ConvertDateTimeToSnapshotString(attributes.Snapshot)); } return cloudBlob; } BlobPrefixEntry blobPrefix = protocolItem as BlobPrefixEntry; if (blobPrefix != null) { if (container != null) { return container.GetDirectoryReference(blobPrefix.Name); } else { return new CloudBlobDirectory(blobPrefix.Name, service); } } throw new InvalidOperationException("Invalid blob list item returned"); }
/// <summary> /// Selects the protocol response. /// </summary> /// <param name="protocolItem">The protocol item.</param> /// <returns>The parsed <see cref="IListBlobItem"/>.</returns> private IListBlobItem SelectListBlobItem(IListBlobEntry protocolItem) { ListBlobEntry blob = protocolItem as ListBlobEntry; if (blob != null) { BlobAttributes attributes = blob.Attributes; attributes.StorageUri = NavigationHelper.AppendPathToUri(this.StorageUri, blob.Name); if (attributes.Properties.BlobType == BlobType.BlockBlob) { return new CloudBlockBlob(attributes, this.ServiceClient); } else if (attributes.Properties.BlobType == BlobType.PageBlob) { return new CloudPageBlob(attributes, this.ServiceClient); } else { throw new InvalidOperationException(SR.InvalidBlobListItem); } } ListBlobPrefixEntry blobPrefix = protocolItem as ListBlobPrefixEntry; if (blobPrefix != null) { return this.GetDirectoryReference(blobPrefix.Name); } throw new InvalidOperationException(SR.InvalidBlobListItem); }
private IListBlobItem SelectListBlobItem(IListBlobEntry protocolItem) { throw new System.NotImplementedException(); }