本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Blob.BlobRequestOptions.AssertNoEncryptionPolicyOrStrictMode方法的典型用法代码示例。如果您正苦于以下问题:C# BlobRequestOptions.AssertNoEncryptionPolicyOrStrictMode方法的具体用法?C# BlobRequestOptions.AssertNoEncryptionPolicyOrStrictMode怎么用?C# BlobRequestOptions.AssertNoEncryptionPolicyOrStrictMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.WindowsAzure.Storage.Blob.BlobRequestOptions
的用法示例。
在下文中一共展示了BlobRequestOptions.AssertNoEncryptionPolicyOrStrictMode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClearPageImpl
/// <summary>
/// Implementation method for the ClearPage methods.
/// </summary>
/// <param name="startOffset">The start offset. Must be multiples of 512.</param>
/// <param name="length">Length of the data range to be cleared. Must be multiples of 512.</param>
/// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the condition that must be met in order for the request to proceed. If <c>null</c>, no condition is used.</param>
/// <param name="options">A <see cref="BlobRequestOptions"/> object that specifies additional options for the request.</param>
/// <returns>A <see cref="RESTCommand{T}"/> that writes the pages.</returns>
private RESTCommand<NullType> ClearPageImpl(long startOffset, long length, AccessCondition accessCondition, BlobRequestOptions options)
{
CommonUtility.AssertNotNull("options", options);
options.AssertNoEncryptionPolicyOrStrictMode();
if (startOffset < 0 || startOffset % Constants.PageSize != 0)
{
CommonUtility.ArgumentOutOfRange("startOffset", startOffset);
}
if (length <= 0 || length % Constants.PageSize != 0)
{
CommonUtility.ArgumentOutOfRange("length", length);
}
PageRange pageRange = new PageRange(startOffset, startOffset + length - 1);
PageWrite pageWrite = PageWrite.Clear;
RESTCommand<NullType> putCmd = new RESTCommand<NullType>(this.ServiceClient.Credentials, this.attributes.StorageUri);
options.ApplyToStorageCommand(putCmd);
putCmd.BuildRequestDelegate = (uri, builder, serverTimeout, useVersionHeader, ctx) => BlobHttpWebRequestFactory.PutPage(uri, serverTimeout, pageRange, pageWrite, accessCondition, useVersionHeader, ctx);
putCmd.SignRequest = this.ServiceClient.AuthenticationHandler.SignRequest;
putCmd.PreProcessResponse = (cmd, resp, ex, ctx) =>
{
HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.Created, resp, NullType.Value, cmd, ex);
CloudBlob.UpdateETagLMTLengthAndSequenceNumber(this.attributes, resp, false);
return NullType.Value;
};
return putCmd;
}
示例2: PutBlockImpl
/// <summary>
/// Uploads the block.
/// </summary>
/// <param name="source">The source stream.</param>
/// <param name="blockId">The block ID.</param>
/// <param name="contentMD5">The content MD5.</param>
/// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the condition that must be met in order for the request to proceed. If <c>null</c>, no condition is used.</param>
/// <param name="options">A <see cref="BlobRequestOptions"/> object that specifies additional options for the request.</param>
/// <returns>A <see cref="RESTCommand{T}"/> that uploads the block.</returns>
internal RESTCommand<NullType> PutBlockImpl(Stream source, string blockId, string contentMD5, AccessCondition accessCondition, BlobRequestOptions options)
{
options.AssertNoEncryptionPolicyOrStrictMode();
long offset = source.Position;
RESTCommand<NullType> putCmd = new RESTCommand<NullType>(this.ServiceClient.Credentials, this.attributes.StorageUri);
options.ApplyToStorageCommand(putCmd);
putCmd.SendStream = source;
putCmd.RecoveryAction = (cmd, ex, ctx) => RecoveryActions.SeekStream(cmd, offset);
putCmd.BuildRequestDelegate = (uri, builder, serverTimeout, useVersionHeader, ctx) => BlobHttpWebRequestFactory.PutBlock(uri, serverTimeout, blockId, accessCondition, useVersionHeader, ctx);
putCmd.SetHeaders = (r, ctx) =>
{
if (!string.IsNullOrEmpty(contentMD5))
{
r.Headers[HttpRequestHeader.ContentMd5] = contentMD5;
}
};
putCmd.SignRequest = this.ServiceClient.AuthenticationHandler.SignRequest;
putCmd.PreProcessResponse = (cmd, resp, ex, ctx) =>
{
HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.Created, resp, NullType.Value, cmd, ex);
cmd.CurrentResult.IsRequestServerEncrypted = CloudBlob.ParseServerRequestEncrypted(resp);
return NullType.Value;
};
return putCmd;
}
示例3: PutPageImpl
/// <summary>
/// Implementation method for the WritePage methods.
/// </summary>
/// <param name="pageData">The page data.</param>
/// <param name="startOffset">The start offset.</param>
/// <param name="contentMD5">The content MD5.</param>
/// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the condition that must be met in order for the request to proceed. If <c>null</c>, no condition is used.</param>
/// <param name="options">A <see cref="BlobRequestOptions"/> object that specifies additional options for the request.</param>
/// <returns>A <see cref="RESTCommand{T}"/> that writes the pages.</returns>
private RESTCommand<NullType> PutPageImpl(Stream pageData, long startOffset, string contentMD5, AccessCondition accessCondition, BlobRequestOptions options)
{
options.AssertNoEncryptionPolicyOrStrictMode();
if (startOffset % Constants.PageSize != 0)
{
CommonUtility.ArgumentOutOfRange("startOffset", startOffset);
}
long offset = pageData.Position;
long length = pageData.Length - offset;
PageRange pageRange = new PageRange(startOffset, startOffset + length - 1);
PageWrite pageWrite = PageWrite.Update;
if ((1 + pageRange.EndOffset - pageRange.StartOffset) % Constants.PageSize != 0 ||
(1 + pageRange.EndOffset - pageRange.StartOffset) == 0)
{
CommonUtility.ArgumentOutOfRange("pageData", pageData);
}
RESTCommand<NullType> putCmd = new RESTCommand<NullType>(this.ServiceClient.Credentials, this.attributes.StorageUri);
options.ApplyToStorageCommand(putCmd);
putCmd.SendStream = pageData;
putCmd.RecoveryAction = (cmd, ex, ctx) => RecoveryActions.SeekStream(cmd, offset);
putCmd.BuildRequestDelegate = (uri, builder, serverTimeout, useVersionHeader, ctx) => BlobHttpWebRequestFactory.PutPage(uri, serverTimeout, pageRange, pageWrite, accessCondition, useVersionHeader, ctx);
putCmd.SetHeaders = (r, ctx) =>
{
if (!string.IsNullOrEmpty(contentMD5))
{
r.Headers[HttpRequestHeader.ContentMd5] = contentMD5;
}
};
putCmd.SignRequest = this.ServiceClient.AuthenticationHandler.SignRequest;
putCmd.PreProcessResponse = (cmd, resp, ex, ctx) =>
{
HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.Created, resp, NullType.Value, cmd, ex);
CloudBlob.UpdateETagLMTLengthAndSequenceNumber(this.attributes, resp, false);
return NullType.Value;
};
return putCmd;
}
示例4: AppendBlockImpl
/// <summary>
/// Commits the block to the end of the blob.
/// </summary>
/// <param name="source">The source stream.</param>
/// <param name="contentMD5">The content MD5.</param>
/// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the condition that must be met in order for the request to proceed. If <c>null</c>, no condition is used.</param>
/// <param name="options">A <see cref="BlobRequestOptions"/> object that specifies additional options for the request.</param>
/// <returns>A <see cref="RESTCommand{T}"/> that commits the block to the end of the blob.</returns>
internal RESTCommand<long> AppendBlockImpl(Stream source, string contentMD5, AccessCondition accessCondition, BlobRequestOptions options)
{
options.AssertNoEncryptionPolicyOrStrictMode();
long offset = source.Position;
RESTCommand<long> putCmd = new RESTCommand<long>(this.ServiceClient.Credentials, this.attributes.StorageUri);
options.ApplyToStorageCommand(putCmd);
putCmd.SendStream = source;
putCmd.RecoveryAction = (cmd, ex, ctx) => RecoveryActions.SeekStream(cmd, offset);
putCmd.BuildRequestDelegate = (uri, builder, serverTimeout, useVersionHeader, ctx) => BlobHttpWebRequestFactory.AppendBlock(uri, serverTimeout, accessCondition, useVersionHeader, ctx);
putCmd.SetHeaders = (r, ctx) =>
{
if (!string.IsNullOrEmpty(contentMD5))
{
r.Headers[HttpRequestHeader.ContentMd5] = contentMD5;
}
};
putCmd.SignRequest = this.ServiceClient.AuthenticationHandler.SignRequest;
putCmd.PreProcessResponse = (cmd, resp, ex, ctx) =>
{
long appendOffset = -1;
if (resp.Headers.AllKeys.Contains(Constants.HeaderConstants.BlobAppendOffset))
{
appendOffset = long.Parse(resp.Headers[Constants.HeaderConstants.BlobAppendOffset], CultureInfo.InvariantCulture);
}
HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.Created, resp, appendOffset, cmd, ex);
CloudBlob.UpdateETagLMTLengthAndSequenceNumber(this.attributes, resp, false);
return appendOffset;
};
return putCmd;
}