From feb8343bc6cbf57c4ccf1dcbd963bc4b77aff71f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=AB=A5=E6=AF=93=E6=B3=BD?= <13204402429@stu.ecnu.edu.cn>
Date: Sun, 17 Jan 2021 21:51:27 +0800
Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?=
=?UTF-8?q?=20'App.code/Login'?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
App.code/Login/HttpMethods.cs | 246 +++++++++++++++
App.code/Login/QQConfig.cs | 44 +++
App.code/Login/Utils.cs | 694 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 984 insertions(+)
create mode 100644 App.code/Login/HttpMethods.cs
create mode 100644 App.code/Login/QQConfig.cs
create mode 100644 App.code/Login/Utils.cs
diff --git a/App.code/Login/HttpMethods.cs b/App.code/Login/HttpMethods.cs
new file mode 100644
index 0000000..85ea5fc
--- /dev/null
+++ b/App.code/Login/HttpMethods.cs
@@ -0,0 +1,246 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.IO;
+using System.Net;
+
+
+namespace basic
+{
+ public class HttpMethods
+ {
+
+ #region POST
+ ///
+ /// HTTP POST方式请求数据
+ ///
+ /// URL.
+ /// POST的数据
+ ///
+ public static string HttpPost(string url, string param)
+ {
+ HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
+ request.Method = "POST";
+ request.ContentType = "application/x-www-form-urlencoded";
+ request.Accept = "*/*";
+ request.Timeout = 15000;
+ request.AllowAutoRedirect = false;
+
+ StreamWriter requestStream = null;
+ WebResponse response = null;
+ string responseStr = null;
+
+ try
+ {
+ requestStream = new StreamWriter(request.GetRequestStream());
+ requestStream.Write(param);
+ requestStream.Close();
+
+ response = request.GetResponse();
+ if (response != null)
+ {
+ StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
+ responseStr = reader.ReadToEnd();
+ reader.Close();
+ }
+ }
+ catch (Exception)
+ {
+ throw;
+ }
+ finally
+ {
+ request = null;
+ requestStream = null;
+ response = null;
+ }
+
+ return responseStr;
+ }
+ #endregion
+
+ #region Get
+ ///
+ /// HTTP GET方式请求数据.
+ ///
+ /// URL.
+ ///
+ public static string HttpGet(string url)
+ {
+ HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
+ request.Method = "GET";
+ //request.ContentType = "application/x-www-form-urlencoded";
+ request.Accept = "*/*";
+ request.Timeout = 15000;
+ request.AllowAutoRedirect = false;
+
+ WebResponse response = null;
+ string responseStr = null;
+
+ try
+ {
+ response = request.GetResponse();
+
+ if (response != null)
+ {
+ StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
+ responseStr = reader.ReadToEnd();
+ reader.Close();
+ }
+ }
+ catch (Exception)
+ {
+ throw;
+ }
+ finally
+ {
+ request = null;
+ response = null;
+ }
+
+ return responseStr;
+ }
+ #endregion
+
+ #region Post With Pic
+ private string HttpPost(string url, IDictionary