From 05e500ffad93d56a65f662ceacc53ff45e961350 Mon Sep 17 00:00:00 2001 From: Kevin Date: Mon, 16 Jul 2018 10:18:26 +0800 Subject: [PATCH] =?UTF-8?q?CacheIndex=E6=98=AFWORD=E4=B8=BA=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=EF=BC=8C=E5=9B=A0=E6=AD=A4=E8=BF=9B=E8=A1=8Cbyte?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E6=97=B6=E8=A6=81=20*=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SCADA/Program/DataService/CacheReader.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/SCADA/Program/DataService/CacheReader.cs b/SCADA/Program/DataService/CacheReader.cs index 1ab30a4..f2b035c 100644 --- a/SCADA/Program/DataService/CacheReader.cs +++ b/SCADA/Program/DataService/CacheReader.cs @@ -139,8 +139,8 @@ namespace DataService public int WriteString(DeviceAddress address, string str) { byte[] b = Encoding.ASCII.GetBytes(str); - int index = address.CacheIndex; - Array.Copy(b, 0, _cache, index, b.Length); + int index = address.CacheIndex * 2; + Buffer.BlockCopy(b, 0, _cache, index, b.Length); return 0; } @@ -301,8 +301,8 @@ namespace DataService public int WriteString(DeviceAddress address, string str) { byte[] b = Encoding.ASCII.GetBytes(str); - int index = address.CacheIndex; - Array.Copy(b, 0, _cache, index, b.Length); + int index = address.CacheIndex * 2; + Buffer.BlockCopy(b, 0, _cache, index, b.Length); return 0; } @@ -495,7 +495,7 @@ namespace DataService public int WriteString(DeviceAddress address, string str) { byte[] b = Encoding.ASCII.GetBytes(str); - int index = address.CacheIndex; + int index = address.CacheIndex * 2; Buffer.BlockCopy(b, 0, _cache, index, b.Length); return 0; } @@ -694,7 +694,7 @@ namespace DataService public int WriteString(DeviceAddress address, string str) { byte[] b = Encoding.ASCII.GetBytes(str); - int index = address.CacheIndex; + int index = address.CacheIndex * 2; Buffer.BlockCopy(b, 0, _cache, index, b.Length); return 0; } @@ -863,7 +863,7 @@ namespace DataService public int WriteString(DeviceAddress address, string str) { byte[] b = Encoding.ASCII.GetBytes(str); - int index = address.CacheIndex; + int index = address.CacheIndex * 2; Buffer.BlockCopy(b, 0, _cache, index, b.Length); return 0; } @@ -1029,7 +1029,7 @@ namespace DataService public int WriteString(DeviceAddress address, string str) { byte[] b = Encoding.ASCII.GetBytes(str); - int index = address.CacheIndex; + int index = address.CacheIndex * 2; Buffer.BlockCopy(b, 0, _cache, index, b.Length); return 0; }