public override string GetObjectType() { if (this.BlobType == Microsoft.Cis.Services.Nephos.Common.Storage.BlobType.None) { return(string.Empty); } return(BlobTypeStrings.GetString(this.BlobType)); }
public ListBlobResultsBlobProperties(IBlobObject blobObject, string separator) { if (blobObject == null) { throw new ArgumentNullException("blobObject"); } this.blobName = blobObject.Name; this.containerName = blobObject.ContainerName; if (separator == null || blobObject.Type != Microsoft.Cis.Services.Nephos.Common.Storage.BlobType.None) { this.isActualBlob = true; this.contentType = blobObject.ContentType; NephosAssertionException.Assert(blobObject.LastModificationTime.HasValue); NephosAssertionException.Assert(blobObject.ContentLength.HasValue); this.lastModifiedTime = blobObject.LastModificationTime; this.size = blobObject.ContentLength; NameValueCollection nameValueCollection = null; if (blobObject.ServiceMetadata != null) { nameValueCollection = new NameValueCollection(); try { MetadataEncoding.Decode(blobObject.ServiceMetadata, nameValueCollection); } catch (MetadataFormatException metadataFormatException1) { MetadataFormatException metadataFormatException = metadataFormatException1; CultureInfo invariantCulture = CultureInfo.InvariantCulture; object[] objArray = new object[] { this.blobName }; throw new NephosStorageDataCorruptionException(string.Format(invariantCulture, "Error decoding service metadata for blob {0}", objArray), metadataFormatException); } this.contentEncoding = nameValueCollection[RealServiceManager.ContentEncodingTag]; this.contentLanguage = nameValueCollection[RealServiceManager.ContentLanguageTag]; this.cacheControl = nameValueCollection[RealServiceManager.CacheControlTag]; this.contentCrc64 = nameValueCollection[RealServiceManager.ContentCrc64Tag]; this.contentMD5 = nameValueCollection[RealServiceManager.ContentMD5Tag]; this.contentDisposition = nameValueCollection[RealServiceManager.ContentDispositionTag]; if (this.contentMD5 != null && this.contentMD5.Equals(RealServiceManager.EmptyContentMD5Value, StringComparison.OrdinalIgnoreCase)) { this.contentMD5 = null; } this.copyId = nameValueCollection[RealServiceManager.CopyIdTag]; this.copySource = nameValueCollection[RealServiceManager.CopySourceTag]; this.copyStatus = nameValueCollection[RealServiceManager.CopyStatusTag]; this.copyStatusDescription = nameValueCollection[RealServiceManager.CopyStatusDescriptionTag]; if (!string.IsNullOrEmpty(nameValueCollection[RealServiceManager.CopyProgressOffsetTag]) && !string.IsNullOrEmpty(nameValueCollection[RealServiceManager.CopyProgressTotalTag])) { this.copyProgress = string.Format("{0}/{1}", nameValueCollection[RealServiceManager.CopyProgressOffsetTag], nameValueCollection[RealServiceManager.CopyProgressTotalTag]); } this.copyCompletionTime = RealServiceManager.ParseDateTimeFromString(nameValueCollection[RealServiceManager.CopyCompletionTimeTag]); } if (blobObject.ApplicationMetadata != null) { this.metadata = new NameValueCollection(); try { MetadataEncoding.Decode(blobObject.ApplicationMetadata, this.metadata); } catch (MetadataFormatException metadataFormatException3) { MetadataFormatException metadataFormatException2 = metadataFormatException3; CultureInfo cultureInfo = CultureInfo.InvariantCulture; object[] objArray1 = new object[] { this.blobName }; throw new NephosStorageDataCorruptionException(string.Format(cultureInfo, "Error decoding application metadata for blob {0}", objArray1), metadataFormatException2); } } this.blobType = BlobTypeStrings.GetString(blobObject.Type); if (blobObject.LeaseInfo != null) { if (blobObject.LeaseInfo.Type == LeaseType.ReadWrite && blobObject.LeaseInfo.Duration.HasValue) { TimeSpan?duration = blobObject.LeaseInfo.Duration; TimeSpan zero = TimeSpan.Zero; if ((duration.HasValue ? duration.GetValueOrDefault() <= zero : true)) { goto Label1; } this.leaseStatus = "locked"; goto Label0; } Label1: this.leaseStatus = "unlocked"; Label0: if (blobObject.LeaseInfo.State.HasValue) { this.leaseState = LeaseStateStrings.LeaseStates[(int)blobObject.LeaseInfo.State.Value]; if (blobObject.LeaseInfo.State.Equals(Microsoft.Cis.Services.Nephos.Common.Storage.LeaseState.Leased)) { TimeSpan?nullable = blobObject.LeaseInfo.Duration; TimeSpan timeSpan = TimeSpan.FromSeconds(4294967295); if ((!nullable.HasValue ? true : nullable.GetValueOrDefault() != timeSpan)) { this.leaseDuration = "fixed"; } else { this.leaseDuration = "infinite"; } } } } this.snapshot = blobObject.Snapshot; if (blobObject.Type != Microsoft.Cis.Services.Nephos.Common.Storage.BlobType.IndexBlob) { this.sequenceNumber = null; } else { NephosAssertionException.Assert(blobObject.SequenceNumber.HasValue, "SequenceNumber must be present for PageBlob's."); this.sequenceNumber = blobObject.SequenceNumber; } this.isBlobEncrypted = blobObject.IsBlobEncrypted; this.isIncrementalCopy = blobObject.IsIncrementalCopy; if (this.isIncrementalCopy && nameValueCollection != null) { this.lastCopySnapshot = RealServiceManager.ParseDateTimeFromString(nameValueCollection[RealServiceManager.LastCopySnapshotTag]); } } }