コード例 #1
0
        public PostData <L, E> GetPostData(string url, HttpTools tools)
        {
            HttpWebResponse res = Response(url, tools);

            if (res != null)
            {
                string          json     = DataSwitch.GetResponseString(res);
                PostData <L, E> postData = DataSwitch.JsonToObj <PostData <L, E> >(json);
                if (postData == null)
                {
                    return(new PostData <L, E>());
                }
                return(postData);
            }
            return(new PostData <L, E>());
        }
コード例 #2
0
        public string GetMsg(string url, HttpTools tools)
        {
            HttpWebResponse res = Response(url, tools);

            if (res != null)
            {
                string json = DataSwitch.GetResponseString(res);
                PostData <DBNull, DBNull> postData = DataSwitch.JsonToObj <PostData <DBNull, DBNull> >(json);
                if (postData == null)
                {
                    return("");
                }
                return(postData.Msg);
            }
            return("");
        }
コード例 #3
0
        public E GetEntity(string url, HttpTools tools)
        {
            HttpWebResponse res = Response(url, tools);

            if (res != null)
            {
                string json = DataSwitch.GetResponseString(res);
                PostData <DBNull, E> postData = DataSwitch.JsonToObj <PostData <DBNull, E> >(json);
                if (postData == null)
                {
                    return(new E());
                }
                return(postData.Entity);
            }
            return(new E());
        }
コード例 #4
0
        public List <L> GetList(string url, HttpTools tools)
        {
            HttpWebResponse res = Response(url, tools);

            if (res != null)
            {
                string json = DataSwitch.GetResponseString(res);
                PostData <L, DBNull> postData = DataSwitch.JsonToObj <PostData <L, DBNull> >(json);
                if (postData == null)
                {
                    return(new List <L>());
                }
                return(postData.DList);
            }

            return(new List <L>());
        }
コード例 #5
0
        private Stream ResponeStream(string url, HttpTools tools)
        {
            Stream s = HttpHelper.ResponseStream(url, tools.dic);

            return(s);
        }
コード例 #6
0
 private HttpWebResponse Response(string url, HttpTools tools)
 {
     return(HttpHelper.CreatePostHttpResponse(url, tools.dic, 3000, null));
 }