private bool VerifyIndexRangeForArray(IVariableBase variable, BuiltInType type, string indexRange, DataValue result)
{
// allow DA status codes.
if (IsDaBadStatus(result.StatusCode))
{
return true;
}
Array array = result.Value as Array;
if (array == null)
{
if (result.StatusCode != StatusCodes.BadIndexRangeNoData)
{
Log(
"Wrong error code when reading index range for array value '{0}'. NodeId = {1}, Value = {2}, StatusCode = {3}",
variable,
variable.NodeId,
variable.Value,
result.StatusCode);
return false;
}
return true;
}
if (indexRange == "10000000:20000000")
{
Log(
"Expected BadIndexRangeNoData for array value '{0}'. NodeId = {1}, Value = {2}, ReturnedValue = {3}",
variable,
variable.NodeId,
variable.Value,
result.Value);
return false;
}
if (array.Length > 2)
{
Log(
"Too much data return when reading index range for array value '{0}'. NodeId = {1}, Value = {2}, ReturnedValue = {3}",
variable,
variable.NodeId,
variable.Value,
result.Value);
return false;
}
return true;
}