From 170c4b61541309f3710a61d3e220a35b836e2d0a Mon Sep 17 00:00:00 2001 From: parallelbgls Date: Mon, 3 Oct 2016 16:42:33 +0800 Subject: [PATCH] Fix --- Modbus.Net/Modbus.Net/BaseMachine.cs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/Modbus.Net/Modbus.Net/BaseMachine.cs b/Modbus.Net/Modbus.Net/BaseMachine.cs index f8eba1b..7cedbb7 100644 --- a/Modbus.Net/Modbus.Net/BaseMachine.cs +++ b/Modbus.Net/Modbus.Net/BaseMachine.cs @@ -423,20 +423,10 @@ namespace Modbus.Net } } //写入数据 - if (AddressCombinerSet is AddressCombinerSingle) - { - await - BaseUtility.SetDatasAsync(addressStart, - valueHelper.ByteArrayToObjectArray(datas, - new KeyValuePair(communicateAddress.DataType, 1))); - } - else - { - await - BaseUtility.SetDatasAsync(addressStart, - valueHelper.ByteArrayToObjectArray(datas, - new KeyValuePair(typeof (byte), datas.Length))); - } + await + BaseUtility.SetDatasAsync(addressStart, + valueHelper.ByteArrayToObjectArray(datas, + new KeyValuePair(communicateAddress.DataType, communicateAddress.GetCount))); } //如果不保持连接,断开连接 if (!KeepConnect)