public static void ValidatePutBlockListArguments(IBlobObject blob, long contentLength, byte[] applicationMetadata, byte[][] blockIdList, BlockSource[] blockSourceList, byte[] md5, IBlobObjectCondition condition, BlobServiceVersion blobServiceVersion) { if (blob.Snapshot != StorageStampHelpers.RootBlobSnapshotVersion) { throw new XStoreArgumentException("This operation is only supported on the root blob."); } if (contentLength < (long)-1) { throw new ArgumentOutOfRangeException("contentLength", "contentLength must be >= -1"); } if (contentLength > 5242880000000L) { throw new BlobContentTooLargeException(new long?(5242880000000L), null, null); } StorageStampHelpers.ValidateApplicationMetadata(applicationMetadata); if (blockSourceList != null && blobServiceVersion < BlobServiceVersion.July09) { throw new XStoreArgumentException("blockSourceList is only allowed for verisons STG18 and up."); } int num = (blockIdList != null ? (int)blockIdList.Length : 0); int num1 = (blockSourceList != null ? (int)blockSourceList.Length : 0); if (blockIdList != null && blockSourceList != null && num != num1) { string str = string.Format("blockIdList (length {0}) and blockSourceList (length {1}) must be of the same length.", num, num1); throw new XStoreArgumentException(str); } if ((long)num > (long)50000) { throw new BlockListTooLongException(); } StorageStampHelpers.ValidateMD5(md5); }
public static void ValidateApplicationMetadata(byte[] applicationMetadata) { if (applicationMetadata != null) { StorageStampHelpers.ValidateApplicationMetadata((int)applicationMetadata.Length); } }
public static void ValidatePutBlobArguments(IBlobObject blob, long contentLength, long?maxBlobSize, byte[] applicationMetadata, byte[] contentMD5, ISequenceNumberUpdate sequenceNumberUpdate, OverwriteOption overwriteOption, IBlobObjectCondition condition, bool isLargeBlockBlobRequest, bool is8TBPageBlobAllowed) { if (blob.Snapshot != StorageStampHelpers.RootBlobSnapshotVersion) { throw new XStoreArgumentException("This operation is only supported on the root blob."); } long num = 1099511627776L; if (contentLength < (long)0) { throw new ArgumentOutOfRangeException("contentLength", "contentLength must be >= 0"); } if (blob.Type == BlobType.ListBlob && !isLargeBlockBlobRequest && contentLength > (long)67108864) { throw new BlobContentTooLargeException(new long?((long)67108864), null, null); } if (blob.Type == BlobType.IndexBlob && maxBlobSize.Value > num) { throw new BlobContentTooLargeException(new long?(num), null, null); } StorageStampHelpers.ValidateMaxBlobSizeForPutBlob(blob, maxBlobSize); StorageStampHelpers.ValidateApplicationMetadata(applicationMetadata); if (contentMD5 != null && (long)((int)contentMD5.Length) != (long)16) { throw new MD5InvalidException(); } if (sequenceNumberUpdate != null) { if (blob.Type != BlobType.IndexBlob) { throw new XStoreArgumentException("sequenceNumberUpdate only allowed for PageBlob"); } if (sequenceNumberUpdate.UpdateType != SequenceNumberUpdateType.Update) { throw new XStoreArgumentException("sequenceNumberUpdate can only have type Update for PutBlob."); } if (sequenceNumberUpdate.SequenceNumber < (long)0 || sequenceNumberUpdate.SequenceNumber > 9223372036854775807L) { throw new XStoreArgumentException("sequenceNumberUpdate sequence number must be >= 0 and < Int64.MaxValue."); } } }
public static void ValidateApplicationMetadata(NameValueCollection metadata) { StorageStampHelpers.ValidateApplicationMetadata(MetadataEncoding.GetMetadataLengthWithAsciiEncoding(metadata)); }