public override ITreeNode Get(ITreePath path, ref int offset, bool getRef = false) { if (path.IsPathToCurrent) { return(this); } if (path.IsAbsolute) { offset = 0; return(Root.Get(path.StepDown(), ref offset, getRef)); } if (path.IsPathIndexed) { var arrayChild = GetChildByName(path.ArrayName); return(arrayChild?.Get(path, ref offset, getRef)); } var child = GetChildByName(path.Nodes.First()); return(child?.Get(path.StepDown(), ref offset, getRef)); }
public override void AddChild(ITreePath path, ITreeNode node) { if (path.IsPathToCurrent) { AddChild(node); } else if (path.IsAbsolute) { Root.AddChild(path.StepDown(), node); } else { var nextNode = path.Nodes.First(); var child = GetChildByName(nextNode); if (child == null) { AddChild(new PlcMetaDataTreeNode(nextNode)); child = GetChildByName(nextNode); } child.AddChild(path.StepDown(), node); } }