Ejemplo n.º 1
0
 private T parseHGData <T>(String json_data)
 {
     if (json_data != null)
     {
         JObject jo     = JObject.Parse(json_data);
         int     status = jo.ContainsKey("status") ? Convert.ToInt32(jo["status"].ToString()) : 0;
         if (status == 200)
         {
             HGResponse <T> hgr = JsonNewtonsoft.FromJSON <HGResponse <T> >(json_data);
             return(hgr.Data);
         }
         else
         {
             throw new Exception(jo.ContainsKey("msg") ? jo["msg"].ToString() : "未知错误:" + json_data);
         }
     }
     return(default(T));
 }
Ejemplo n.º 2
0
        public HGCaptcha getHGCaptcha()
        {
            String captchaUrl = "/platform/login/getImage";

            try
            {
                String res = HttpHelper.HttpPostData(BaseUrl + captchaUrl, null);
                if (res != null)
                {
                    HGResponse <HGCaptcha> hgr = JsonNewtonsoft.FromJSON <HGResponse <HGCaptcha> >(res);
                    return(hgr.Data);
                }
            }
            catch (System.Net.WebException we)
            {
                System.Windows.Forms.MessageBox.Show(we.Message);
            }
            return(null);
        }