internal override void Evaluate(CapabilitiesState state)
 {
     state.Exit = false;
     if (this._regex != null)
     {
         Match match = this._regex.Match(this._expr.Expand(state));
         if (!match.Success)
         {
             return;
         }
         state.AddMatch(this._regex, match);
     }
     for (int i = 0; i < this._rules.Length; i++)
     {
         this._rules[i].Evaluate(state);
         if (state.Exit)
         {
             break;
         }
     }
     if (this._regex != null)
     {
         state.PopMatch();
     }
     state.Exit = this.Type == 3;
 }
        internal override void Evaluate(CapabilitiesState state) {
            Match match;

            state.Exit = false;

            if (_regex != null) {
                match = _regex.Match(_expr.Expand(state));

                if (!match.Success)
                    return;

                state.AddMatch(_regex, match);
            }

            for (int i = 0; i < _rules.Length; i++) {
                _rules[i].Evaluate(state);

                if (state.Exit)
                    break;
            }

            if (_regex != null) {
                state.PopMatch();
            }

            state.Exit = (Type == Case);
        }
        internal override void Evaluate(CapabilitiesState state)
        {
            Match match;

            state.Exit = false;

            if (_regex != null)
            {
                match = _regex.Match(_expr.Expand(state));

                if (!match.Success)
                {
                    return;
                }

                state.AddMatch(_regex, match);
            }

            for (int i = 0; i < _rules.Length; i++)
            {
                _rules[i].Evaluate(state);

                if (state.Exit)
                {
                    break;
                }
            }

            if (_regex != null)
            {
                state.PopMatch();
            }

            state.Exit = (Type == Case);
        }
Пример #4
0
        internal HttpCapabilitiesBase EvaluateFinal(HttpRequest request, bool onlyEvaluateUserAgent)
        {
            HttpBrowserCapabilities httpBrowserCapabilities = this.BrowserCapFactory.GetHttpBrowserCapabilities(request);
            CapabilitiesState       state = new CapabilitiesState(request, httpBrowserCapabilities.Capabilities);

            if (onlyEvaluateUserAgent)
            {
                state.EvaluateOnlyUserAgent = true;
            }
            if (this._rule != null)
            {
                string str = httpBrowserCapabilities["isMobileDevice"];
                httpBrowserCapabilities.Capabilities["isMobileDevice"] = null;
                this._rule.Evaluate(state);
                string str2 = httpBrowserCapabilities["isMobileDevice"];
                if (str2 == null)
                {
                    httpBrowserCapabilities.Capabilities["isMobileDevice"] = str;
                }
                else if (str2.Equals("true"))
                {
                    httpBrowserCapabilities.DisableOptimizedCacheKey();
                }
            }
            HttpCapabilitiesBase base2 = (HttpCapabilitiesBase)HttpRuntime.CreateNonPublicInstance(this._resultType);

            base2.InitInternal(httpBrowserCapabilities);
            return(base2);
        }
        internal virtual String Expand(CapabilitiesState matchstate)
        {
            StringBuilder sb     = null;
            String        result = null;

            for (int i = 0; i < _rules.Length; i++)
            {
                if (sb == null && result != null)
                {
                    sb = new StringBuilder(result);
                }

                switch (_rules[i])
                {
                case Literal:
                    result = _strings[i];
                    break;

                case Reference:
                    result = matchstate.ResolveReference(_strings[i]);
                    break;

                case Variable:
                    result = matchstate.ResolveVariable(_strings[i]);
                    break;
                }

                if (sb != null && result != null)
                {
                    sb.Append(result);
                }
            }

            if (sb != null)
            {
                return(sb.ToString());
            }

            if (result != null)
            {
                return(result);
            }

            return("");
        }
        internal virtual HttpCapabilitiesBase EvaluateFinal(HttpRequest request, bool onlyEvaluateUserAgent)
        {
            // not in cache: calculate the result
            Hashtable         values = new Hashtable(new CaseInsensitiveHashCodeProvider(CultureInfo.InvariantCulture), new CaseInsensitiveComparer(CultureInfo.InvariantCulture));
            CapabilitiesState state  = new CapabilitiesState(request, values);

            if (onlyEvaluateUserAgent)
            {
                state.EvaluateOnlyUserAgent = true;
            }

            _rule.Evaluate(state);

            // create the new type
            // CONSIDER: don't allow non-public cap result types
            HttpCapabilitiesBase result = (HttpCapabilitiesBase)HttpRuntime.CreateNonPublicInstance(_resultType);

            result.InitInternal(values);

            return(result);
        }
Пример #7
0
        internal virtual string Expand(CapabilitiesState matchstate)
        {
            StringBuilder builder = null;
            string        str     = null;

            for (int i = 0; i < this._rules.Length; i++)
            {
                if ((builder == null) && (str != null))
                {
                    builder = new StringBuilder(str);
                }
                switch (this._rules[i])
                {
                case 0:
                    str = this._strings[i];
                    break;

                case 1:
                    str = matchstate.ResolveReference(this._strings[i]);
                    break;

                case 2:
                    str = matchstate.ResolveVariable(this._strings[i]);
                    break;
                }
                if ((builder != null) && (str != null))
                {
                    builder.Append(str);
                }
            }
            if (builder != null)
            {
                return(builder.ToString());
            }
            if (str != null)
            {
                return(str);
            }
            return(string.Empty);
        }
        internal virtual string Expand(CapabilitiesState matchstate)
        {
            StringBuilder builder = null;
            string str = null;
            for (int i = 0; i < this._rules.Length; i++)
            {
                if ((builder == null) && (str != null))
                {
                    builder = new StringBuilder(str);
                }
                switch (this._rules[i])
                {
                    case 0:
                        str = this._strings[i];
                        break;

                    case 1:
                        str = matchstate.ResolveReference(this._strings[i]);
                        break;

                    case 2:
                        str = matchstate.ResolveVariable(this._strings[i]);
                        break;
                }
                if ((builder != null) && (str != null))
                {
                    builder.Append(str);
                }
            }
            if (builder != null)
            {
                return builder.ToString();
            }
            if (str != null)
            {
                return str;
            }
            return string.Empty;
        }
