本文整理汇总了C#中System.Net.Mime.ContentDisposition.Replace方法的典型用法代码示例。如果您正苦于以下问题:C# ContentDisposition.Replace方法的具体用法?C# ContentDisposition.Replace怎么用?C# ContentDisposition.Replace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.Mime.ContentDisposition
的用法示例。
在下文中一共展示了ContentDisposition.Replace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(String[] args)
{
OnlineConvert.OnlineConvert oc = OnlineConvert.OnlineConvert.create("YOUR API KEY HERE",true,"convert-to-png");
var a = oc.convert("convert-to-png", "URL", "http://upload.wikimedia.org/wikipedia/commons/thumb/9/90/Colonial_Williamsburg_%283205781804%29.jpg/100px-Colonial_Williamsburg_%283205781804%29.jpg", "a.png");
var dica = oc.getXml2Dic(a);
var directDownloadURL = "";
Dictionary<int, Dictionary<string, string>> dicb = new Dictionary<int, Dictionary<string, string>>();
if (dica[1].ContainsKey("hash") && dica[1]["hash"] != "")
{
while (true)
{
var b = oc.getProgress(dica[1]["hash"]);
dicb = oc.getXml2Dic(b);
if (dicb[2].ContainsKey("code") && dicb[2]["code"] == "100")
{
break;
}
System.Threading.Thread.Sleep(5000);
}
directDownloadURL = dicb[1]["directDownload"];
}
if (directDownloadURL != "")
{
using (WebClient Client = new WebClient ())
{
var webClient = new WebClient();
webClient.OpenRead(directDownloadURL);
string header_contentDisposition = webClient.ResponseHeaders["content-disposition"];
string filename = new ContentDisposition(header_contentDisposition).FileName;
filename = filename.Replace("\"", "");
webClient.DownloadFile(directDownloadURL, filename);
}
}
}