diff --git a/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project.exe b/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project.exe
index 62cdd49..9c18679 100644
Binary files a/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project.exe and b/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project.exe differ
diff --git a/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project2.exe b/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project2.exe
index ef6e5b8..5651bc4 100644
Binary files a/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project2.exe and b/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project2.exe differ
diff --git a/Bin/Debug/CommonControls/.NET4 示例/MyDb.dll b/Bin/Debug/CommonControls/.NET4 示例/MyDb.dll
index 9a39504..2a99a45 100644
Binary files a/Bin/Debug/CommonControls/.NET4 示例/MyDb.dll and b/Bin/Debug/CommonControls/.NET4 示例/MyDb.dll differ
diff --git a/Bin/Debug/CommonControls/.NET4 示例/MyDb.xml b/Bin/Debug/CommonControls/.NET4 示例/MyDb.xml
index 30dc812..5fe694c 100644
--- a/Bin/Debug/CommonControls/.NET4 示例/MyDb.xml
+++ b/Bin/Debug/CommonControls/.NET4 示例/MyDb.xml
@@ -8550,6 +8550,95 @@
CookieCollection格式的Cookie集合同时也返回String类型的cookie
+
+
+ Http服务器类
+
+
+
+
+
+
+
+
+
+
+
+ 当收到Get事件时激发
+
+
+
+
+ 当收到Post事件时激发
+
+
+
+
+ 监听的主机,默认是localhost
+
+
+
+
+ 最后一次错误信息
+
+
+
+
+ 在此端口建立Http服务类
+
+ 端口号
+
+
+
+
+
+
+
+
+
+ 开始服务
+
+
+
+
+ 退出服务
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Bin/Debug/CommonControls/.NET4 示例/MyDb_SQLite.dll b/Bin/Debug/CommonControls/.NET4 示例/MyDb_SQLite.dll
index 92809c1..6628d3c 100644
Binary files a/Bin/Debug/CommonControls/.NET4 示例/MyDb_SQLite.dll and b/Bin/Debug/CommonControls/.NET4 示例/MyDb_SQLite.dll differ
diff --git a/Bin/Debug/CommonControls/.NET4 示例/RyPrint.dll b/Bin/Debug/CommonControls/.NET4 示例/RyPrint.dll
index 436d3e2..fc2b373 100644
Binary files a/Bin/Debug/CommonControls/.NET4 示例/RyPrint.dll and b/Bin/Debug/CommonControls/.NET4 示例/RyPrint.dll differ
diff --git a/Bin/Debug/CommonControls/.NET4 示例/UserDb/Win.dat b/Bin/Debug/CommonControls/.NET4 示例/UserDb/Win.dat
index de7db3f..156becd 100644
--- a/Bin/Debug/CommonControls/.NET4 示例/UserDb/Win.dat
+++ b/Bin/Debug/CommonControls/.NET4 示例/UserDb/Win.dat
@@ -1,2 +1,2 @@
[Money_Op]
-hwnd=921334
+hwnd=3813034
diff --git a/Bin/Debug/CommonControls/.NET4 示例/cUpdate.dat b/Bin/Debug/CommonControls/.NET4 示例/cUpdate.dat
index 9a9eea1..e0b2a4b 100644
--- a/Bin/Debug/CommonControls/.NET4 示例/cUpdate.dat
+++ b/Bin/Debug/CommonControls/.NET4 示例/cUpdate.dat
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/Bin/Debug/CommonControls/.NET4 示例/ryControls.dll b/Bin/Debug/CommonControls/.NET4 示例/ryControls.dll
index b218f12..052ef31 100644
Binary files a/Bin/Debug/CommonControls/.NET4 示例/ryControls.dll and b/Bin/Debug/CommonControls/.NET4 示例/ryControls.dll differ
diff --git a/Bin/Debug/CommonControls/.NET4 示例/ryUpdate.dll b/Bin/Debug/CommonControls/.NET4 示例/ryUpdate.dll
index 8cf6719..63717ef 100644
Binary files a/Bin/Debug/CommonControls/.NET4 示例/ryUpdate.dll and b/Bin/Debug/CommonControls/.NET4 示例/ryUpdate.dll differ
diff --git a/Bin/Debug/CommonControls/.NET4/MyDb.dll b/Bin/Debug/CommonControls/.NET4/MyDb.dll
index 9a39504..2a99a45 100644
Binary files a/Bin/Debug/CommonControls/.NET4/MyDb.dll and b/Bin/Debug/CommonControls/.NET4/MyDb.dll differ
diff --git a/Bin/Debug/CommonControls/.NET4/MyDb.xml b/Bin/Debug/CommonControls/.NET4/MyDb.xml
index 30dc812..5fe694c 100644
--- a/Bin/Debug/CommonControls/.NET4/MyDb.xml
+++ b/Bin/Debug/CommonControls/.NET4/MyDb.xml
@@ -8550,6 +8550,95 @@
CookieCollection格式的Cookie集合同时也返回String类型的cookie
+
+
+ Http服务器类
+
+
+
+
+
+
+
+
+
+
+
+ 当收到Get事件时激发
+
+
+
+
+ 当收到Post事件时激发
+
+
+
+
+ 监听的主机,默认是localhost
+
+
+
+
+ 最后一次错误信息
+
+
+
+
+ 在此端口建立Http服务类
+
+ 端口号
+
+
+
+
+
+
+
+
+
+ 开始服务
+
+
+
+
+ 退出服务
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Bin/Debug/CommonControls/.NET4/MyDb_MySQL.dll b/Bin/Debug/CommonControls/.NET4/MyDb_MySQL.dll
index e737a8e..60906ce 100644
Binary files a/Bin/Debug/CommonControls/.NET4/MyDb_MySQL.dll and b/Bin/Debug/CommonControls/.NET4/MyDb_MySQL.dll differ
diff --git a/Bin/Debug/CommonControls/.NET4/MyDb_SQLite.dll b/Bin/Debug/CommonControls/.NET4/MyDb_SQLite.dll
index 92809c1..6628d3c 100644
Binary files a/Bin/Debug/CommonControls/.NET4/MyDb_SQLite.dll and b/Bin/Debug/CommonControls/.NET4/MyDb_SQLite.dll differ
diff --git a/Bin/Debug/CommonControls/.NET4/RyPrint.dll b/Bin/Debug/CommonControls/.NET4/RyPrint.dll
index 436d3e2..fc2b373 100644
Binary files a/Bin/Debug/CommonControls/.NET4/RyPrint.dll and b/Bin/Debug/CommonControls/.NET4/RyPrint.dll differ
diff --git a/Bin/Debug/CommonControls/.NET4/ryControls.dll b/Bin/Debug/CommonControls/.NET4/ryControls.dll
index b218f12..052ef31 100644
Binary files a/Bin/Debug/CommonControls/.NET4/ryControls.dll and b/Bin/Debug/CommonControls/.NET4/ryControls.dll differ
diff --git a/Bin/Debug/CommonControls/.NET4/ryUpdate.dll b/Bin/Debug/CommonControls/.NET4/ryUpdate.dll
index 8cf6719..63717ef 100644
Binary files a/Bin/Debug/CommonControls/.NET4/ryUpdate.dll and b/Bin/Debug/CommonControls/.NET4/ryUpdate.dll differ
diff --git a/Bin/Release/CommonControls/.NET4 示例/Itrycn_Project.exe b/Bin/Release/CommonControls/.NET4 示例/Itrycn_Project.exe
index 6d2df9a..af67275 100644
Binary files a/Bin/Release/CommonControls/.NET4 示例/Itrycn_Project.exe and b/Bin/Release/CommonControls/.NET4 示例/Itrycn_Project.exe differ
diff --git a/Bin/Release/CommonControls/.NET4 示例/MyDb.dll b/Bin/Release/CommonControls/.NET4 示例/MyDb.dll
index ce89e4b..92e3616 100644
Binary files a/Bin/Release/CommonControls/.NET4 示例/MyDb.dll and b/Bin/Release/CommonControls/.NET4 示例/MyDb.dll differ
diff --git a/Bin/Release/CommonControls/.NET4 示例/MyDb.xml b/Bin/Release/CommonControls/.NET4 示例/MyDb.xml
index ff4ff29..26d7569 100644
--- a/Bin/Release/CommonControls/.NET4 示例/MyDb.xml
+++ b/Bin/Release/CommonControls/.NET4 示例/MyDb.xml
@@ -8523,6 +8523,95 @@
CookieCollection格式的Cookie集合同时也返回String类型的cookie
+
+
+ Http服务器类
+
+
+
+
+
+
+
+
+
+
+
+ 当收到Get事件时激发
+
+
+
+
+ 当收到Post事件时激发
+
+
+
+
+ 监听的主机,默认是localhost
+
+
+
+
+ 最后一次错误信息
+
+
+
+
+ 在此端口建立Http服务类
+
+ 端口号
+
+
+
+
+
+
+
+
+
+ 开始服务
+
+
+
+
+ 退出服务
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Bin/Release/CommonControls/.NET4 示例/MyDb_SQLite.dll b/Bin/Release/CommonControls/.NET4 示例/MyDb_SQLite.dll
index 71db8a0..dd2dd83 100644
Binary files a/Bin/Release/CommonControls/.NET4 示例/MyDb_SQLite.dll and b/Bin/Release/CommonControls/.NET4 示例/MyDb_SQLite.dll differ
diff --git a/Bin/Release/CommonControls/.NET4 示例/RyPrint.dll b/Bin/Release/CommonControls/.NET4 示例/RyPrint.dll
index 69fe146..d91b2b7 100644
Binary files a/Bin/Release/CommonControls/.NET4 示例/RyPrint.dll and b/Bin/Release/CommonControls/.NET4 示例/RyPrint.dll differ
diff --git a/Bin/Release/CommonControls/.NET4 示例/ryControls.dll b/Bin/Release/CommonControls/.NET4 示例/ryControls.dll
index 8d66768..0381488 100644
Binary files a/Bin/Release/CommonControls/.NET4 示例/ryControls.dll and b/Bin/Release/CommonControls/.NET4 示例/ryControls.dll differ
diff --git a/Bin/Release/CommonControls/.NET4 示例/ryUpdate.dll b/Bin/Release/CommonControls/.NET4 示例/ryUpdate.dll
index ebbbe36..78faaf0 100644
Binary files a/Bin/Release/CommonControls/.NET4 示例/ryUpdate.dll and b/Bin/Release/CommonControls/.NET4 示例/ryUpdate.dll differ
diff --git a/Bin/Release/CommonControls/.NET4/MyDb.dll b/Bin/Release/CommonControls/.NET4/MyDb.dll
index ce89e4b..92e3616 100644
Binary files a/Bin/Release/CommonControls/.NET4/MyDb.dll and b/Bin/Release/CommonControls/.NET4/MyDb.dll differ
diff --git a/Bin/Release/CommonControls/.NET4/MyDb.xml b/Bin/Release/CommonControls/.NET4/MyDb.xml
index ff4ff29..26d7569 100644
--- a/Bin/Release/CommonControls/.NET4/MyDb.xml
+++ b/Bin/Release/CommonControls/.NET4/MyDb.xml
@@ -8523,6 +8523,95 @@
CookieCollection格式的Cookie集合同时也返回String类型的cookie
+
+
+ Http服务器类
+
+
+
+
+
+
+
+
+
+
+
+ 当收到Get事件时激发
+
+
+
+
+ 当收到Post事件时激发
+
+
+
+
+ 监听的主机,默认是localhost
+
+
+
+
+ 最后一次错误信息
+
+
+
+
+ 在此端口建立Http服务类
+
+ 端口号
+
+
+
+
+
+
+
+
+
+ 开始服务
+
+
+
+
+ 退出服务
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Bin/Release/CommonControls/.NET4/MyDb_MySQL.dll b/Bin/Release/CommonControls/.NET4/MyDb_MySQL.dll
index ee440e6..48d559a 100644
Binary files a/Bin/Release/CommonControls/.NET4/MyDb_MySQL.dll and b/Bin/Release/CommonControls/.NET4/MyDb_MySQL.dll differ
diff --git a/Bin/Release/CommonControls/.NET4/MyDb_SQLite.dll b/Bin/Release/CommonControls/.NET4/MyDb_SQLite.dll
index 71db8a0..dd2dd83 100644
Binary files a/Bin/Release/CommonControls/.NET4/MyDb_SQLite.dll and b/Bin/Release/CommonControls/.NET4/MyDb_SQLite.dll differ
diff --git a/Bin/Release/CommonControls/.NET4/RyPrint.dll b/Bin/Release/CommonControls/.NET4/RyPrint.dll
index 69fe146..d91b2b7 100644
Binary files a/Bin/Release/CommonControls/.NET4/RyPrint.dll and b/Bin/Release/CommonControls/.NET4/RyPrint.dll differ
diff --git a/Bin/Release/CommonControls/.NET4/ryControls.dll b/Bin/Release/CommonControls/.NET4/ryControls.dll
index 8d66768..0381488 100644
Binary files a/Bin/Release/CommonControls/.NET4/ryControls.dll and b/Bin/Release/CommonControls/.NET4/ryControls.dll differ
diff --git a/Bin/Release/CommonControls/.NET4/ryUpdate.dll b/Bin/Release/CommonControls/.NET4/ryUpdate.dll
index ebbbe36..78faaf0 100644
Binary files a/Bin/Release/CommonControls/.NET4/ryUpdate.dll and b/Bin/Release/CommonControls/.NET4/ryUpdate.dll differ
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 66557b7..9a936f6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,9 @@
-### 2022-02-20更新
+### 2022-02-21更新
+------
+#### MyDbV4 V3.0.2202.2101
+- *.[新增]新增HttpServer类,可以非常方便的建立http服务器。
+
+### 2022-02-20更新
------
#### MyDbV4 V3.0.2202.2001
- *.[新增]WebDecode类新增UrlToData和GetParam函数。
diff --git a/Source/.vs/公用控件组V4/v17/fileList.bin b/Source/.vs/公用控件组V4/v17/fileList.bin
index 12ebcba..85dcabf 100644
Binary files a/Source/.vs/公用控件组V4/v17/fileList.bin and b/Source/.vs/公用控件组V4/v17/fileList.bin differ
diff --git a/Source/Itrycn_Project2/FrmStart.cs b/Source/Itrycn_Project2/FrmStart.cs
index c38b99a..30ddd00 100644
--- a/Source/Itrycn_Project2/FrmStart.cs
+++ b/Source/Itrycn_Project2/FrmStart.cs
@@ -93,7 +93,6 @@ namespace Itrycn_Project2
{
Application.Exit();
}
-
private void FrmStart_Shown(object sender, EventArgs e)
{
ryCommon.Ini ini = new Ini(Soft_ConstInfo.UserDataFolder + "\\Win.dat");
diff --git a/Source/MyDb/MyDbV4.csproj b/Source/MyDb/MyDbV4.csproj
index cdfd8d6..a8ce5cc 100644
--- a/Source/MyDb/MyDbV4.csproj
+++ b/Source/MyDb/MyDbV4.csproj
@@ -136,6 +136,7 @@
Resources.resx
+
diff --git a/Source/MyDb/Properties/AssemblyInfo.cs b/Source/MyDb/Properties/AssemblyInfo.cs
index 5ac99b7..e3df86d 100644
--- a/Source/MyDb/Properties/AssemblyInfo.cs
+++ b/Source/MyDb/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("3.0.2202.2001")]
-[assembly: AssemblyFileVersion("3.0.2202.2001")]
\ No newline at end of file
+[assembly: AssemblyVersion("3.0.2202.2101")]
+[assembly: AssemblyFileVersion("3.0.2202.2101")]
\ No newline at end of file
diff --git a/Source/MyDb/RyWeb/HttpServer.cs b/Source/MyDb/RyWeb/HttpServer.cs
new file mode 100644
index 0000000..1aa41d3
--- /dev/null
+++ b/Source/MyDb/RyWeb/HttpServer.cs
@@ -0,0 +1,223 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading;
+
+namespace RyWeb
+{
+ ///
+ /// Http服务器类
+ ///
+ public class HttpServer
+ {
+ ///
+ ///
+ ///
+ ///
+ ///
+ public delegate void HttpRequestHandler(object sender, HttpRequest e);
+ ///
+ /// 当收到Get事件时激发
+ ///
+ [Description("当收到Get事件时激发")]
+ public event HttpRequestHandler OnHandleGETRequest;
+ ///
+ /// 当收到Post事件时激发
+ ///
+ [Description("当收到Post事件时激发")]
+ public event HttpRequestHandler OnHandlePOSTRequest;
+ private HttpListener listener;
+ private Thread httpThread;
+ private volatile bool stopped = false;
+ ///
+ /// 监听的主机,默认是localhost
+ ///
+ public string ListenerHost { get; set; } = "localhost";
+ private int port = 19955;
+ ///
+ /// 最后一次错误信息
+ ///
+ public string ErrorMessage { get;internal set; } = "";
+ ///
+ /// 在此端口建立Http服务类
+ ///
+ /// 端口号
+ public HttpServer(int port)
+ {
+ isrunning = false;
+ stopped = false;
+ try
+ {
+ listener = new HttpListener();
+ this.port= port;
+ listener.Prefixes.Add("http://"+ ListenerHost + ":" + port + "/");
+ //listener.Prefixes.Add(HTTPS_PREFIX + HTTPS_PORT + "/");
+ listener.Start();
+ httpThread = new Thread(new ThreadStart(Run));
+ httpThread.Start();
+ isrunning = true;
+ }
+ catch(Exception ex) { ErrorMessage = ex.Message; }
+ }
+ private bool isrunning = false;
+ ///
+ ///
+ ///
+ ///
+ public bool IsRunning()
+ {
+ return isrunning;
+ }
+ ///
+ /// 开始服务
+ ///
+ public void Start()
+ {
+ isrunning = false;
+ stopped = false;
+ try
+ {
+ if (listener == null || !listener.IsListening)
+ {
+ listener = new HttpListener();
+ listener.Prefixes.Add("http://"+ ListenerHost + ":" + port + "/");
+ //listener.Prefixes.Add(HTTPS_PREFIX + HTTPS_PORT + "/");
+ listener.Start();
+ }
+ if (httpThread == null || httpThread.ThreadState != ThreadState.Running)
+ {
+ httpThread = new Thread(new ThreadStart(Run));
+ httpThread.Start();
+ }
+ isrunning = true;
+ }
+ catch(Exception ex) { ErrorMessage = ex.Message; }
+ }
+ ///
+ /// 退出服务
+ ///
+ public void Exit()
+ {
+ stopped = true;
+ try
+ {
+ if (listener != null)
+ {
+ listener.Stop();
+ listener.Close();
+ }
+ if (httpThread != null)
+ {
+ httpThread.Interrupt();
+ }
+ listener = null;
+ httpThread = null;
+ }
+ catch (Exception ex) { ErrorMessage = ex.Message; }
+ isrunning = false;
+ }
+ ///
+ ///
+ ///
+ ~HttpServer()
+ {
+ Exit();
+ }
+ private void Run()
+ {
+ while (!stopped)
+ {
+ try
+ {
+ var r = listener.BeginGetContext(new AsyncCallback(RequestHandler), listener);
+ r.AsyncWaitHandle.WaitOne();
+ r.AsyncWaitHandle.Close();
+ }
+ catch (ThreadInterruptedException e1) { ErrorMessage = e1.Message; }
+ catch (HttpListenerException e2)
+ {
+ ErrorMessage = e2.Message;
+ }
+ }
+ }
+ private void RequestHandler(IAsyncResult r)
+ {
+ try
+ {
+ _RequestHandler(r);
+ }
+ catch (Exception e)
+ {
+ ErrorMessage = e.Message;
+ }
+ }
+ private void _RequestHandler(IAsyncResult r)
+ {
+ if (stopped) return;
+ var l = (HttpListener)r.AsyncState;
+ var ctx = l.EndGetContext(r);
+ var req = ctx.Request;
+ var resp = ctx.Response;
+ var html = "";
+ if(req.HttpMethod=="GET")
+ {
+ HttpRequest e = new HttpRequest();
+ e.Url = req.Url;
+ e.UrlReferrer = req.UrlReferrer;
+ OnHandleGETRequest?.Invoke(this,e);
+ resp.StatusCode = (int)e.StatusCode;
+ html = e.ReturnHtml;
+ }
+ else if(req.HttpMethod=="POST")
+ {
+ HttpRequest e = new HttpRequest
+ {
+ Url = req.Url,
+ UrlReferrer = req.UrlReferrer
+ };
+ var sr = new StreamReader(req.InputStream, Encoding.GetEncoding("GB2312"));
+ e.PostData= sr.ReadToEnd();
+ sr.Close();
+ OnHandlePOSTRequest?.Invoke(this, e);
+ resp.StatusCode = (int)e.StatusCode;
+ html = e.ReturnHtml;
+ }
+ var buffer = Encoding.UTF8.GetBytes(html);
+ resp.ContentLength64 = buffer.Length;
+ resp.OutputStream.Write(buffer, 0, buffer.Length);
+ var outs = resp.OutputStream;
+ outs.Close();
+ resp.Close();
+ }
+ }
+ ///
+ ///
+ ///
+ public class HttpRequest
+ {
+ ///
+ ///
+ ///
+ public Uri Url { get; internal set; }
+ ///
+ ///
+ ///
+ public string PostData { get; internal set; } = "";
+ ///
+ ///
+ ///
+ public Uri UrlReferrer { get; internal set; }
+ ///
+ ///
+ ///
+ public string ReturnHtml { get; set; } = "";
+ ///
+ ///
+ ///
+ public HttpStatusCode StatusCode { get; set; } = HttpStatusCode.OK;
+ }
+}