本文整理汇总了C#中System.Net.Http.MultipartFormDataContent.AddFileStreamContent方法的典型用法代码示例。如果您正苦于以下问题:C# MultipartFormDataContent.AddFileStreamContent方法的具体用法?C# MultipartFormDataContent.AddFileStreamContent怎么用?C# MultipartFormDataContent.AddFileStreamContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.Http.MultipartFormDataContent
的用法示例。
在下文中一共展示了MultipartFormDataContent.AddFileStreamContent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateFormData
private MultipartFormDataContent CreateFormData(HSSendSignatureRequestData request)
{
var formData = new MultipartFormDataContent();
if (!string.IsNullOrEmpty(request.Title))
formData.AddStringContent("title", request.Title);
if (!string.IsNullOrEmpty(request.Subject))
formData.AddStringContent("subject", request.Subject);
if (!string.IsNullOrEmpty(request.Message))
formData.AddStringContent("message", request.Message);
if (!string.IsNullOrEmpty(request.SigningRedirectUrl))
formData.AddStringContent("signing_redirect_url", request.SigningRedirectUrl);
for (var i = 0; i < request.Signers.Count; i++)
{
formData.AddStringContent(string.Format("signers[{0}][name]", i), request.Signers[i].Name);
formData.AddStringContent(string.Format("signers[{0}][email_address]", i),
request.Signers[i].EmailAddress);
if (!string.IsNullOrEmpty(request.Signers[i].Order))
formData.AddStringContent(string.Format("signers[{0}][order]", i), request.Signers[i].Order);
if (!string.IsNullOrEmpty(request.Signers[i].Pin))
formData.AddStringContent(string.Format("signers[{0}][pin]", i), request.Signers[i].Pin);
}
for (var i = 0; request.CcEmailAddresses != null && i < request.CcEmailAddresses.Count; i++)
{
formData.AddStringContent(string.Format("cc_email_addresses[{0}]", i), request.CcEmailAddresses[i]);
}
for (var i = 0; request.Files != null && i < request.Files.Count; i++)
{
formData.AddFileStreamContent(i, request.Files[i].FullName, request.Files[i].Name);
}
for (var i = 0; request.FileUrls != null && i < request.FileUrls.Count; i++)
{
formData.AddStringContent(string.Format("file_url[{0}]", i), request.FileUrls[i]);
}
if (request.UseTextTags == 1)
formData.AddStringContent("use_text_tags", "1");
if (request.HideTextTags == 1)
formData.AddStringContent("hide_text_tags", "1");
formData.AddStringContent("test_mode", "1");
return formData;
}