Exemplo n.º 1
0
        /// <summary>
        /// Evaluates the filter over infosets surfaced via the given navigator by using the Fx engine
        /// We assume that the filter was pre-compiled using the framework engine
        /// </summary>
        internal bool MatchFx(XPathNavigator navigator)
        {
            INodeCounter counter = navigator as INodeCounter;

            if (counter == null)
            {
                navigator = new SafeSeekableNavigator(new GenericSeekableNavigator(navigator), this.NodeQuota);
            }
            else
            {
                counter.CounterMarker = this.NodeQuota;
                counter.MaxCounter    = this.NodeQuota;
            }
            Fx.Assert(null != this.query && OpcodeID.MatchSingleFx == this.query.ID, "");
            try
            {
                return(((MatchSingleFxEngineResultOpcode)this.query).Match(navigator));
            }
            catch (XPathNavigatorException e)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(e.Process(this.query));
            }
            catch (NavigatorInvalidBodyAccessException e)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(e.Process(this.query));
            }
        }
        internal bool MatchFx(XPathNavigator navigator)
        {
            bool         flag;
            INodeCounter counter = navigator as INodeCounter;

            if (counter == null)
            {
                navigator = new SafeSeekableNavigator(new GenericSeekableNavigator(navigator), base.NodeQuota);
            }
            else
            {
                counter.CounterMarker = base.NodeQuota;
                counter.MaxCounter    = base.NodeQuota;
            }
            try
            {
                flag = ((MatchSingleFxEngineResultOpcode)base.query).Match(navigator);
            }
            catch (XPathNavigatorException exception)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(exception.Process(base.query));
            }
            catch (NavigatorInvalidBodyAccessException exception2)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(exception2.Process(base.query));
            }
            return(flag);
        }
        internal SeekableXPathNavigator CreateSafeNavigator(SeekableXPathNavigator navigator)
        {
            INodeCounter counter = navigator as INodeCounter;

            if (counter != null)
            {
                counter.CounterMarker = this.maxNodes;
                counter.MaxCounter    = this.maxNodes;
                return(navigator);
            }
            navigator = new SafeSeekableNavigator(navigator, this.maxNodes);
            return(navigator);
        }