예제 #1
0
        /// <summary>
        /// Sends a http put to the specified address
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static void PutDataOnly <T>(string addr, T data, Dictionary <string, string> queryString, int timeout = 1000)
        {
            HttpWebResponse webResponse = WebAccess.PutData(addr, Serialization.ToJsonString <T>(data), queryString, timeout);

            if (webResponse != null)
            {
                webResponse.Close();
            }
        }
예제 #2
0
        /// <summary>
        /// Performs a request and directly returns the object type
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="addr"></param>
        /// <param name="queryString"></param>
        /// <param name="timeout"></param>
        /// <returns></returns>
        public static void RequestOnly(string addr, Dictionary <string, string> queryString, int timeout = 1000)
        {
            HttpWebResponse response = WebAccess.Request(addr, queryString, timeout);

            if (response != null)
            {
                response.Close();
            }
        }
예제 #3
0
        /// <summary>
        /// Performs a request and directly returns the object type
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="addr"></param>
        /// <param name="queryString"></param>
        /// <param name="timeout"></param>
        /// <returns></returns>
        public static T Request <T>(string addr, Dictionary <string, string> queryString, int timeout = 1000) where T : class
        {
            using (HttpWebResponse response = WebAccess.Request(addr, queryString, timeout))
            {
                if (response == null)
                {
                    return(null);
                }

                string data = response.ReadResponseStream();

                if (data == null)
                {
                    return(null);
                }

                return(Serialization.FromJsonString <T>(data));
            }
        }
예제 #4
0
 /// <summary>
 /// Sends a http put to the specified address
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public static HttpWebResponse PutData <T>(string addr, T data, Dictionary <string, string> queryString, int timeout = 1000)
 {
     return(WebAccess.PutData(addr, Serialization.ToJsonString <T>(data), queryString, timeout));
 }