/// <summary> /// 获取get请求中的字节流数据 /// </summary> /// <param name="smartQQAPI"></param> /// <returns></returns> public Stream GetStreamAsync(SmartQQAPI smartQQAPI, params object[] ags) { Uri refuri = addRef(smartQQAPI); Stream result = httpClient.GetStreamAsync(smartQQAPI.BuildUrl(ags)).Result; reciveRef(refuri); return(result); }
/// <summary> /// 获取get请求中的字节流数据 /// </summary> /// <param name="smartQQAPI"></param> /// <returns></returns> public byte [] GetBytesAsync(SmartQQAPI smartQQAPI, params object[] ags) { Uri refuri = addRef(smartQQAPI); byte[] result = httpClient.GetByteArrayAsync(smartQQAPI.BuildUrl(ags)).Result; reciveRef(refuri); return(result); }
/// <summary> /// 获取get请求 /// </summary> /// <param name="smartQQAPI"></param> /// <returns></returns> public HttpResponseMessage GetAsync(SmartQQAPI smartQQAPI, params object[] ags) { Uri refuri = addRef(smartQQAPI); HttpResponseMessage result = httpClient.GetAsync(smartQQAPI.BuildUrl(ags)).Result; reciveRef(refuri); return(result); }
/// <summary> /// 获取get请求的json /// </summary> /// <param name="smartQQAPI"></param> /// <returns></returns> public JObject GetJsonAsync(SmartQQAPI smartQQAPI, params object[] ags) { Uri refuri = addRef(smartQQAPI); string result = httpClient.GetStringAsync(smartQQAPI.BuildUrl(ags)).Result; reciveRef(refuri); return((JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(result)); }
/// <summary> /// 获取对应url中的对应name的cookie /// </summary> /// <param name="url"></param> /// <param name="name"></param> /// <returns></returns> public string GetCookieByUrl(SmartQQAPI smartQQAPI, string name, params object [] ags) { CookieCollection cookies = null; if (ags.Length != 0) { cookies = CookieContainer.GetCookies(new Uri(smartQQAPI.BuildUrl(ags))); } else { cookies = CookieContainer.GetCookies(new Uri(smartQQAPI.Url)); } foreach (Cookie item in cookies) { if (item.Name.Equals(name)) { return(item.Value); } } return(""); }