示例#1
0
        public UANodeConverter(JObject config, NamespaceTable SessionNamespaceURIs)
        {
            _config = config.ToObject <nodesConfigWrapper>().nodesLoader;

            using (Stream stream = new FileStream(_config.filename, FileMode.Open)){
                m_UANodeset       = UANodeSet.Read(stream);
                m_aliases         = m_UANodeset.Aliases;
                m_namespaceURIs   = m_UANodeset.NamespaceUris;
                out_nodeset       = new List <Node>();
                session_namespace = SessionNamespaceURIs;
            }

            selector = new NodesSelector(_config);
        }
示例#2
0
        public NodesSelector(nodesConfig config)
        {
            _config        = config;
            allowedTargets = new List <string> {
                "displayname", "browsename", "nodeid"
            };
            if (!allowedTargets.Contains(_config.targetIdentifier.ToLower()))
            {
                logger.Fatal("Target identifier '{0}' is not supported", _config.targetIdentifier);
                logger.Info("Possible target identifier are [{0}] (case insensitive)", string.Join(",", allowedTargets));
                throw new System.ArgumentException("Target identifier");
            }

            skipSelection = false;
            if (_config.whiteList.Length == 0 &&
                _config.blackList.Length == 0 &&
                _config.contains.Length == 0 &&
                _config.matchRegEx.Length == 0 &&
                _config.notContain.Length == 0)
            {
                skipSelection = true;
            }

            if (_config.blackList.Length != 0 &&
                _config.whiteList.Length == 0 &&
                _config.contains.Length == 0 &&
                _config.matchRegEx.Length == 0)
            {
                throw new System.ArgumentException("Black list must be used with other lists, to obtain all nodes except backlisted add to configfile ->  matchRegEx : ['^'] ");
            }

            if (_config.notContain.Length != 0 &&
                _config.whiteList.Length == 0 &&
                _config.contains.Length == 0 &&
                _config.matchRegEx.Length == 0)
            {
                throw new System.ArgumentException("Black lists must be used with other lists, to obtain all nodes except backlisted add to configfile ->  matchRegEx : ['^'] ");
            }
        }
示例#3
0
 public nodesConfigWrapper()
 {
     nodesLoader = new nodesConfig();
 }