更新依赖

This commit is contained in:
2248356998 qq.com
2025-09-29 23:16:34 +08:00
parent bd4ce7c09b
commit 2522333a9c
12 changed files with 52 additions and 30 deletions

View File

@@ -29,7 +29,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.4" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.5" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="$(NET10Version)" /> <PackageReference Include="System.Text.Encoding.CodePages" Version="$(NET10Version)" />
</ItemGroup> </ItemGroup>

View File

@@ -8,6 +8,8 @@
// QQ群605534569 // QQ群605534569
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
using System.Buffers;
using ThingsGateway.Foundation.Extension.String; using ThingsGateway.Foundation.Extension.String;
using TouchSocket.SerialPorts; using TouchSocket.SerialPorts;
@@ -101,13 +103,17 @@ public static class ChannelOptionsExtensions
config.SetTransportOption(a => config.SetTransportOption(a =>
{ {
a.MaxBufferSize = 1024;
a.MinBufferSize = 512;
a.SendPipeOptions = new System.IO.Pipelines.PipeOptions( a.SendPipeOptions = new System.IO.Pipelines.PipeOptions(
minimumSegmentSize: 1024, minimumSegmentSize: 512,
pauseWriterThreshold: 1024,
resumeWriterThreshold: 512,
useSynchronizationContext: false); useSynchronizationContext: false);
a.ReceivePipeOptions = new System.IO.Pipelines.PipeOptions( a.ReceivePipeOptions = new System.IO.Pipelines.PipeOptions(
pauseWriterThreshold: 1024 * 1024, minimumSegmentSize: 512,
resumeWriterThreshold: 1024 * 512, pauseWriterThreshold: 1024,
minimumSegmentSize: 1024, resumeWriterThreshold: 512,
useSynchronizationContext: false); useSynchronizationContext: false);
}); });

View File

@@ -18,14 +18,20 @@ public static class JSRuntimeExtensions
{ {
await jsRuntime.InvokeVoidAsync("BlazorDiagrams.observe", element, reference, element.Id).ConfigureAwait(false); await jsRuntime.InvokeVoidAsync("BlazorDiagrams.observe", element, reference, element.Id).ConfigureAwait(false);
} }
catch (ObjectDisposedException) catch
{ {
// Ignore, DotNetObjectReference was likely disposed
} }
} }
public static async Task UnobserveResizes(this IJSRuntime jsRuntime, ElementReference element) public static async Task UnobserveResizes(this IJSRuntime jsRuntime, ElementReference element)
{ {
await jsRuntime.InvokeVoidAsync("BlazorDiagrams.unobserve", element, element.Id).ConfigureAwait(false); try
{
await jsRuntime.InvokeVoidAsync("BlazorDiagrams.unobserve", element, element.Id).ConfigureAwait(false);
}
catch
{
}
} }
} }

View File

@@ -10,7 +10,6 @@
using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Diagnosers; using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Jobs;
using Longbow.Modbus; using Longbow.Modbus;
using Longbow.TcpSocket; using Longbow.TcpSocket;
@@ -29,14 +28,14 @@ using ModbusMaster = ThingsGateway.Foundation.Modbus.ModbusMaster;
namespace ThingsGateway.Foundation; namespace ThingsGateway.Foundation;
[SimpleJob(RuntimeMoniker.Net80)] //[SimpleJob(RuntimeMoniker.Net80)]
//[SimpleJob(RuntimeMoniker.Net10_0)] //[SimpleJob(RuntimeMoniker.Net10_0)]
[MemoryDiagnoser] [MemoryDiagnoser]
public class ModbusBenchmark : IDisposable public class ModbusBenchmark : IDisposable
{ {
public static int ClientCount = 2; public static int ClientCount = 1;
public static int TaskNumberOfItems = 4; public static int TaskNumberOfItems = 4;
public static int NumberOfItems = 4; public static int NumberOfItems = 40;
private readonly List<IModbusClient> _lgbModbusClients = []; private readonly List<IModbusClient> _lgbModbusClients = [];
private List<ModbusMaster> thingsgatewaymodbuss = new(); private List<ModbusMaster> thingsgatewaymodbuss = new();
@@ -62,7 +61,7 @@ public class ModbusBenchmark : IDisposable
await clientChannel.SetupAsync(clientChannel.Config); await clientChannel.SetupAsync(clientChannel.Config);
clientChannel.Logger.LogLevel = LogLevel.Warning; clientChannel.Logger.LogLevel = LogLevel.Warning;
await thingsgatewaymodbus.ConnectAsync(CancellationToken.None); await thingsgatewaymodbus.ConnectAsync(CancellationToken.None);
await thingsgatewaymodbus.ReadAsync("40001", 100); await thingsgatewaymodbus.ModbusReadAsync(new ModbusAddress() { FunctionCode = 3, StartAddress = 0, Length = 100 });
thingsgatewaymodbuss.Add(thingsgatewaymodbus); thingsgatewaymodbuss.Add(thingsgatewaymodbus);
} }
@@ -145,7 +144,7 @@ public class ModbusBenchmark : IDisposable
public async Task LongbowModbus() public async Task LongbowModbus()
{ {
List<Task> tasks = new List<Task>(); List<Task> tasks = new List<Task>();
foreach (var _lgbModbusClient in _lgbModbusClients) foreach (var client in _lgbModbusClients)
{ {
for (int i = 0; i < TaskNumberOfItems; i++) for (int i = 0; i < TaskNumberOfItems; i++)
@@ -155,7 +154,12 @@ public class ModbusBenchmark : IDisposable
for (int i = 0; i < NumberOfItems; i++) for (int i = 0; i < NumberOfItems; i++)
{ {
using var cts = new CancellationTokenSource(3000); using var cts = new CancellationTokenSource(3000);
var task = await _lgbModbusClient.ReadHoldingRegistersAsync(1, 0, 100, cts.Token).ConfigureAwait(false); var result = await client.ReadHoldingRegistersAsync(1, 0, 100, cts.Token).ConfigureAwait(false);
var data = result.ReadUShortValues(100);
if (!result.IsSuccess)
{
throw new Exception(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + result.Exception);
}
} }
})); }));
} }

