public List <OPCNodeItem> GetNodeItems(List <string> FullPathObj) { this.MoveToRoot(); if (FullPathObj == null) { FullPathObj = new List <string>(); } foreach (string s in FullPathObj) { this.ChangeBrowsePosition(OPCBROWSEDIRECTION.OPC_BROWSE_DOWN, s); } List <OPCNodeItem> newNodes = new List <OPCNodeItem>(); ArrayList lst = this.Browse(OPCBROWSETYPE.OPC_LEAF); foreach (string s in lst) { OPCNodeItem node = new OPCNodeItem(); newNodes.Add(node); node.Name = s; node.ID = this.GetItemID(s); node.FullPathObj = new List <string>(); foreach (string path in FullPathObj) { node.FullPathObj.Add(path); } node.FullPathObj.Add(s); node.server = this; } return(newNodes); }
private void RecurBrowse(List <OPCNode> parentNodes, OPCNode parent, List <string> FullPathObj) { ArrayList lst = this.Browse(OPCBROWSETYPE.OPC_BRANCH); if (lst == null) { return; } if (lst.Count < 1) { return; } foreach (string s in lst) { this.ChangeBrowsePosition(OPCBROWSEDIRECTION.OPC_BROWSE_DOWN, s); OPCNode node = new OPCNode(s); node.OpcServer = this; if (FullPathObj == null) { FullPathObj = new List <string>(); } FullPathObj.Add(s); node.FullPathObj = FullPathObj; node.Parent = parent; this.OnEnumNodes(FullPathObj, node); parentNodes.Add(node); ArrayList lstItem = this.Browse(OPCBROWSETYPE.OPC_LEAF); node._NodeItems = new List <OPCNodeItem>(); if (lstItem != null) { foreach (string sItem in lstItem) { OPCNodeItem item = new OPCNodeItem(); item.Name = sItem; item.ID = this.GetItemID(sItem); node._NodeItems.Add(item); } } node._Nodes = new List <OPCNode>(); RecurBrowse(node._Nodes, node, FullPathObj); this.ChangeBrowsePosition(OPCBROWSEDIRECTION.OPC_BROWSE_UP, ""); } }