本文整理汇总了C#中System.Net.WebClient.UploadValuesAsync方法的典型用法代码示例。如果您正苦于以下问题:C# System.Net.WebClient.UploadValuesAsync方法的具体用法?C# System.Net.WebClient.UploadValuesAsync怎么用?C# System.Net.WebClient.UploadValuesAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.WebClient
的用法示例。
在下文中一共展示了System.Net.WebClient.UploadValuesAsync方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Proxy
public Proxy(DBPostPlugin plugin)
{
this.plugin = plugin;
this.SortWorker = new RecordSortWorker();
this.Records = new List<Record>();
var proxy = KanColleClient.Current.Proxy;
var apis = Enum.GetValues(typeof(Api)).Cast<Api>().ToList();
foreach (var api in apis)
{
var url = api.GetUrl();
proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery
.StartsWith("/kcsapi/" + url))
.Subscribe(x =>
{
if (ToolSettings.SendDb && !string.IsNullOrEmpty(ToolSettings.DbAccessKey))
{
System.Collections.Specialized.NameValueCollection post
= new System.Collections.Specialized.NameValueCollection();
post.Add("token", ToolSettings.DbAccessKey);
post.Add("agent", "LZXNXVGPejgSnEXLH2ur");
post.Add("url", x.Request.PathAndQuery);
string requestBody = System.Text.RegularExpressions.Regex.Replace(
x.Request.BodyAsString,
@"&api(_|%5F)token=[0-9a-f]+|api(_|%5F)token=[0-9a-f]+&?", "");
post.Add("requestbody", requestBody);
post.Add("responsebody", x.Response.BodyAsString);
#if DEBUG
MessageBox.Show(
string.Join(
"\n", post.AllKeys.Select(key => key + ": " + post[key])),
"この内容を送信します");
#else
System.Net.WebClient wc = new System.Net.WebClient();
wc.UploadValuesAsync(new Uri("http://api.kancolle-db.net/2/"), post);
#endif
Records.Add(new Record(DateTime.Now, api, x));
this.UpdateRows();
if (ToolSettings.NotifyLog)
this.Notify(Notification.Types.Test, "送信しました", x.Request.PathAndQuery);
}
});
}
}