From fadbeb99e10195575771cd28c917dc6bfb9160f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com> Date: Wed, 19 Oct 2022 17:40:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A5=BF=E9=97=A8=E5=AD=90=E9=80=9A=E8=AE=AF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BPASmartClient.S7Net/EntityClassResolution.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/BPASmartClient.S7Net/EntityClassResolution.cs b/BPASmartClient.S7Net/EntityClassResolution.cs index 9aa9f93d..8a994b4a 100644 --- a/BPASmartClient.S7Net/EntityClassResolution.cs +++ b/BPASmartClient.S7Net/EntityClassResolution.cs @@ -46,7 +46,7 @@ namespace BPASmartClient.S7Net break; case "String": //numBytes += 256.0; - numBytes += 256.0; + numBytes += 1.0; break; default: numBytes = GetClassSize(Activator.CreateInstance(type), numBytes, isInnerProperty: true); @@ -190,10 +190,15 @@ namespace BPASmartClient.S7Net break; } case "String": - byte[] sarray = new byte[256]; - Array.Copy(bytes, (int)numBytes, sarray, 0, 256); + //byte[] sarray = new byte[256]; + //Array.Copy(bytes, (int)numBytes, sarray, 0, 256); + //obj = GetGb2312()?.GetString(sarray).Trim().Replace(" ", "").Replace("\n", ""); + //numBytes += 256.0; + + byte[] sarray = new byte[1]; + Array.Copy(bytes, (int)numBytes, sarray, 0, 1); obj = GetGb2312()?.GetString(sarray).Trim().Replace(" ", "").Replace("\n", ""); - numBytes += 256.0; + numBytes += 1; break; default: {