예제 #1
0
        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);
        }
예제 #2
0
 public static void ValidatePutBlockArguments(IBlobObject blob, byte[] blockIdentifier, long contentLength, byte[] contentMD5, IBlobObjectCondition condition, bool isLargeBlockBlobRequest)
 {
     if (blob.Snapshot != StorageStampHelpers.RootBlobSnapshotVersion)
     {
         throw new XStoreArgumentException("This operation is only supported on the root blob.");
     }
     if ((int)blockIdentifier.Length <= 0 || (int)blockIdentifier.Length > 64)
     {
         throw new XStoreArgumentOutOfRangeException("blockIdentifier");
     }
     if (contentLength <= (long)0)
     {
         throw new ArgumentOutOfRangeException("contentLength", "contentLength must be > 0");
     }
     if (!isLargeBlockBlobRequest && contentLength > (long)4194304)
     {
         throw new BlobContentTooLargeException(new long?((long)4194304), null, null);
     }
     StorageStampHelpers.ValidateMD5(contentMD5);
     if (condition != null)
     {
         if (condition.IfModifiedSinceTime.HasValue)
         {
             throw new XStoreArgumentException("PutBlock does not support IfModifiedSince as a condition. Only LeaseId is supported as part of the condition for PutBlock.");
         }
         if (condition.IfNotModifiedSinceTime.HasValue)
         {
             throw new XStoreArgumentException("PutBlock does not support IfNotModifiedSince as a condition. Only LeaseId is supported as part of the condition for PutBlock.");
         }
     }
 }