Opc.Ua.Com.Server.ComAe2Browser.SearchByQualifiedName C# (CSharp) Method

SearchByQualifiedName() public method

Returns the areas or sources that meet search pattern.
public SearchByQualifiedName ( string pattern, bool isArea ) : List
pattern string
isArea bool
return List
        public List<NodeId> SearchByQualifiedName(string pattern, bool isArea)
        {
            Session session = m_server.Session;

            if (session == null)
            {
                throw ComUtils.CreateComException(ResultIds.E_FAIL);
            }
            
            List<NodeId> hits = new List<NodeId>();

            // check if a wildcard has been specified.
            int start = -1;

            for (int ii = 0; ii < pattern.Length; ii++)
            {
                if (IsWildcardChar(pattern[ii]))
                {
                    start = ii;
                    break;
                }
            }

            lock (m_lock)
            {
                // no wildcard found.
                if (start == -1)
                {
                    AeBrowseElement target = Find(session, pattern, isArea);

                    if (target != null)
                    {
                        hits.Add(target.NodeId);
                    }

                    return hits;
                }
                
                // find the root where no wildcards exist.
                int end = start;

                for (int ii = start; ii >= 0; ii--)
                {
                    if (pattern[ii] == '/')
                    {
                        end = ii;
                        break;
                    }
                }
                
                // check if the root exists.
                string rootId = pattern.Substring(0, end);                
                AeBrowseElement root = Find(session, rootId, true);

                if (root == null)
                {
                    return hits;
                }
                                
                // update the pattern to look for children of root.
                pattern = pattern.Substring(end+1);
                
                // check if the pattern has multiple levels.
                end = pattern.IndexOf('/');

                if (end == -1)
                {
                    List<AeBrowseElement> children = Browse(session, root, pattern, isArea);

                    // remove any duplicates.
                    for (int ii = 0; ii < children.Count; ii++)
                    {
                        hits.Add(children[ii].NodeId);
                    }

                    return hits;
                }
            }

            return hits;
        }