protected async Task <string> GetHtml(string uri) { try { string html = await HttpBaseService.GetStringAsync(uri); //byte[] bytes = Encoding.UTF8.GetBytes(html); //html = Encoding.GetEncoding("GBK").GetString(bytes); return(html); } catch (Exception e) { #if DEBUG System.Diagnostics.Debug.WriteLine(e.Message); #endif return(null); } }
/// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="uri"></param> /// <returns></returns> protected async Task <T> GetJsonByUri <T>(string uri) where T : class { try { string json = await HttpBaseService.GetStringAsync(uri); if (json != null) { return(JsonHelper.Deserlialize <T>(json)); } else { return(null); } } catch (Exception e) { #if DEBUG System.Diagnostics.Debug.WriteLine("ApiBaseService.GetJsonByUri : " + e.Message); #endif return(null); } }