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; }