Extend supported variables and improve parser errors

This commit is contained in:
Peter Butzhammer
2024-02-07 17:40:51 +01:00
parent 2a694bf980
commit 6492d039da
11 changed files with 323 additions and 73 deletions

View File

@@ -10,8 +10,13 @@ internal class S7VariableAddress
public ushort DbNr { get; set; }
public ushort Start { get; set; }
public ushort Length { get; set; }
public byte Bit { get; set; }
public byte? Bit { get; set; }
public DbType Type { get; set; }
public ushort BufferLength => Type == DbType.String ? (ushort)(Length + 2) : Length;
public ushort BufferLength => Type switch
{
DbType.String => (ushort) (Length + 2),
DbType.WString => (ushort) (Length * 2 + 4),
_ => Length
};
}