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

Browse() private method

Finds the children that match the pattern (updates cache if required).
private Browse ( Session session, AeBrowseElement start, string pattern, bool isArea ) : List
session Opc.Ua.Client.Session
start AeBrowseElement
pattern string
isArea bool
return List
        private List<AeBrowseElement> Browse(Session session, AeBrowseElement start, string pattern, bool isArea)
        {
            // check cache.
            List<AeBrowseElement> targets = (isArea)?start.Areas:start.Sources;

            if (targets == null)
            {
                // fetch from server.
                targets = Browse(session, start, isArea);

                // update cache.
                if (isArea)
                {
                    start.Areas = targets;
                }
                else
                {
                    start.Sources = targets;
                }
            }

            // check if all matched.
            if (String.IsNullOrEmpty(pattern) || pattern == "*")
            {
                return targets;
            }
     
            // apply filter.
            List<AeBrowseElement> hits = new List<AeBrowseElement>();

            for (int ii = 0; ii < targets.Count; ii++)
            {
                if (ComUtils.Match(targets[ii].BrowseText, pattern, false))
                {
                    hits.Add(targets[ii]);
                }
            }
            
            return hits;
        }

Same methods

ComAe2Browser::Browse ( bool isArea, string filter ) : IList
ComAe2Browser::Browse ( Session session, AeBrowseElement start, bool isArea ) : List