Browse Source

西门子通讯修改

master
pry 2 years ago
parent
commit
fadbeb99e1
1 changed files with 9 additions and 4 deletions
  1. +9
    -4
      BPASmartClient.S7Net/EntityClassResolution.cs

+ 9
- 4
BPASmartClient.S7Net/EntityClassResolution.cs View File

@@ -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:
{


Loading…
Cancel
Save