| | |
| | | //throw new Exception($"读取PLC字符串定义长度【{Content[index]}】与对象【{GetType().Name}】属性【{propertyInfo.Name}】特性定义字符串长度【{dataLength}】不一致"); |
| | | //QuartzLogger.Debug($"读取PLC字符串定义长度【{Content[index]}】与对象【{GetType().Name}】属性【{propertyInfo.Name}】特性定义字符串长度【{dataLength}】不一致"); |
| | | |
| | | try |
| | | { |
| | | propertyInfo.SetValue(this, Encoding.Default.GetString(Content, index + 2, Content[index + 1] > 0 ? Content[index + 1] : dataLength - 2).Trim().Replace("\0", "").Replace("\\u000", "").Trim()); |
| | | } |
| | | catch |
| | | { |
| | | propertyInfo.SetValue(this, Encoding.Default.GetString(Content, index, dataLength).Trim().Replace("\0", "").Replace("\\u000","").Trim()); |
| | | } |
| | | index += dataLength; |
| | | break; |
| | | } |