private void CollectVariables(INode parent, List<VariableNode> variables)
{
VariableNode variable = parent as VariableNode;
if (variable != null && ((variable.UserAccessLevel & AccessLevels.CurrentReadOrWrite) == AccessLevels.CurrentReadOrWrite))
{
bool found = false;
for (int jj = 0; jj < variables.Count; jj++)
{
if (Object.ReferenceEquals(variable, variables[jj]))
{
found = true;
break;
}
}
if (!found)
{
variables.Add(variable);
}
}
IList<INode> children = Session.NodeCache.Find(
parent.NodeId,
ReferenceTypeIds.HierarchicalReferences,
false,
true);
for (int ii = 0; ii < children.Count; ii++)
{
CollectVariables(children[ii], variables);
}
}