private void BuildInstanceList(ILocalNode parent, string browsePath, IDictionary<string,ILocalNode> instances)
{
if (parent == null) throw new ArgumentNullException("parent");
if (instances == null) throw new ArgumentNullException("instances");
// guard against loops.
if (instances.ContainsKey(browsePath))
{
return;
}
// index parent by browse path.
instances[browsePath] = parent;
// get list of children.
IList<IReference> references = parent.References.Find(ReferenceTypeIds.HierarchicalReferences, false, true, m_nodes.TypeTree);
foreach (IReference reference in references)
{
// find child (ignore children that are not in the node table).
ILocalNode child = GetLocalNode(reference.TargetId) as ILocalNode;
if (child == null)
{
continue;
}
// recursively include aggregated children.
BuildInstanceList(child, Utils.Format("{0}.{1}", browsePath, child.BrowseName), instances);
}
}
#endregion