更新版本
This commit is contained in:
		| @@ -5,6 +5,7 @@ | ||||
|   <PropertyGroup> | ||||
|     <OutputType>WinExe</OutputType> | ||||
|     <ApplicationIcon>favicon.ico</ApplicationIcon> | ||||
|     <SatelliteResourceLanguages>zh-Hans;en-US</SatelliteResourceLanguages> | ||||
|  | ||||
|     <!--动态适用GC--> | ||||
|     <GarbageCollectionAdaptationMode>true</GarbageCollectionAdaptationMode> | ||||
|   | ||||
| @@ -2,8 +2,8 @@ | ||||
|  | ||||
|   <PropertyGroup> | ||||
|     <AdminVersion>7.2.0.20</AdminVersion> | ||||
|     <PluginVersion>9.0.2.13</PluginVersion> | ||||
|     <ProPluginVersion>9.0.2.22</ProPluginVersion> | ||||
|     <PluginVersion>9.0.2.14</PluginVersion> | ||||
|     <ProPluginVersion>9.0.2.23</ProPluginVersion> | ||||
|   </PropertyGroup> | ||||
|  | ||||
|   <PropertyGroup> | ||||
|   | ||||
| @@ -54,7 +54,5 @@ public interface IResultMessage : IOperResult, IRequestInfo | ||||
|     /// <summary> | ||||
|     /// 发送前的信息处理,例如存储某些特征信息:站号/功能码等等用于验证后续的返回信息是否合法 | ||||
|     /// </summary> | ||||
|     /// <param name="sendMessage"></param> | ||||
|     /// <returns></returns> | ||||
|     void SendInfo(ISendMessage sendMessage); | ||||
|     void SendInfo(ISendMessage sendMessage, ref ValueByteBlock byteBlock); | ||||
| } | ||||
|   | ||||
| @@ -54,7 +54,7 @@ public class MessageBase : OperResultClass<byte[]>, IResultMessage, IWaitHandle | ||||
|     } | ||||
|  | ||||
|     /// <inheritdoc/> | ||||
|     public virtual void SendInfo(ISendMessage sendMessage) | ||||
|     public virtual void SendInfo(ISendMessage sendMessage, ref TouchSocket.Core.ValueByteBlock byteBlock) | ||||
|     { | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -45,11 +45,10 @@ public class ProtocolSingleStreamDataHandleAdapter<TRequest> : CustomDataHandlin | ||||
|     public TRequest Request { get; set; } | ||||
|  | ||||
|     /// <inheritdoc /> | ||||
|     public void SetRequest(int sign, ISendMessage sendMessage) | ||||
|     public void SetRequest(ISendMessage sendMessage, ref ValueByteBlock byteBlock) | ||||
|     { | ||||
|         var request = GetInstance(); | ||||
|         request.Sign = sign; | ||||
|         request.SendInfo(sendMessage); | ||||
|         request.SendInfo(sendMessage, ref byteBlock); | ||||
|         Request = request; | ||||
|     } | ||||
|  | ||||
| @@ -175,18 +174,16 @@ public class ProtocolSingleStreamDataHandleAdapter<TRequest> : CustomDataHandlin | ||||
|             throw new Exception($"Unable to convert {nameof(requestInfo)} to {nameof(ISendMessage)}"); | ||||
|         } | ||||
|  | ||||
|         var requestInfoBuilder = (ISendMessage)requestInfo; | ||||
|  | ||||
|         var byteBlock = new ValueByteBlock(requestInfoBuilder.MaxLength); | ||||
|         var byteBlock = new ValueByteBlock(sendMessage.MaxLength); | ||||
|         try | ||||
|         { | ||||
|             requestInfoBuilder.Build(ref byteBlock); | ||||
|             sendMessage.Build(ref byteBlock); | ||||
|             if (Logger?.LogLevel <= LogLevel.Trace) | ||||
|                 Logger?.Trace($"{ToString()}- Send:{(IsHexData ? byteBlock.Span.ToHexString() : (byteBlock.Span.ToString(Encoding.UTF8)))}"); | ||||
|             //非并发主从协议 | ||||
|             if (IsSingleThread) | ||||
|             { | ||||
|                 SetRequest(sendMessage.Sign, requestInfoBuilder); | ||||
|                 SetRequest(sendMessage, ref byteBlock); | ||||
|             } | ||||
|             await GoSendAsync(byteBlock.Memory).ConfigureAwait(false); | ||||
|         } | ||||
|   | ||||
| @@ -40,11 +40,10 @@ public class ProtocolUdpDataHandleAdapter<TRequest> : UdpDataHandlingAdapter whe | ||||
|     public TRequest Request { get; set; } | ||||
|  | ||||
|     /// <inheritdoc /> | ||||
|     public void SetRequest(int sign, ISendMessage sendMessage) | ||||
|     public void SetRequest(ISendMessage sendMessage, ref ValueByteBlock byteBlock) | ||||
|     { | ||||
|         var request = GetInstance(); | ||||
|         request.Sign = sign; | ||||
|         request.SendInfo(sendMessage); | ||||
|         request.SendInfo(sendMessage, ref byteBlock); | ||||
|         Request = request; | ||||
|     } | ||||
|  | ||||
| @@ -161,18 +160,17 @@ public class ProtocolUdpDataHandleAdapter<TRequest> : UdpDataHandlingAdapter whe | ||||
|             throw new Exception($"Unable to convert {nameof(requestInfo)} to {nameof(ISendMessage)}"); | ||||
|         } | ||||
|  | ||||
|         var requestInfoBuilder = (ISendMessage)requestInfo; | ||||
|  | ||||
|         var byteBlock = new ValueByteBlock(requestInfoBuilder.MaxLength); | ||||
|         var byteBlock = new ValueByteBlock(sendMessage.MaxLength); | ||||
|         try | ||||
|         { | ||||
|             requestInfoBuilder.Build(ref byteBlock); | ||||
|             sendMessage.Build(ref byteBlock); | ||||
|             if (Logger?.LogLevel <= LogLevel.Trace) | ||||
|                 Logger?.Trace($"{ToString()}- Send:{(IsHexData ? byteBlock.Span.ToHexString() : (byteBlock.Span.ToString(Encoding.UTF8)))}"); | ||||
|             //非并发主从协议 | ||||
|             if (IsSingleThread) | ||||
|             { | ||||
|                 SetRequest(sendMessage.Sign, requestInfoBuilder); | ||||
|                 SetRequest(sendMessage, ref byteBlock); | ||||
|             } | ||||
|             await GoSendAsync(endPoint, byteBlock.Memory).ConfigureAwait(false); | ||||
|         } | ||||
|   | ||||
| @@ -376,7 +376,29 @@ public abstract class ProtocolBase : DisposableObject, IProtocol | ||||
|     } | ||||
|  | ||||
|     /// <inheritdoc/> | ||||
|     public virtual async ValueTask<OperResult<byte[]>> SendThenReturnAsync(ISendMessage command, IClientChannel channel = default, WaitDataAsync<MessageBase> waitData = default, CancellationToken cancellationToken = default) | ||||
|     protected virtual async ValueTask<MessageBase> SendThenReturnMessageAsync(ISendMessage sendMessage, string socketId, WaitDataAsync<MessageBase> waitData = default, CancellationToken cancellationToken = default) | ||||
|     { | ||||
|         var channelResult = await GetChannelAsync(socketId).ConfigureAwait(false); | ||||
|         if (!channelResult.IsSuccess) return new MessageBase(channelResult); | ||||
|         return await SendThenReturnMessageBaseAsync(sendMessage, channelResult.Content, waitData, cancellationToken).ConfigureAwait(false); | ||||
|     } | ||||
|  | ||||
|     /// <inheritdoc/> | ||||
|     public virtual async ValueTask<OperResult<byte[]>> SendThenReturnAsync(ISendMessage sendMessage, IClientChannel channel = default, WaitDataAsync<MessageBase> waitData = default, CancellationToken cancellationToken = default) | ||||
|     { | ||||
|         try | ||||
|         { | ||||
|             var result = await SendThenReturnMessageBaseAsync(sendMessage, channel, waitData, cancellationToken).ConfigureAwait(false); | ||||
|             return new OperResult<byte[]>(result) { Content = result.Content }; | ||||
|         } | ||||
|         catch (Exception ex) | ||||
|         { | ||||
|             return new(ex); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /// <inheritdoc/> | ||||
|     protected virtual async ValueTask<MessageBase> SendThenReturnMessageBaseAsync(ISendMessage command, IClientChannel channel = default, WaitDataAsync<MessageBase> waitData = default, CancellationToken cancellationToken = default) | ||||
|     { | ||||
|         try | ||||
|         { | ||||
| @@ -415,7 +437,7 @@ public abstract class ProtocolBase : DisposableObject, IProtocol | ||||
|                 result = await GetResponsedDataAsync(command, channel, waitData, Timeout, cancellationToken).ConfigureAwait(false); | ||||
|             } | ||||
|  | ||||
|             return new OperResult<byte[]>(result) { Content = result.Content }; | ||||
|             return result; | ||||
|         } | ||||
|         catch (Exception ex) | ||||
|         { | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <Project> | ||||
|   <PropertyGroup> | ||||
|     <Version>9.0.2.7</Version> | ||||
|     <Version>9.0.2.11</Version> | ||||
|   </PropertyGroup> | ||||
|  | ||||
|   <ItemGroup> | ||||
|   | ||||
| @@ -32,13 +32,4 @@ | ||||
|     <ProjectReference Include="..\..\Foundation\ThingsGateway.Foundation\ThingsGateway.Foundation.csproj" /> | ||||
|   </ItemGroup> | ||||
|  | ||||
|  | ||||
|   <!--<ItemGroup> | ||||
|     <Content Remove="SeedData\Json\*.json" /> | ||||
|     <Content Include="SeedData\Json\*.json" Pack="true" PackagePath="\SeedData\Json\" > | ||||
|       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||||
|     </Content> | ||||
|   </ItemGroup>--> | ||||
|  | ||||
|  | ||||
| </Project> | ||||
|   | ||||
| @@ -26,6 +26,11 @@ | ||||
|     <!--USBScaner 插件--> | ||||
|     <PackageReference Include="ThingsGateway.Plugin.USBScaner" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false"  IncludeAssets=" native;" /> | ||||
|  | ||||
|      | ||||
|     <PackageReference Include="ThingsGateway.Plugin.SECS" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false"  IncludeAssets=" native;" /> | ||||
|     <PackageReference Include="ThingsGateway.Plugin.TS550" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false"  IncludeAssets=" native;" /> | ||||
|     <PackageReference Include="ThingsGateway.Plugin.Vigor" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false"  IncludeAssets=" native;" /> | ||||
|  | ||||
|   </ItemGroup> | ||||
|  | ||||
|   <Target Name="CopyCustomPluginNugetPackages" AfterTargets="Build"> | ||||
| @@ -43,6 +48,9 @@ | ||||
|       <PkgThingsGateway_Plugin_IDR210PackageFiles Include="$(PkgThingsGateway_Plugin_IDR210)\Content\net6.0\**\*.*" /> | ||||
|       <PkgThingsGateway_Plugin_URF_R330PackageFiles Include="$(PkgThingsGateway_Plugin_URF_R330)\Content\net6.0\**\*.*" /> | ||||
|       <PkgThingsGateway_Plugin_USBScanerPackageFiles Include="$(PkgThingsGateway_Plugin_USBScaner)\Content\net6.0\**\*.*" /> | ||||
|       <PkgThingsGateway_Plugin_SECSPackageFiles Include="$(PkgThingsGateway_Plugin_SECS)\Content\net6.0\**\*.*" /> | ||||
|       <PkgThingsGateway_Plugin_TS550PackageFiles Include="$(PkgThingsGateway_Plugin_TS550)\Content\net6.0\**\*.*" /> | ||||
|       <PkgThingsGateway_Plugin_VigorPackageFiles Include="$(PkgThingsGateway_Plugin_Vigor)\Content\net6.0\**\*.*" /> | ||||
|  | ||||
|       <MainFile1 Include="$(PkgThingsGateway_Plugin_IDR210)\Main\**" /> | ||||
|       <MainFile2 Include="$(PkgThingsGateway_Plugin_DKQ_A16D)\Main\**" /> | ||||
| @@ -67,6 +75,9 @@ | ||||
|     <Copy SourceFiles="@(PkgThingsGateway_Plugin_IDR210PackageFiles)" DestinationFolder="$(PluginFolder)%(RecursiveDir)" /> | ||||
|     <Copy SourceFiles="@(PkgThingsGateway_Plugin_URF_R330PackageFiles)" DestinationFolder="$(PluginFolder)%(RecursiveDir)" /> | ||||
|     <Copy SourceFiles="@(PkgThingsGateway_Plugin_USBScanerPackageFiles)" DestinationFolder="$(PluginFolder)%(RecursiveDir)" /> | ||||
|     <Copy SourceFiles="@(PkgThingsGateway_Plugin_SECSPackageFiles)" DestinationFolder="$(PluginFolder)%(RecursiveDir)" /> | ||||
|     <Copy SourceFiles="@(PkgThingsGateway_Plugin_TS550PackageFiles)" DestinationFolder="$(PluginFolder)%(RecursiveDir)" /> | ||||
|     <Copy SourceFiles="@(PkgThingsGateway_Plugin_VigorPackageFiles)" DestinationFolder="$(PluginFolder)%(RecursiveDir)" /> | ||||
|      | ||||
|     <Copy SourceFiles="@(MainFile1)" DestinationFolder="$(TargetDir)%(RecursiveDir)" /> | ||||
|     <Copy SourceFiles="@(MainFile2)" DestinationFolder="$(TargetDir)%(RecursiveDir)" /> | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <Project> | ||||
|   <PropertyGroup> | ||||
|     <Version>7.2.0.21</Version> | ||||
|     <Version>7.2.0.23</Version> | ||||
|   </PropertyGroup> | ||||
|  | ||||
|   <ItemGroup> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Diego
					Diego