View File

@@ -22,7 +22,7 @@ using TouchSocket.Core;
namespace ThingsGateway.Foundation; namespace ThingsGateway.Foundation;
[SimpleJob(RuntimeMoniker.Net80)] //[SimpleJob(RuntimeMoniker.Net80)]
//[SimpleJob(RuntimeMoniker.Net10_0)] //[SimpleJob(RuntimeMoniker.Net10_0)]
[MemoryDiagnoser] [MemoryDiagnoser]
public class S7Benchmark : IDisposable public class S7Benchmark : IDisposable

View File

@@ -8,8 +8,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\ThingsGateway.Foundation.Variable\ThingsGateway.Foundation.Variable.csproj"/> <ProjectReference Include="..\..\Foundation\ThingsGateway.Foundation.Variable\ThingsGateway.Foundation.Variable.csproj"/>
<ProjectReference Include="..\ThingsGateway.Foundation.SourceGenerator\ThingsGateway.Foundation.SourceGenerator.csproj" PrivateAssets="all" OutputItemType="Analyzer" /> <ProjectReference Include="..\..\Foundation\ThingsGateway.Foundation.SourceGenerator\ThingsGateway.Foundation.SourceGenerator.csproj" PrivateAssets="all" OutputItemType="Analyzer" />
</ItemGroup> </ItemGroup>

View File

