protected override void loadRequest() { QueryParameters.Clear(); BodyParameters.Clear(); if (After != null) { QueryParameters.Add("after", new List <string>(new string[] { After })); } if (Before != null) { QueryParameters.Add("before", new List <string>(new string[] { Before })); } if (First != 20) { QueryParameters.Add("first", new List <string>(new string[] { First + "" })); } if (GameID.Count != 0) { QueryParameters.Add("game_id", GameID); } if (Language.Count != 0) { QueryParameters.Add("language", Language); } if (UserID.Count != 0) { QueryParameters.Add("user_id", UserID); } if (UserLogin.Count != 0) { QueryParameters.Add("user_login", UserLogin); } }
protected string BuildQueryParams() { QueryParameters = QueryParameters.Distinct().ToList(); var prerp = new List <KeyValuePair <string, string> >(); if (QueryParameters.Where(i => i.Key == "id").Count() > 1) { foreach (var m in QueryParameters) { if (m.Key == "id") { prerp.Add(new KeyValuePair <string, string>("id[]", m.Value)); } else { prerp.Add(m); } } QueryParameters = prerp; } if (QueryParameters.FirstOrDefault(x => x.Key == "limit_offset").Key != null & QueryParameters.FirstOrDefault(x => x.Key == "limit_rows").Key == null) { throw new IncorectQueryException("Запрос Offset без установленного Limit"); } var result = new FormUrlEncodedContent(QueryParameters).ReadAsStringAsync().Result; QueryParameters.Clear(); return(String.IsNullOrEmpty(result) ? "" : "?" + result); }
public override Task <dynamic> ExecuteAsync() { if (string.IsNullOrEmpty(_assetId)) { throw new SdkException(IdIsRequired); } QueryParameters.Clear(); QueryParameters.Add(AutoDownloadString, false); Path = string.Format(DownloadsPathString, _assetId); return(base.ExecuteAsync()); }
protected override void loadRequest() { QueryParameters.Clear(); BodyParameters.Clear(); if (UserIDs.Length != 0) { List <string> ids = new List <string>(UserIDs); QueryParameters.Add("id", ids); } if (LoginNames.Length != 0) { List <string> names = new List <string>(LoginNames); QueryParameters.Add("login", names); } }
private void PrepareParameters(string orderNo, string payType, int amount, string itemName) { if (QueryParameters.Count > 0) { QueryParameters.Clear(); } QueryParameters["pay_memberid"] = AppId; QueryParameters["pay_orderid"] = orderNo; QueryParameters["pay_amount"] = (amount / 100.0f).ToString("F2"); QueryParameters["pay_applydate"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); QueryParameters["pay_bankcode"] = ToBankCode(payType); QueryParameters["pay_notifyurl"] = NotifyUri; QueryParameters["pay_callbackurl"] = "http://www.baidu.com"; QueryParameters["pay_md5sign"] = CalculateSign(); QueryParameters["tongdao"] = ToTongDaoCode(payType); }
protected override void loadRequest() { QueryParameters.Clear(); BodyParameters.Clear(); BodyParameters["broadcaster_id"] = BroadcasterID; switch (Length) { case TwitchCommercialLength.TIME180: BodyParameters["length"] = 180; break; case TwitchCommercialLength.TIME150: BodyParameters["length"] = 150; break; case TwitchCommercialLength.TIME120: BodyParameters["length"] = 120; break; case TwitchCommercialLength.TIME90: BodyParameters["length"] = 90; break; case TwitchCommercialLength.TIME60: BodyParameters["length"] = 60; break; case TwitchCommercialLength.TIME30: default: BodyParameters["length"] = 30; break; } }
private void ParseUrl(bool throwException) { Match match = _regex.Match(Url); UserControl = ""; IsDataControl = false; NavigateTo = false; ShowHistory = false; IsSelect = false; ShowFilter = false; IsMultipleSelect = false; IsNew = false; IsRead = false; IsDownload = false; IsExecute = false; IsFilterWindow = false; IsCustomUserControl = false; QueryParameters.Clear(); ParameterConverter.Clear(); ControlFilterParameters.Clear(); SelectParameters = null; BackUrl = ""; Query = ""; SelectedValues = ""; FilterQuery = null; if (!match.Success) { match = _regex2.Match(Url); if (!match.Success) { return; } } Page = match.Groups["page"].Value; PageExt = match.Groups["pageExt"].Value; if (match.Groups["type"].Success) { if (match.Groups["type"].Value.Equals("data/")) { IsDataControl = true; } else if (match.Groups["type"].Value.Equals("navigateto/")) { NavigateTo = true; } else if (match.Groups["type"].Value.Equals("download/")) { IsDownload = true; } else if (match.Groups["type"].Value.Equals("execute/")) { IsExecute = true; } else if (match.Groups["type"].Value.Equals("custom/")) { IsCustomUserControl = true; } } if ((IsDataControl || NavigateTo) && !match.Groups["usercontrol"].Success) { if (throwException) { throw new Exception("Not set UserControls in url"); } IsDataControl = false; NavigateTo = false; return; } if (match.Groups["usercontrol"].Success) { var setUC = true; if (!match.Groups["type"].Success) { if (match.Groups["usercontrol"].Value.Equals("download")) { IsDownload = true; setUC = false; } else if (match.Groups["usercontrol"].Value.Equals("execute")) { IsExecute = true; setUC = false; } } if (setUC) { UserControl = HttpUtility.UrlDecode(match.Groups["usercontrol"].Value); } } var dic = new Dictionary <string, string>(); if (IsCustomUserControl) { UserControl += match.Groups["param1"].Success ? HttpUtility.UrlDecode(match.Groups["param1"].Value) : ""; } else { AddParam(match, dic, "param1"); } AddParam(match, dic, "param2"); AddParam(match, dic, "param3"); AddParam(match, dic, "param4"); AddParam(match, dic, "param5"); ShowHistory = dic.ContainsKey("showhistory"); IsMultipleSelect = dic.ContainsKey("multipleselect"); IsSelect = dic.ContainsKey("select") || IsMultipleSelect; ShowFilter = dic.ContainsKey("showfilter"); IsNew = dic.ContainsKey("new"); IsRead = dic.ContainsKey("read"); IsFilterWindow = dic.ContainsKey("filter"); if (match.Groups["query"].Success) { Query = match.Groups["query"].Value; ParseQuery(); } }
protected override void loadRequest() { QueryParameters.Clear(); BodyParameters.Clear(); QueryParameters.Add("emotesets", new List <string>(new string[] { SetID })); }