Пример #1
0
        /// <summary>
        /// Http发送请求 匿名类型参数 返回泛型
        /// </summary>
        /// <param name="httpUri">请求地址</param>
        /// <param name="method">请求的方法</param>
        /// <param name="httpData">请求参数 匿名类型代替的JSON对象 例:var httpData = new {参数名1 = 参数值1,参数名2 = 参数值2}</param>
        /// <returns></returns>
        public static T HttpSend <T>(string httpUri, string method, object httpData)
        {
            var data = CoreConvert.ObjToJson(httpData);

            if (typeof(T) == typeof(string))
            {
                return((T)(object)HttpSend(httpUri, method, data));
            }
            return(CoreConvert.JsonToObj <T>(HttpSend(httpUri, method, data)));
        }
Пример #2
0
 /// <summary>
 /// 写入配置
 /// </summary>
 /// <param name="key">配置键</param>
 /// <param name="value">配置值</param>
 /// <param name="configPath">配置文件路径</param>
 /// <param name="endpoint">终结点(默认root)</param>
 /// <returns></returns>
 public static bool Wini(string key, object value, string configPath, string endpoint)
 {
     return(Wini(key, CoreConvert.ObjToJson(value), configPath, endpoint));
 }
Пример #3
0
        /// <summary>
        /// Http发送请求 匿名类型参数 返回字符串
        /// </summary>
        /// <param name="httpUri">请求地址</param>
        /// <param name="method">请求的方法</param>
        /// <param name="httpData">请求参数 匿名类型代替的JSON对象 例:var httpData = new {参数名1 = 参数值1,参数名2 = 参数值2}</param>
        /// <returns></returns>
        public static string HttpSend(string httpUri, string method, object httpData)
        {
            var data = CoreConvert.ObjToJson(httpData);

            return(HttpSend(httpUri, method, data));
        }
Пример #4
0
 /// <summary>
 /// 写入配置
 /// </summary>
 /// <param name="key">配置键</param>
 /// <param name="value">配置值</param>
 /// <param name="path">配置文件路径</param>
 /// <returns></returns>
 public static bool WriteCfg(string key, object value, string path)
 {
     return(WriteCfg(key, CoreConvert.ObjToJson(value), path));
 }