From 24d08a2e3d44f24138d8c5dd39887028993db3ac Mon Sep 17 00:00:00 2001 From: lxw Date: Thu, 16 May 2024 12:26:28 +0800 Subject: [PATCH] =?UTF-8?q?Modbus=20=E5=A2=9E=E5=8A=A0Decode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HybirdFrameworkDriver/ModbusTcpMaster/ModbusDecoder.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/HybirdFrameworkDriver/ModbusTcpMaster/ModbusDecoder.cs b/HybirdFrameworkDriver/ModbusTcpMaster/ModbusDecoder.cs index 2e4e8dd..fee6009 100644 --- a/HybirdFrameworkDriver/ModbusTcpMaster/ModbusDecoder.cs +++ b/HybirdFrameworkDriver/ModbusTcpMaster/ModbusDecoder.cs @@ -8,6 +8,12 @@ public static class ModbusDecoder { private static readonly ILog Log = LogManager.GetLogger(typeof(ModbusDecoder)); + public static T Decode(byte[] bytes) where T : class, new() + { + T t = new T(); + return Decode(bytes, t); + } + public static T Decode(byte[] bytes, T t) where T : class, new() { var fields = t.GetType().GetProperties()