Minor changes

This commit is contained in:
Mike Cremer
2021-01-29 21:13:38 +01:00
parent de0a9e64dc
commit fdd4519f64
3 changed files with 7 additions and 6 deletions

View File

@@ -58,7 +58,8 @@ namespace S7.Net.UnitTest.Helpers
/// <summary>
/// DB1.DBX20.0
/// </summary>
[S7String(S7StringType.S7WString, 10)] public string WStringVariable;
[S7String(S7StringType.S7WString, 10)]
public string WStringVariable;
/// <summary>
/// DB1.DBX44.0

View File

@@ -57,11 +57,11 @@ namespace S7.Net.Types
/// <summary>
/// ASCII string.
/// </summary>
S7String,
S7String = VarType.S7String,
/// <summary>
/// Unicode string.
/// </summary>
S7WString
S7WString = VarType.S7WString
}
}

View File

@@ -65,7 +65,7 @@ namespace S7.Net.Types
case "String":
S7StringAttribute? attribute = info.GetCustomAttributes<S7StringAttribute>().SingleOrDefault();
if (attribute == default(S7StringAttribute))
throw new ArgumentException("Please add S7StringAttribute to the field you are trying to read or write");
throw new ArgumentException("Please add S7StringAttribute to the string field");
numBytes = Math.Ceiling(numBytes);
if ((numBytes / 2 - Math.Floor(numBytes / 2.0)) > 0)
@@ -192,7 +192,7 @@ namespace S7.Net.Types
case "String":
S7StringAttribute? attribute = info.GetCustomAttributes<S7StringAttribute>().SingleOrDefault();
if (attribute == default(S7StringAttribute))
throw new ArgumentException("Please add S7StringAttribute to the field you are trying to read or write");
throw new ArgumentException("Please add S7StringAttribute to the string field");
numBytes = Math.Ceiling(numBytes);
if ((numBytes / 2 - Math.Floor(numBytes / 2.0)) > 0)
@@ -294,7 +294,7 @@ namespace S7.Net.Types
case "String":
S7StringAttribute? attribute = info.GetCustomAttributes<S7StringAttribute>().SingleOrDefault();
if (attribute == default(S7StringAttribute))
throw new ArgumentException("Please add S7StringAttribute to the field you are trying to read or write");
throw new ArgumentException("Please add S7StringAttribute to the string field");
bytes2 = attribute.Type switch
{