当前位置: 首页>>代码示例>>C#>>正文


C# HttpRequest.AddUrlParam方法代码示例

本文整理汇总了C#中HttpRequest.AddUrlParam方法的典型用法代码示例。如果您正苦于以下问题:C# HttpRequest.AddUrlParam方法的具体用法?C# HttpRequest.AddUrlParam怎么用?C# HttpRequest.AddUrlParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HttpRequest的用法示例。


在下文中一共展示了HttpRequest.AddUrlParam方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: docs_save

        public static dynamic docs_save(string path_file, string name_doc = "Unknown", string v = "5.21")
        {
            Dictionary<string, dynamic> result;
            string error = "";

            var request = new HttpRequest();
            request.AddUrlParam("access_token", Settings1.Default.token);
            request.AddUrlParam("v", v);

            try
            {
                string content = request.Get(uri_api + "docs.getUploadServer").ToString();
                result = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(content);
                string url_upload = result["response"]["upload_url"];

                request = new HttpRequest();
                request.AddFile("file", path_file);
                content = request.Post(url_upload).ToString();
                result = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(content);

                request = new HttpRequest();
                request.AddUrlParam("file", result["file"]);
                request.AddUrlParam("title", name_doc.Replace(".jpg", ""));
                request.AddUrlParam("access_token", Settings1.Default.token);
                request.AddUrlParam("v", v);

                content = request.Get(uri_api + "docs.save").ToString();
                result = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(content);
                string result_string = "doc" + result["response"][0]["owner_id"] + "_" + result["response"][0]["id"];
                return result_string;
            }
            catch (Exception ex)
            {
                MessageBox.Show(error = ex.Message + " " + ex.InnerException);
                return null;
            }
        }
开发者ID:QAsMD,项目名称:BDZ,代码行数:37,代码来源:lib_vk.cs

示例2: friends_get

        public static dynamic friends_get(string id_user, string fields = "screen_name, photo_max_orig")
        {
            Dictionary<string, dynamic> result;
            string error;

            var request = new HttpRequest();
            request.AddUrlParam("user_ids", id_user);
            request.AddUrlParam("order", "hints");
            request.AddUrlParam("fields", fields);
            request.AddUrlParam("access_token", Settings1.Default.token);
            try
            {
                string content = request.Get(uri_api + "friends.get").ToString();
                result = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(content);

                return result["response"];
            }
            catch (Exception ex)
            {
                MessageBox.Show(error = ex.Message + " " + ex.InnerException);
                return null;
            }
        }
开发者ID:QAsMD,项目名称:BDZ,代码行数:23,代码来源:lib_vk.cs

示例3: getUploadServer

 private static dynamic getUploadServer(string group_id = "", string v = "5.21")
 {
     Dictionary<string, dynamic> result;
     string error = "";
     var request = new HttpRequest();
     request.AddUrlParam("group_id", group_id);
     request.AddUrlParam("v", v);
     request.AddUrlParam("access_token", Settings1.Default.token);
     try
     {
         string content = request.Get(uri_api + "docs.getUploadServer").ToString();
         result = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(content);
         return result["response"]["upload_url"];
     }
     catch (Exception ex)
     {
         MessageBox.Show(error = ex.Message + " " + ex.InnerException);
         return null;
     }
 }
开发者ID:QAsMD,项目名称:BDZ,代码行数:20,代码来源:lib_vk.cs

示例4: message_send

 public static dynamic message_send(string user_id, string message = "Привет от Шарпов", string attachment = "doc21881340_285976245")
 {
     Dictionary<string, dynamic> result;
     string error = "";
     var request = new HttpRequest();
     request.AddUrlParam("user_id", user_id);
     request.AddUrlParam("message", message);
     request.AddUrlParam("attachment", attachment);
     request.AddUrlParam("access_token", Settings1.Default.token);
     try
     {
         string content = request.Get(uri_api + "messages.send").ToString();
         result = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(content);
         return result["response"];
     }
     catch (Exception ex)
     {
         MessageBox.Show(error = ex.Message + " " + ex.InnerException);
         return null;
     }
 }
开发者ID:QAsMD,项目名称:BDZ,代码行数:21,代码来源:lib_vk.cs

示例5: messages_history

        public static dynamic messages_history(string id_user, string v="5.21")
        {
            Dictionary<string, dynamic> result;
            string error = "";

            var request = new HttpRequest();
            request.AddUrlParam("user_id", id_user);
            request.AddUrlParam("access_token", Settings1.Default.token);
            request.AddUrlParam("v", v);

            try
            {
                string content = request.Get(uri_api + "messages.getHistory").ToString();
                result = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(content);
                return result["response"];
            }
            catch (Exception ex)
            {
                MessageBox.Show(error = ex.Message + " " + ex.InnerException);
                return null;
            }
        }
开发者ID:QAsMD,项目名称:BDZ,代码行数:22,代码来源:lib_vk.cs

示例6: messages_get

        public static dynamic messages_get(string count = "20")
        {
            Dictionary<string, dynamic> result;
            string error = "";
            var request = new HttpRequest();
            request.AddUrlParam("out", "0");
            request.AddUrlParam("access_token", Settings1.Default.token);
            request.AddUrlParam("count", count);
            request.AddUrlParam("time_offset", "0");

            try
            {
                string content = request.Get(uri_api + "messages.get").ToString();
                result = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(content);
                return result["response"];
            }
            catch (Exception ex)
            {
                MessageBox.Show(error = ex.Message + " " + ex.InnerException);
                return null;
            }
        }
开发者ID:QAsMD,项目名称:BDZ,代码行数:22,代码来源:lib_vk.cs


注:本文中的HttpRequest.AddUrlParam方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。