diff --git a/framework/Demo/Directory.Build.props b/framework/Demo/Directory.Build.props index 6dc68172c..44c1103ef 100644 --- a/framework/Demo/Directory.Build.props +++ b/framework/Demo/Directory.Build.props @@ -2,7 +2,6 @@ 3.0.0.27 latest - net6.0;net7.0 Diego ThingsGateway © 2023-present Diego diff --git a/framework/Demo/ThingsGateway.Foundation.Demo.Photino/ThingsGateway.Foundation.Demo.Photino.csproj b/framework/Demo/ThingsGateway.Foundation.Demo.Photino/ThingsGateway.Foundation.Demo.Photino.csproj index 3de262cc0..b53eb8b67 100644 --- a/framework/Demo/ThingsGateway.Foundation.Demo.Photino/ThingsGateway.Foundation.Demo.Photino.csproj +++ b/framework/Demo/ThingsGateway.Foundation.Demo.Photino/ThingsGateway.Foundation.Demo.Photino.csproj @@ -2,6 +2,7 @@ WinExe + net6.0;net7.0 favicon.ico @@ -28,5 +29,18 @@ + + + Always + + + Always + + + Always + + + + diff --git a/framework/Demo/ThingsGateway.Foundation.Demo.Rcl/wwwroot/favicon.ico b/framework/Demo/ThingsGateway.Foundation.Demo.Photino/wwwroot/favicon.ico similarity index 100% rename from framework/Demo/ThingsGateway.Foundation.Demo.Rcl/wwwroot/favicon.ico rename to framework/Demo/ThingsGateway.Foundation.Demo.Photino/wwwroot/favicon.ico diff --git a/framework/Demo/ThingsGateway.Foundation.Demo.Rcl/wwwroot/favicon.png b/framework/Demo/ThingsGateway.Foundation.Demo.Photino/wwwroot/favicon.png similarity index 100% rename from framework/Demo/ThingsGateway.Foundation.Demo.Rcl/wwwroot/favicon.png rename to framework/Demo/ThingsGateway.Foundation.Demo.Photino/wwwroot/favicon.png diff --git a/framework/Demo/ThingsGateway.Foundation.Demo.Rcl/wwwroot/index.html b/framework/Demo/ThingsGateway.Foundation.Demo.Photino/wwwroot/index.html similarity index 100% rename from framework/Demo/ThingsGateway.Foundation.Demo.Rcl/wwwroot/index.html rename to framework/Demo/ThingsGateway.Foundation.Demo.Photino/wwwroot/index.html diff --git a/framework/Demo/ThingsGateway.Foundation.Demo.Rcl/ThingsGateway.Foundation.Demo.Rcl.csproj b/framework/Demo/ThingsGateway.Foundation.Demo.Rcl/ThingsGateway.Foundation.Demo.Rcl.csproj index 8f8e1c02e..ef36e33a2 100644 --- a/framework/Demo/ThingsGateway.Foundation.Demo.Rcl/ThingsGateway.Foundation.Demo.Rcl.csproj +++ b/framework/Demo/ThingsGateway.Foundation.Demo.Rcl/ThingsGateway.Foundation.Demo.Rcl.csproj @@ -1,18 +1,19 @@  + + net6.0;net7.0 + + Pro - - - + - - + @@ -45,24 +46,26 @@ - - - - - - - - - - + + + + + + + + + + + + - + @@ -70,11 +73,18 @@ + + + + + + + - + @@ -143,20 +153,7 @@ - - - Always - - - - - - - - - - - + diff --git a/framework/Demo/ThingsGateway.Foundation.Demo.Winform/MainFrom.Designer.cs b/framework/Demo/ThingsGateway.Foundation.Demo.Winform/MainFrom.Designer.cs index da0e2cf1b..5ce5314df 100644 --- a/framework/Demo/ThingsGateway.Foundation.Demo.Winform/MainFrom.Designer.cs +++ b/framework/Demo/ThingsGateway.Foundation.Demo.Winform/MainFrom.Designer.cs @@ -51,7 +51,7 @@ namespace ThingsGateway.Foundation.Demo.Winform // blazorWebView1.Dock = DockStyle.Fill; blazorWebView1.Location = new Point(0, 0); - blazorWebView1.Margin = new Padding(4, 4, 4, 4); + blazorWebView1.Margin = new Padding(4); blazorWebView1.Name = "blazorWebView1"; blazorWebView1.Size = new Size(1029, 529); blazorWebView1.TabIndex = 0; @@ -64,9 +64,10 @@ namespace ThingsGateway.Foundation.Demo.Winform ClientSize = new Size(1029, 529); Controls.Add(blazorWebView1); Icon = (Icon)resources.GetObject("$this.Icon"); - Margin = new Padding(4, 4, 4, 4); + Margin = new Padding(4); Name = "MainFrom"; Text = "Form1"; + FormClosed += MainFrom_FormClosed; ResumeLayout(false); } diff --git a/framework/Demo/ThingsGateway.Foundation.Demo.Winform/MainFrom.cs b/framework/Demo/ThingsGateway.Foundation.Demo.Winform/MainFrom.cs index cf6675d05..47f76b26d 100644 --- a/framework/Demo/ThingsGateway.Foundation.Demo.Winform/MainFrom.cs +++ b/framework/Demo/ThingsGateway.Foundation.Demo.Winform/MainFrom.cs @@ -32,5 +32,10 @@ namespace ThingsGateway.Foundation.Demo.Winform this.Text = "ThingsGateway.Foundation.Demo"; blazorWebView1.RootComponents.Add("#app"); } + + private void MainFrom_FormClosed(object sender, FormClosedEventArgs e) + { + Application.Exit(); + } } } \ No newline at end of file diff --git a/framework/Demo/ThingsGateway.Foundation.Demo.Winform/ThingsGateway.Foundation.Demo.Winform.csproj b/framework/Demo/ThingsGateway.Foundation.Demo.Winform/ThingsGateway.Foundation.Demo.Winform.csproj index 4aaf1e4f9..2625b95fc 100644 --- a/framework/Demo/ThingsGateway.Foundation.Demo.Winform/ThingsGateway.Foundation.Demo.Winform.csproj +++ b/framework/Demo/ThingsGateway.Foundation.Demo.Winform/ThingsGateway.Foundation.Demo.Winform.csproj @@ -21,7 +21,7 @@ - + @@ -30,5 +30,18 @@ + + + Always + + + Always + + + Always + + + + diff --git a/framework/Demo/ThingsGateway.Foundation.Demo.Winform/wwwroot/favicon.ico b/framework/Demo/ThingsGateway.Foundation.Demo.Winform/wwwroot/favicon.ico new file mode 100644 index 000000000..d5a4939b2 Binary files /dev/null and b/framework/Demo/ThingsGateway.Foundation.Demo.Winform/wwwroot/favicon.ico differ diff --git a/framework/Demo/ThingsGateway.Foundation.Demo.Winform/wwwroot/favicon.png b/framework/Demo/ThingsGateway.Foundation.Demo.Winform/wwwroot/favicon.png new file mode 100644 index 000000000..e88c7d32f Binary files /dev/null and b/framework/Demo/ThingsGateway.Foundation.Demo.Winform/wwwroot/favicon.png differ diff --git a/framework/Demo/ThingsGateway.Foundation.Demo.Winform/wwwroot/index.html b/framework/Demo/ThingsGateway.Foundation.Demo.Winform/wwwroot/index.html new file mode 100644 index 000000000..ad052fdb8 --- /dev/null +++ b/framework/Demo/ThingsGateway.Foundation.Demo.Winform/wwwroot/index.html @@ -0,0 +1,41 @@ + + + + + + ThingsGateway.Foundation.Demo + + + + + + + + + + + + + + + +
+ +
+ + + An error has occurred. This application may no longer respond until reloaded. + + + An unhandled exception has occurred. See browser dev tools for details. + + + Reload + 🗙 +
+ + + + + + \ No newline at end of file diff --git a/framework/Foundation/ThingsGateway.Foundation/Foundation/DataHandleAdapter/ReadWriteDevicesTcpDataHandleAdapter.cs b/framework/Foundation/ThingsGateway.Foundation/Foundation/DataHandleAdapter/ReadWriteDevicesTcpDataHandleAdapter.cs index 03696dac2..3e21dce84 100644 --- a/framework/Foundation/ThingsGateway.Foundation/Foundation/DataHandleAdapter/ReadWriteDevicesTcpDataHandleAdapter.cs +++ b/framework/Foundation/ThingsGateway.Foundation/Foundation/DataHandleAdapter/ReadWriteDevicesTcpDataHandleAdapter.cs @@ -162,7 +162,7 @@ public abstract class ReadWriteDevicesTcpDataHandleAdapter : CustomDat Request = GetInstance(); Request.SendBytes = bytes; await GoSendAsync(bytes, 0, bytes.Length); - Logger?.Trace($"{FoundationConst.LogMessageHeader}{ToString()}- 发送:{Request.SendBytes.ToHexString(' ')}"); + Logger?.Trace($"{FoundationConst.LogMessageHeader}{ToString()}- 发送:{(IsHexData ? Request.SendBytes.ToHexString(' ') : Encoding.UTF8.GetString(Request.SendBytes))}"); } /// diff --git a/framework/Foundation/ThingsGateway.Foundation/TouchSocket/Socket/Components/Tcp/TcpService.cs b/framework/Foundation/ThingsGateway.Foundation/TouchSocket/Socket/Components/Tcp/TcpService.cs index ee1e8ea0e..f2087db9d 100644 --- a/framework/Foundation/ThingsGateway.Foundation/TouchSocket/Socket/Components/Tcp/TcpService.cs +++ b/framework/Foundation/ThingsGateway.Foundation/TouchSocket/Socket/Components/Tcp/TcpService.cs @@ -497,9 +497,21 @@ namespace ThingsGateway.Foundation.Sockets { Logger.Info($"{item.Option.IpHost}停止成功"); } + foreach (var item in GetClients()) + { + try + { + item.MainSocket?.Shutdown(SocketShutdown.Both); + item.SafeDispose(); + } + catch + { + } + } foreach (var item in this.m_monitors) { + item.Socket.SafeDispose(); item.SocketAsyncEvent.SafeDispose(); } @@ -540,6 +552,18 @@ namespace ThingsGateway.Foundation.Sockets if (disposing) { + foreach (var item in GetClients()) + { + try + { + item.MainSocket?.Shutdown(SocketShutdown.Both); + item.SafeDispose(); + } + catch + { + + } + } foreach (var item in this.m_monitors) { item.Socket.SafeDispose();