public ListBlobsItem()
 {
     Properties = new ListBlobsItemProperties();
     Metadata   = new Dictionary <string, string>();
 }
 public ListBlobsItem()
 {
     Properties = new ListBlobsItemProperties();
     Metadata = new Dictionary<string, string>();
 }
        private static ListBlobsItemProperties ParseBlobProperties(XElement propertiesElement)
        {
            var properties = new ListBlobsItemProperties();
            foreach (var field in propertiesElement.Elements())
            {
                switch (field.Name.LocalName)
                {
                    case "Last-Modified":
                        properties.LastModified = DateTime.Parse(field.Value, null, System.Globalization.DateTimeStyles.AssumeUniversal | System.Globalization.DateTimeStyles.AdjustToUniversal);
                        break;
                    case "Etag":
                        properties.ETag = field.Value;
                        break;
                    case "Content-Length":
                        properties.ContentLength = long.Parse(field.Value);
                        break;
                    case "Content-Type":
                        properties.ContentType = field.Value;
                        break;
                    case "Content-Encoding":
                        properties.ContentEncoding = field.Value;
                        break;
                    case "Content-Language":
                        properties.ContentLanguage = field.Value;
                        break;
                    case "Content-MD5":
                        properties.ContentMD5 = field.Value;
                        break;
                    case "Cache-Control":
                        properties.CacheControl = field.Value;
                        break;
                    case "x-ms-blob-sequence-number":
                        properties.BlobSequenceNumber = field.Value;
                        break;
                    case "BlobType":
                        if (field.Value.Equals("BlockBlob", StringComparison.InvariantCultureIgnoreCase))
                        {
                            properties.BlobType = Common.BlobType.Block;
                        }
                        else
                        {
                            properties.BlobType = Common.BlobType.Page;
                        }
                        break;
                    case "LeaseStatus":
                        if (field.Value.Equals("locked"))
                        {
                            properties.LeaseStatus = LeaseStatus.Locked;
                        }
                        else
                        {
                            properties.LeaseStatus = LeaseStatus.Unlocked;
                        }
                        break;
                    case "LeaseState":
                        switch (field.Value)
                        {
                            case "available":
                                properties.LeaseState = LeaseState.Available;
                                break;
                            case "leased":
                                properties.LeaseState = LeaseState.Leased;
                                break;
                            case "expired":
                                properties.LeaseState = LeaseState.Expired;
                                break;
                            case "breaking":
                                properties.LeaseState = LeaseState.Breaking;
                                break;
                            case "broken":
                                properties.LeaseState = LeaseState.Broken;
                                break;
                            default:
                                throw new AzureResponseParseException(field.Name.LocalName, field.Value);
                        }
                        break;
                    case "LeaseDuration":
                        switch (field.Value)
                        {
                            case "infinite":
                                properties.LeaseDuration = LeaseDuration.Infinite;
                                break;
                            case "fixed":
                                properties.LeaseDuration = LeaseDuration.Fixed;
                                break;
                            default:
                                throw new AzureResponseParseException(field.Name.LocalName, field.Value);
                        }
                        break;
                    case "CopyId":
                        properties.CopyId = field.Value;
                        break;
                    case "CopyStatus":
                        switch (field.Value)
                        {
                            case "pending":
                                properties.CopyStatus = CopyStatus.Pending;
                                break;
                            case "success":
                                properties.CopyStatus = CopyStatus.Success;
                                break;
                            case "aborted":
                                properties.CopyStatus = CopyStatus.Aborted;
                                break;
                            case "failed":
                                properties.CopyStatus = CopyStatus.Failed;
                                break;
                            default:
                                throw new AzureResponseParseException(field.Name.LocalName, field.Value);
                        }
                        break;
                    case "CopySource":
                        properties.CopySource = new Uri(field.Value);
                        break;
                    case "CopyProgress":
                        properties.CopyProgress = field.Value;
                        break;
                    case "CopyCompletionTime":
                        properties.CopyCompletionTime = DateTime.Parse(field.Value, null, System.Globalization.DateTimeStyles.AssumeUniversal | System.Globalization.DateTimeStyles.AdjustToUniversal);
                        break;
                    case "CopyStatusDescription":
                        properties.CopyStatusDescription = field.Value;
                        break;

                }
            }
            return properties;
        }