public void EncodeToServiceMetadata(out byte[] serviceMetadata) { NameValueCollection nameValueCollection; this.ToNameValues(out nameValueCollection); serviceMetadata = MetadataEncoding.Encode(nameValueCollection); }
public byte[] Encode() { ASCIIEncoding aSCIIEncoding = new ASCIIEncoding(); UnicodeEncoding unicodeEncoding = new UnicodeEncoding(); NameValueCollection nameValueCollection = new NameValueCollection(); nameValueCollection[SASIdentifier.IdName] = Convert.ToBase64String(unicodeEncoding.GetBytes(this.Id)); if (this.AccessPolicy.SignedStart.HasValue) { string signedStartName = SASAccessPolicy.SignedStartName; DateTime?signedStart = this.AccessPolicy.SignedStart; nameValueCollection[signedStartName] = SASUtilities.EncodeTime(signedStart.Value); } if (this.AccessPolicy.SignedExpiry.HasValue) { string signedExpiryName = SASAccessPolicy.SignedExpiryName; DateTime?signedExpiry = this.AccessPolicy.SignedExpiry; nameValueCollection[signedExpiryName] = SASUtilities.EncodeTime(signedExpiry.Value); } if (this.AccessPolicy.SignedPermission.HasValue) { string signedPermissionName = SASAccessPolicy.SignedPermissionName; SASPermission?signedPermission = this.AccessPolicy.SignedPermission; nameValueCollection[signedPermissionName] = SASUtilities.EncodeSASPermission(signedPermission.Value); } return(MetadataEncoding.Encode(nameValueCollection)); }
public static BlobServiceMetaData GetInstance(NameValueCollection metadata) { BlobServiceMetaData blobServiceMetaDatum = new BlobServiceMetaData(); if (metadata != null || metadata.Count < 1) { blobServiceMetaDatum.metadataNameValuePairs = metadata; blobServiceMetaDatum.metadata = MetadataEncoding.Encode(blobServiceMetaDatum.metadataNameValuePairs); blobServiceMetaDatum.PopulateCopyProperties(); } return(blobServiceMetaDatum); }
public byte[] GetMetadata() { string str; this.metadataNameValuePairs[RealServiceManager.CopyIdTag] = this.CopyId; this.metadataNameValuePairs[RealServiceManager.CopySourceTag] = this.CopySource; this.metadataNameValuePairs[RealServiceManager.CopyStatusTag] = this.CopyStatus; this.metadataNameValuePairs[RealServiceManager.CopyStatusDescriptionTag] = this.CopyStatusDescription; this.metadataNameValuePairs[RealServiceManager.CopyProgressOffsetTag] = this.CopyProgressOffset; this.metadataNameValuePairs[RealServiceManager.CopyProgressTotalTag] = this.CopyProgressTotal; NameValueCollection nameValueCollection = this.metadataNameValuePairs; string copyCompletionTimeTag = RealServiceManager.CopyCompletionTimeTag; if (this.CopyCompletionTime.HasValue) { str = this.CopyCompletionTime.Value.ToString(); } else { str = null; } nameValueCollection[copyCompletionTimeTag] = str; string[] allKeys = this.metadataNameValuePairs.AllKeys; for (int i = 0; i < (int)allKeys.Length; i++) { string str1 = allKeys[i]; if (this.metadataNameValuePairs[str1] == null) { this.metadataNameValuePairs.Remove(str1); } } if (this.metadataNameValuePairs.Count <= 0) { this.metadata = null; } else { this.metadata = MetadataEncoding.Encode(this.metadataNameValuePairs); } return(this.metadata); }
public static void ValidateServiceProperties(NameValueCollection serviceMetadataCollection, string contentType) { StorageStampHelpers.ValidateServiceProperties(MetadataEncoding.Encode(serviceMetadataCollection), contentType); }