mirror of
https://github.com/S7NetPlus/s7netplus.git
synced 2026-02-17 14:28:25 +08:00
Hook up DTL to VarType enum and PLCHelper.
This commit is contained in:
@@ -186,6 +186,11 @@
|
||||
/// <summary>
|
||||
/// DateTIme variable type
|
||||
/// </summary>
|
||||
DateTime
|
||||
DateTime,
|
||||
|
||||
/// <summary>
|
||||
/// DTL variable type
|
||||
/// </summary>
|
||||
Dtl
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,6 +156,15 @@ namespace S7.Net
|
||||
{
|
||||
return DateTime.ToArray(bytes);
|
||||
}
|
||||
case VarType.Dtl:
|
||||
if (varCount == 1)
|
||||
{
|
||||
return Dtl.FromByteArray(bytes);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Dtl.ToArray(bytes);
|
||||
}
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -190,6 +199,8 @@ namespace S7.Net
|
||||
return varCount * 4;
|
||||
case VarType.DateTime:
|
||||
return varCount * 8;
|
||||
case VarType.Dtl:
|
||||
return varCount * 12;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ namespace S7.Net.Protocol
|
||||
return Types.String.ToByteArray(stringVal, stringVal.Length);
|
||||
case "DateTime[]":
|
||||
return Types.DateTime.ToByteArray((System.DateTime[]) value);
|
||||
case "Dtl[]":
|
||||
return Types.Dtl.ToByteArray((System.DateTime[])value);
|
||||
default:
|
||||
throw new InvalidVariableTypeException();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user