Пример #9
0
        internal HttpCapabilitiesBase EvaluateFinal(HttpRequest request, bool onlyEvaluateUserAgent)
        {
            HttpBrowserCapabilities browserCaps = BrowserCapFactory.GetHttpBrowserCapabilities(request);
            CapabilitiesState       state       = new CapabilitiesState(request, browserCaps.Capabilities);

            if (onlyEvaluateUserAgent)
            {
                state.EvaluateOnlyUserAgent = true;
            }

            if (_rule != null)
            {
                string oldIsMobileDevice = browserCaps[_isMobileDeviceCapKey];
                browserCaps.Capabilities[_isMobileDeviceCapKey] = null;

                _rule.Evaluate(state);

                string newIsMobileDevice = browserCaps[_isMobileDeviceCapKey];
                if (newIsMobileDevice == null)
                {
                    browserCaps.Capabilities[_isMobileDeviceCapKey] = oldIsMobileDevice;
                }
                else if (newIsMobileDevice.Equals("true"))
                {
                    browserCaps.DisableOptimizedCacheKey();
                }
            }

            // create the new type
            //
            HttpCapabilitiesBase result = (HttpCapabilitiesBase)HttpRuntime.CreateNonPublicInstance(_resultType);

            result.InitInternal(browserCaps);

            return(result);
        }
 internal abstract void Evaluate(CapabilitiesState state);
 internal override void Evaluate(CapabilitiesState state)
 {
     state.SetVariable(this._var, this._pat.Expand(state));
     state.Exit = false;
 }
Пример #12
0
 internal override void Evaluate(CapabilitiesState state)
 {
     state.SetVariable(this._as, state.ResolveServerVariable(this._var));
     state.Exit = false;
 }
Пример #13
0
 internal override void Evaluate(CapabilitiesState state) {
     state.SetVariable(_as, state.ResolveServerVariable(_var));
     state.Exit = false;
 }
        internal HttpCapabilitiesBase EvaluateFinal(HttpRequest request, bool onlyEvaluateUserAgent) {
            HttpBrowserCapabilities browserCaps = BrowserCapFactory.GetHttpBrowserCapabilities(request);
            CapabilitiesState state = new CapabilitiesState(request, browserCaps.Capabilities);
            if (onlyEvaluateUserAgent) {
                state.EvaluateOnlyUserAgent = true;
            }

            if(_rule != null) {
                string oldIsMobileDevice = browserCaps[_isMobileDeviceCapKey];
                browserCaps.Capabilities[_isMobileDeviceCapKey] = null;

                _rule.Evaluate(state);

                string newIsMobileDevice = browserCaps[_isMobileDeviceCapKey];
                if (newIsMobileDevice == null) {
                    browserCaps.Capabilities[_isMobileDeviceCapKey] = oldIsMobileDevice;
                }
                else if (newIsMobileDevice.Equals("true")) {
                    browserCaps.DisableOptimizedCacheKey();
                }
            }

            // create the new type
            // 
            HttpCapabilitiesBase result = (HttpCapabilitiesBase)HttpRuntime.CreateNonPublicInstance(_resultType);
            result.InitInternal(browserCaps);
            
            return result;
        }
 internal HttpCapabilitiesBase EvaluateFinal(HttpRequest request, bool onlyEvaluateUserAgent)
 {
     HttpBrowserCapabilities httpBrowserCapabilities = this.BrowserCapFactory.GetHttpBrowserCapabilities(request);
     CapabilitiesState state = new CapabilitiesState(request, httpBrowserCapabilities.Capabilities);
     if (onlyEvaluateUserAgent)
     {
         state.EvaluateOnlyUserAgent = true;
     }
     if (this._rule != null)
     {
         string str = httpBrowserCapabilities["isMobileDevice"];
         httpBrowserCapabilities.Capabilities["isMobileDevice"] = null;
         this._rule.Evaluate(state);
         string str2 = httpBrowserCapabilities["isMobileDevice"];
         if (str2 == null)
         {
             httpBrowserCapabilities.Capabilities["isMobileDevice"] = str;
         }
         else if (str2.Equals("true"))
         {
             httpBrowserCapabilities.DisableOptimizedCacheKey();
         }
     }
     HttpCapabilitiesBase base2 = (HttpCapabilitiesBase) HttpRuntime.CreateNonPublicInstance(this._resultType);
     base2.InitInternal(httpBrowserCapabilities);
     return base2;
 }
Пример #16
0
 internal abstract void Evaluate(CapabilitiesState state);
 internal override void Evaluate(CapabilitiesState state) {
     state.SetVariable(_var, _pat.Expand(state));
     state.Exit = false;
 }
        internal virtual String Expand(CapabilitiesState matchstate) {
            StringBuilder sb = null;
            String result = null;

            for (int i = 0; i < _rules.Length; i++) {
                if (sb == null && result != null)
                    sb = new StringBuilder(result);

                switch (_rules[i]) {
                    case Literal:
                        result = _strings[i];
                        break;

                    case Reference:
                        result = matchstate.ResolveReference(_strings[i]);
                        break;

                    case Variable:
                        result = matchstate.ResolveVariable(_strings[i]);
                        break;
                }

                if (sb != null && result != null)
                    sb.Append(result);
            }

            if (sb != null)
                return sb.ToString();

            if (result != null)
                return result;

            return String.Empty;
        }