protected internal override Results Match(string userAgent)
        {
            bool isMobile = false;

            // Use RIS to find a match first.
            Results results = base.Match(userAgent);

            // If no match with RIS then try edit distance.
            if (results == null || results.Count == 0)
            {
                results = Matcher.Match(userAgent, this);
            }

            // If a match other than edit distance was used then we'll have more confidence
            // and return the mobile version of the device.
            if (results.GetType() == typeof(Results))
            {
                isMobile = true;
            }

            Results newResults = new Results();

            // Look at the results for one that matches our isMobile setting based on the
            // matcher used.
            foreach (Result result in results)
            {
                if (result.Device.IsMobileDevice == isMobile)
                {
                    newResults.Add(result.Device);
                }
            }

            // Return the new results if any values are available.
            return(newResults);
        }
Example #2
0
        protected internal override Results Match(string userAgent)
        {
            Results results = base.Match(userAgent);

            // Use Edit Distance if the segment match failed.
            if (results == null || results.Count == 0)
            {
                results = Matcher.Match(userAgent, this);
            }
            return(results);
        }
 protected internal override Results Match(string userAgent)
 {
     return(Matcher.Match(userAgent, this));
 }