Esempio n. 1
0
        private ReadValueIdCollection BuildReadValueIdCollectionUnderFolders(string[] folders, uint attributeId, ref List <string> tagList, bool needToGoDeeper = false)
        {
            ReadValueIdCollection _rtn = new ReadValueIdCollection();

            foreach (string folder in folders)
            {
                List <string> subFolders = new List <string>();
                var           subNodes   = ExploreFolder(folder);
                foreach (UaNode n in subNodes)
                {
                    if (n.NodeClass == NodeClass.Variable.ToString())
                    {
                        var readValue = new ReadValueId
                        {
                            NodeId      = n.NodeId,
                            AttributeId = attributeId
                        };
                        _rtn.Add(readValue);
                        tagList.Add(n.Tag);
                    }
                    else if (n.NodeClass == NodeClass.Object.ToString() && needToGoDeeper)
                    {
                        subFolders.Add(n.Tag);
                    }
                }
                var subResult = BuildReadValueIdCollectionUnderFolders(subFolders.ToArray(), attributeId, ref tagList);
                _rtn.AddRange(subResult);

                /*var n = FindNode(tag, RootNode);
                 * var readValue = new ReadValueId
                 * {
                 *  NodeId = n.NodeId,
                 *  AttributeId = attributeId
                 * };
                 * _rtn.Add(readValue);*/
            }
            return(_rtn);
        }