@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 18
VisualStudioVersion = 17.9.34622.214 VisualStudioVersion = 18.0.11018.127 d18.0
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThingsGateway.Server", "ThingsGateway.Server\ThingsGateway.Server.csproj", "{22875EFB-DADF-4612-A572-33BCC092F644}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThingsGateway.Server", "ThingsGateway.Server\ThingsGateway.Server.csproj", "{22875EFB-DADF-4612-A572-33BCC092F644}"
EndProject EndProject
@@ -111,12 +111,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "foundation", "foundation",
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "debug", "debug", "{053AB5FA-9742-96EC-76A1-2AEC739860C6}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "debug", "debug", "{053AB5FA-9742-96EC-76A1-2AEC739860C6}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThingsGateway.Foundation.Demo", "Foundation\ThingsGateway.Foundation.Demo\ThingsGateway.Foundation.Demo.csproj", "{520DEEAA-1CBD-C0CB-2363-EB190D7DE4EA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThingsGateway.Foundation.Benchmark", "Plugin\ThingsGateway.Foundation.Benchmark\ThingsGateway.Foundation.Benchmark.csproj", "{B0957BD6-CF77-36E7-B657-2D0DB85F386F}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThingsGateway.Foundation.Benchmark", "Plugin\ThingsGateway.Foundation.Benchmark\ThingsGateway.Foundation.Benchmark.csproj", "{B0957BD6-CF77-36E7-B657-2D0DB85F386F}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThingsGateway.ScriptDebug", "ThingsGateway.ScriptDebug\ThingsGateway.ScriptDebug.csproj", "{F4AC662F-BE2C-6E1C-4BAF-370B968B3554}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThingsGateway.ScriptDebug", "ThingsGateway.ScriptDebug\ThingsGateway.ScriptDebug.csproj", "{F4AC662F-BE2C-6E1C-4BAF-370B968B3554}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "demo", "demo", "{4F7AAAB1-C607-4FA0-9DFC-562940D76BC1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmark", "benchmark", "{19611184-C452-4DF7-A0A3-CCFFCE1DD191}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThingsGateway.Foundation.Demo", "Plugin\ThingsGateway.Foundation.Demo\ThingsGateway.Foundation.Demo.csproj", "{C9B6F478-8CEC-1C71-00C2-19442F731E0E}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -287,10 +291,6 @@ Global
{EAEE6A03-D2E7-7283-0F7A-F15B6261EE96}.Debug|Any CPU.Build.0 = Debug|Any CPU {EAEE6A03-D2E7-7283-0F7A-F15B6261EE96}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EAEE6A03-D2E7-7283-0F7A-F15B6261EE96}.Release|Any CPU.ActiveCfg = Release|Any CPU {EAEE6A03-D2E7-7283-0F7A-F15B6261EE96}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EAEE6A03-D2E7-7283-0F7A-F15B6261EE96}.Release|Any CPU.Build.0 = Release|Any CPU {EAEE6A03-D2E7-7283-0F7A-F15B6261EE96}.Release|Any CPU.Build.0 = Release|Any CPU
{520DEEAA-1CBD-C0CB-2363-EB190D7DE4EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{520DEEAA-1CBD-C0CB-2363-EB190D7DE4EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{520DEEAA-1CBD-C0CB-2363-EB190D7DE4EA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{520DEEAA-1CBD-C0CB-2363-EB190D7DE4EA}.Release|Any CPU.Build.0 = Release|Any CPU
{B0957BD6-CF77-36E7-B657-2D0DB85F386F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B0957BD6-CF77-36E7-B657-2D0DB85F386F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B0957BD6-CF77-36E7-B657-2D0DB85F386F}.Debug|Any CPU.Build.0 = Debug|Any CPU {B0957BD6-CF77-36E7-B657-2D0DB85F386F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B0957BD6-CF77-36E7-B657-2D0DB85F386F}.Release|Any CPU.ActiveCfg = Release|Any CPU {B0957BD6-CF77-36E7-B657-2D0DB85F386F}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -299,6 +299,10 @@ Global
{F4AC662F-BE2C-6E1C-4BAF-370B968B3554}.Debug|Any CPU.Build.0 = Debug|Any CPU {F4AC662F-BE2C-6E1C-4BAF-370B968B3554}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F4AC662F-BE2C-6E1C-4BAF-370B968B3554}.Release|Any CPU.ActiveCfg = Release|Any CPU {F4AC662F-BE2C-6E1C-4BAF-370B968B3554}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F4AC662F-BE2C-6E1C-4BAF-370B968B3554}.Release|Any CPU.Build.0 = Release|Any CPU {F4AC662F-BE2C-6E1C-4BAF-370B968B3554}.Release|Any CPU.Build.0 = Release|Any CPU
{C9B6F478-8CEC-1C71-00C2-19442F731E0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C9B6F478-8CEC-1C71-00C2-19442F731E0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C9B6F478-8CEC-1C71-00C2-19442F731E0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C9B6F478-8CEC-1C71-00C2-19442F731E0E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@@ -345,12 +349,14 @@ Global
{1D9CD7A3-9700-A851-0ABD-183347D9CC33} = {36510D70-161F-4241-B8D0-781E21032816} {1D9CD7A3-9700-A851-0ABD-183347D9CC33} = {36510D70-161F-4241-B8D0-781E21032816}
{E6EF2033-F02A-CDAD-5A72-EE397A89742E} = {36510D70-161F-4241-B8D0-781E21032816} {E6EF2033-F02A-CDAD-5A72-EE397A89742E} = {36510D70-161F-4241-B8D0-781E21032816}
{053AB5FA-9742-96EC-76A1-2AEC739860C6} = {36510D70-161F-4241-B8D0-781E21032816} {053AB5FA-9742-96EC-76A1-2AEC739860C6} = {36510D70-161F-4241-B8D0-781E21032816}
{520DEEAA-1CBD-C0CB-2363-EB190D7DE4EA} = {2AC600BB-4325-4E0A-93A7-B1F53C8E2CA7} {B0957BD6-CF77-36E7-B657-2D0DB85F386F} = {19611184-C452-4DF7-A0A3-CCFFCE1DD191}
{B0957BD6-CF77-36E7-B657-2D0DB85F386F} = {1D9CD7A3-9700-A851-0ABD-183347D9CC33} {4F7AAAB1-C607-4FA0-9DFC-562940D76BC1} = {36510D70-161F-4241-B8D0-781E21032816}
{19611184-C452-4DF7-A0A3-CCFFCE1DD191} = {36510D70-161F-4241-B8D0-781E21032816}
{C9B6F478-8CEC-1C71-00C2-19442F731E0E} = {4F7AAAB1-C607-4FA0-9DFC-562940D76BC1}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
RESX_Rules = {"EnabledRules":[]}
RESX_NeutralResourcesLanguage = zh-Hans
SolutionGuid = {199B1B96-4F56-4828-9531-813BA02DB282} SolutionGuid = {199B1B96-4F56-4828-9531-813BA02DB282}
RESX_NeutralResourcesLanguage = zh-Hans
RESX_Rules = {"EnabledRules":[]}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal