You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devicemap.apache.org by bd...@apache.org on 2012/10/02 15:34:35 UTC

svn commit: r1392912 [3/8] - in /incubator/devicemap/trunk/openddr/csharp: ./ DDR-Simple-API/ DDR-Simple-API/Exceptions/ DDR-Simple-API/Models/ DDR-Simple-API/Properties/ DDR-Simple-API/Simple/ OpenDDR-CSharp/ OpenDDR-CSharp/Builders/ OpenDDR-CSharp/Bu...

Added: incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/JasmineBrowserBuilder.cs
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/JasmineBrowserBuilder.cs?rev=1392912&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/JasmineBrowserBuilder.cs (added)
+++ incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/JasmineBrowserBuilder.cs Tue Oct  2 13:34:31 2012
@@ -0,0 +1,104 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Oddr.Models;
+using Oddr.Models.Browsers;
+using System.Text.RegularExpressions;
+
+namespace Oddr.Builders.Browsers
+{
+    public class JasmineBrowserBuilder : LayoutEngineBrowserBuilder
+    {
+        private const String VERSION_REGEXP = ".*?(?:(?:Jasmine/))([0-9\\.]+).*?";
+        private static Regex versionRegex = new Regex(VERSION_REGEXP, RegexOptions.Compiled);
+
+        protected override Browser BuildBrowser(UserAgent userAgent, string layoutEngine, string layoutEngineVersion, int hintedWidth, int hintedHeight)
+        {
+            String version = null;
+
+            if (!versionRegex.IsMatch(userAgent.completeUserAgent))
+            {
+                return null;
+
+            }
+            else
+            {
+                Match versionMatcher = versionRegex.Match(userAgent.completeUserAgent);
+                GroupCollection groups = versionMatcher.Groups;
+
+                if (groups[1] != null && groups[1].Value.Trim().Length > 0)
+                {
+                    version = groups[1].Value;
+                }
+            }
+
+            int confidence = 60;
+            Browser identified = new Browser();
+
+            identified.SetVendor("Samsung");
+            identified.SetModel("Jasmine");
+            identified.SetVersion(version);
+            String[] versionEl = version.Split(".".ToCharArray());
+
+            if (versionEl.Length > 0)
+            {
+                identified.majorRevision = versionEl[0];
+            }
+
+            if (versionEl.Length > 1)
+            {
+                identified.minorRevision = versionEl[1];
+                confidence += 10;
+            }
+
+            if (versionEl.Length > 2)
+            {
+                identified.microRevision = versionEl[2];
+            }
+
+            if (versionEl.Length > 3)
+            {
+                identified.nanoRevision = versionEl[3];
+            }
+
+            if (layoutEngine != null)
+            {
+                identified.SetLayoutEngine(layoutEngine);
+                identified.SetLayoutEngineVersion(layoutEngineVersion);
+            }
+
+            identified.SetDisplayWidth(hintedWidth);
+            identified.SetDisplayHeight(hintedHeight);
+            identified.confidence = confidence;
+
+            return identified;
+        }
+
+        public override bool CanBuild(UserAgent userAgent)
+        {
+            return userAgent.completeUserAgent.Contains("Jasmine");
+        }
+    }
+}

Added: incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/KonquerorBrowserBuilder.cs
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/KonquerorBrowserBuilder.cs?rev=1392912&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/KonquerorBrowserBuilder.cs (added)
+++ incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/KonquerorBrowserBuilder.cs Tue Oct  2 13:34:31 2012
@@ -0,0 +1,108 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using Oddr.Models.Browsers;
+using Oddr.Models;
+
+namespace Oddr.Builders.Browsers
+{
+    public class KonquerorBrowserBuilder : LayoutEngineBrowserBuilder
+    {
+        private const String KONQUEROR_VERSION_REGEXP = ".*Konqueror/([0-9a-z\\.\\-]+).*";
+        private static Regex konquerorVersionPattern = new Regex(KONQUEROR_VERSION_REGEXP, RegexOptions.Compiled);
+
+        protected override Browser BuildBrowser(UserAgent userAgent, string layoutEngine, string layoutEngineVersion, int hintedWidth, int hintedHeight)
+        {
+            if (!userAgent.mozillaPattern) {
+                return null;
+            }
+
+            int confidence = 60;
+            Browser identified = new Browser();
+
+            identified.SetVendor("KDE");
+            identified.SetModel("Konqueror");
+            identified.SetVersion("-");
+            identified.majorRevision = "-";
+
+            if (konquerorVersionPattern.IsMatch(userAgent.completeUserAgent)) {
+                Match chromeMatcher = konquerorVersionPattern.Match(userAgent.completeUserAgent);
+                GroupCollection groups = chromeMatcher.Groups;
+
+                if (groups[1] != null && groups[1].Value.Trim().Length > 0) {
+                    identified.SetVersion(groups[1].Value);
+
+                    string versionFullString = groups[1].Value;
+                    String[] version = versionFullString.Split(".".ToCharArray());
+
+                    if (version.Length > 0) {
+                        identified.majorRevision = version[0];
+                        if (identified.majorRevision.Length == 0) {
+                            identified.majorRevision = "1";
+                        }
+                    }
+
+                    if (version.Length > 1) {
+                        identified.minorRevision = version[1];
+                        confidence += 10;
+                    }
+
+                    if (version.Length > 2) {
+                        identified.microRevision = version[2];
+                    }
+
+                    if (version.Length > 3) {
+                        identified.nanoRevision = version[3];
+                    }
+                }
+
+            } else {
+                //fallback version
+                identified.SetVersion("1.0");
+                identified.majorRevision = "1";
+            }
+
+            if (layoutEngine != null) {
+                identified.SetLayoutEngine(layoutEngine);
+                identified.SetLayoutEngineVersion(layoutEngineVersion);
+                if (layoutEngine.Equals(LayoutEngineBrowserBuilder.KHML)) {
+                    confidence += 10;
+                }
+            }
+
+            identified.SetDisplayWidth(hintedWidth);
+            identified.SetDisplayHeight(hintedHeight);
+            identified.confidence = confidence;
+
+            return identified;
+        }
+
+        public override bool CanBuild(UserAgent userAgent)
+        {
+            return userAgent.completeUserAgent.Contains("Konqueror");
+        }
+    }
+}

Added: incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/LayoutEngineBrowserBuilder.cs
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/LayoutEngineBrowserBuilder.cs?rev=1392912&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/LayoutEngineBrowserBuilder.cs (added)
+++ incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/LayoutEngineBrowserBuilder.cs Tue Oct  2 13:34:31 2012
@@ -0,0 +1,115 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using Oddr.Models.Browsers;
+using Oddr.Models;
+
+namespace Oddr.Builders.Browsers
+{
+    public abstract class LayoutEngineBrowserBuilder : HintedResolutionBrowserBuilder
+    {
+        protected const String APPLEWEBKIT = "AppleWebKit";
+        protected const String PRESTO = "Presto";
+        protected const String GECKO = "Gecko";
+        protected const String TRIDENT = "Trident";
+        protected const String KHML = "KHTML";
+        private const String WEBKIT_VERSION_REGEXP = ".*AppleWebKit/([0-9\\.]+).*?";
+        private const String PRESTO_VERSION_REGEXP = ".*Presto/([0-9\\.]+).*?";
+        private const String GECKO_VERSION_REGEXP = ".*Gecko/([0-9\\.]+).*?";
+        private const String TRIDENT_VERSION_REGEXP = ".*Trident/([0-9\\.]+).*?";
+        private const String KHTML_VERSION_REGEXP = ".*KHTML/([0-9\\.]+).*?";
+        private static Regex webkitVersionRegex = new Regex(WEBKIT_VERSION_REGEXP, RegexOptions.Compiled);
+        private static Regex prestoVersionRegex = new Regex(PRESTO_VERSION_REGEXP, RegexOptions.Compiled);
+        private static Regex geckoVersionRegex = new Regex(GECKO_VERSION_REGEXP, RegexOptions.Compiled);
+        private static Regex tridentVersionRegex = new Regex(TRIDENT_VERSION_REGEXP, RegexOptions.Compiled);
+        private static Regex khtmlVersionRegex = new Regex(KHTML_VERSION_REGEXP, RegexOptions.Compiled);
+
+
+        protected override Browser BuildBrowser(UserAgent userAgent, int hintedWidth, int hintedHeight)
+        {
+            String layoutEngine = null;
+            String layoutEngineVersion = null;
+
+            Match match = null;
+
+            if (webkitVersionRegex.IsMatch(userAgent.completeUserAgent))
+            {
+                match = webkitVersionRegex.Match(userAgent.completeUserAgent);
+                layoutEngine = APPLEWEBKIT;
+                GroupCollection groups = match.Groups;
+                layoutEngineVersion = groups[1].Value;
+
+            }
+            else
+            {
+
+                if (prestoVersionRegex.IsMatch(userAgent.completeUserAgent))
+                {
+                    match = prestoVersionRegex.Match(userAgent.completeUserAgent);
+                    layoutEngine = "Presto";
+                    GroupCollection groups = match.Groups;
+                    layoutEngineVersion = groups[1].Value;
+
+                }
+                else
+                {
+                    if (geckoVersionRegex.IsMatch(userAgent.completeUserAgent))
+                    {
+                        match = geckoVersionRegex.Match(userAgent.completeUserAgent);
+                        layoutEngine = "Gecko";
+                        GroupCollection groups = match.Groups;
+                        layoutEngineVersion = groups[1].Value;
+
+                    }
+                    else
+                    {
+                        if (tridentVersionRegex.IsMatch(userAgent.completeUserAgent))
+                        {
+                            match = tridentVersionRegex.Match(userAgent.completeUserAgent);
+                            layoutEngine = "Trident";
+                            GroupCollection groups = match.Groups;
+                            layoutEngineVersion = groups[1].Value;
+
+                        }
+                        else
+                        {
+                            if (khtmlVersionRegex.IsMatch(userAgent.completeUserAgent))
+                            {
+                                match = khtmlVersionRegex.Match(userAgent.completeUserAgent);
+                                layoutEngine = "KHTML";
+                                GroupCollection groups = match.Groups;
+                                layoutEngineVersion = groups[1].Value;
+                            }
+                        }
+                    }
+                }
+            }
+            return BuildBrowser(userAgent, layoutEngine, layoutEngineVersion, hintedWidth, hintedHeight);
+        }
+
+        protected abstract Browser BuildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight);
+    }
+}

Added: incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/NetFrontBrowserBuilder.cs
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/NetFrontBrowserBuilder.cs?rev=1392912&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/NetFrontBrowserBuilder.cs (added)
+++ incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/NetFrontBrowserBuilder.cs Tue Oct  2 13:34:31 2012
@@ -0,0 +1,111 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using Oddr.Models;
+using Oddr.Models.Browsers;
+
+namespace Oddr.Builders.Browsers
+{
+    public class NetFrontBrowserBuilder : LayoutEngineBrowserBuilder
+    {
+        private const String VERSION_REGEXP = ".*?(?:(?:Net[Ff]ront)|(?:ACS-NF)|(?:NF-Browser))[/ ]?[/ ]?(?:WAP)?([0-9\\.]+).*?";
+        private static Regex versionRegex = new Regex(VERSION_REGEXP, RegexOptions.Compiled);
+
+        private const string NETFRONT_REGEXP = /*"(?i).*netfront.*"*/".*netfront.*";
+        private static Regex netfrontRegex = new Regex(NETFRONT_REGEXP, RegexOptions.Compiled | RegexOptions.IgnoreCase);
+
+        protected override Browser BuildBrowser(UserAgent userAgent, string layoutEngine, string layoutEngineVersion, int hintedWidth, int hintedHeight)
+        {
+            String version = null;
+
+            if (!versionRegex.IsMatch(userAgent.completeUserAgent))
+            {
+                return null;
+
+            }
+            else
+            {
+                Match versionMatcher = versionRegex.Match(userAgent.completeUserAgent);
+                GroupCollection groups = versionMatcher.Groups;
+
+                if (groups[1] != null && groups[1].Value.Trim().Length > 0)
+                {
+                    version = groups[1].Value;
+                }
+            }
+
+            int confidence = 60;
+            Browser identified = new Browser();
+
+            identified.SetVendor("Access");
+            identified.SetModel("NetFront");
+            identified.SetVersion(version);
+            String[] versionEl = version.Split(".".ToCharArray());
+
+            if (versionEl.Length > 0)
+            {
+                identified.majorRevision = versionEl[0];
+            }
+
+            if (versionEl.Length > 1)
+            {
+                identified.minorRevision = versionEl[1];
+                confidence += 10;
+            }
+
+            if (versionEl.Length > 2)
+            {
+                identified.microRevision = versionEl[2];
+            }
+
+            if (versionEl.Length > 3)
+            {
+                identified.nanoRevision = versionEl[3];
+            }
+
+            if (layoutEngine != null)
+            {
+                identified.SetLayoutEngine(layoutEngine);
+                identified.SetLayoutEngineVersion(layoutEngineVersion);
+            }
+
+            identified.SetDisplayWidth(hintedWidth);
+            identified.SetDisplayHeight(hintedHeight);
+            identified.confidence = confidence;
+
+            return identified;
+        }
+
+        public override bool CanBuild(UserAgent userAgent)
+        {
+            if (netfrontRegex.IsMatch(userAgent.completeUserAgent) || userAgent.completeUserAgent.Contains("ACS-NF") || userAgent.completeUserAgent.Contains("NF-Browser"))
+            {
+                return true;
+            }
+            return false;
+        }
+    }
+}

Added: incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/NokiaBrowserBuilder.cs
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/NokiaBrowserBuilder.cs?rev=1392912&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/NokiaBrowserBuilder.cs (added)
+++ incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/NokiaBrowserBuilder.cs Tue Oct  2 13:34:31 2012
@@ -0,0 +1,119 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using Oddr.Models.Browsers;
+using Oddr.Models;
+
+namespace Oddr.Builders.Browsers
+{
+    public class NokiaBrowserBuilder : LayoutEngineBrowserBuilder
+    {
+        private const String NOKIA_BROWSER_VERSION_REGEXP = ".*(?:(?:BrowserNG)|(?:NokiaBrowser))/([0-9\\.]+).*";
+        private const String SAFARI_VERSION_REGEXP = ".*Safari/([0-9\\.]+).*";
+        private static Regex nokiaBrowserVersionRegex = new Regex(NOKIA_BROWSER_VERSION_REGEXP, RegexOptions.Compiled);
+        private static Regex safariVersionRegex = new Regex(SAFARI_VERSION_REGEXP, RegexOptions.Compiled);
+
+        protected override Browser BuildBrowser(UserAgent userAgent, string layoutEngine, string layoutEngineVersion, int hintedWidth, int hintedHeight)
+        {
+            if (!(userAgent.mozillaPattern || userAgent.completeUserAgent.Contains("SymbianOS") || userAgent.completeUserAgent.Contains("Symbian/3") || userAgent.completeUserAgent.Contains("Nokia"))) {
+                return null;
+            }
+
+            int confidence = 50;
+            Browser identified = new Browser();
+
+            identified.SetVendor("Nokia");
+            identified.SetModel("Nokia Browser");
+            identified.SetVersion("-");
+            identified.majorRevision = "-";
+
+            if (nokiaBrowserVersionRegex.IsMatch(userAgent.completeUserAgent)) {
+                Match nokiaBrowserMatcher = nokiaBrowserVersionRegex.Match(userAgent.completeUserAgent);
+                GroupCollection groups = nokiaBrowserMatcher.Groups;
+
+                if (groups[1] != null && groups[1].Value.Trim().Length > 0) {
+                    identified.SetVersion(groups[1].Value);
+
+                    string versionFullString = groups[1].Value;
+                    String[] version = versionFullString.Split(".".ToCharArray());
+
+                    if (version.Length > 0) {
+                        identified.majorRevision = version[0];
+                        if (identified.majorRevision.Length == 0) {
+                            identified.majorRevision = "1";
+                        }
+                    }
+
+                    if (version.Length > 1) {
+                        identified.minorRevision = version[1];
+                        confidence += 10;
+                    }
+
+                    if (version.Length > 2) {
+                        identified.microRevision = version[2];
+                    }
+
+                    if (version.Length > 3) {
+                        identified.nanoRevision = version[3];
+                    }
+                }
+
+            }
+
+            if (layoutEngine != null) {
+                identified.SetLayoutEngine(layoutEngine);
+                identified.SetLayoutEngineVersion(layoutEngineVersion);
+                if (layoutEngine.Equals(LayoutEngineBrowserBuilder.APPLEWEBKIT)) {
+                    confidence += 10;
+                }
+            }
+
+            if (safariVersionRegex.IsMatch(userAgent.completeUserAgent))
+            {
+                Match safariMatcher = safariVersionRegex.Match(userAgent.completeUserAgent);
+                GroupCollection groups = safariMatcher.Groups;
+
+                if (groups[1] != null && groups[1].Value.Trim().Length > 0)
+                {
+                    identified.SetReferenceBrowser("Safari");
+                    identified.SetReferenceBrowserVersion(groups[1].Value);
+                    confidence += 10;
+                }
+            }
+
+            identified.SetDisplayWidth(hintedWidth);
+            identified.SetDisplayHeight(hintedHeight);
+            identified.confidence = confidence;
+
+            return identified;
+        }
+
+        public override bool CanBuild(UserAgent userAgent)
+        {
+            return (userAgent.completeUserAgent.Contains("Nokia") || userAgent.completeUserAgent.Contains("NokiaBrowser") || userAgent.completeUserAgent.Contains("BrowserNG") || userAgent.completeUserAgent.Contains("Series60"));
+        }
+    }
+}

Added: incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/ObigoBrowserBuilder.cs
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/ObigoBrowserBuilder.cs?rev=1392912&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/ObigoBrowserBuilder.cs (added)
+++ incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/ObigoBrowserBuilder.cs Tue Oct  2 13:34:31 2012
@@ -0,0 +1,181 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using Oddr.Models.Browsers;
+using Oddr.Models;
+
+namespace Oddr.Builders.Browsers
+{
+    public class ObigoBrowserBuilder : LayoutEngineBrowserBuilder
+    {
+        private const String VERSION_REGEXP = ".*?(?:(?:ObigoInternetBrowser/)|(?:Obigo Browser )|(?:[Oo]bigo[- ][Bb]rowser/))([0-9A-Z\\.]+).*?";
+        private const String VERSION_REGEXP2 = ".*?(?:(?:Browser/Obigo)|(?:OBIGO[/_-])|(?:Obigo[-/ ]))([0-9A-Z\\.]+).*?";
+        private const String VERSION_REGEXP3 = ".*?(?:(?:Obigo[Il]nternetBrowser/)|(?:Obigo Browser )|(?:[Oo]bigo[- ][Bb]rowser/))([0-9A-Zacqv\\.]+).*?";
+        private const String VERSION_REGEXP4 = ".*?(?:(?:[Bb]rowser/[Oo]bigo)|(?:OBIGO[/_-])|(?:Obigo[-/ ]))([0-9A-Zacqv\\.]+).*?";
+        private const String VERSION_REGEXP5 = ".*?(?:(?:[Tt]eleca Q))([0-9A-Zacqv\\.]+).*?";
+        private static Regex versionRegex = new Regex(VERSION_REGEXP, RegexOptions.Compiled);
+        private static Regex versionRegex2 = new Regex(VERSION_REGEXP2, RegexOptions.Compiled);
+        private static Regex versionRegex3 = new Regex(VERSION_REGEXP3, RegexOptions.Compiled);
+        private static Regex versionRegex4 = new Regex(VERSION_REGEXP4, RegexOptions.Compiled);
+        private static Regex versionRegex5 = new Regex(VERSION_REGEXP5, RegexOptions.Compiled);
+
+        private const string OBIGO_TELECA_REGEXP = /*"(?i)(.*obigo.*)|(.*teleca.*)"*/"(.*obigo.*)|(.*teleca.*)";
+        private static Regex obigoTelecaRegex = new Regex(OBIGO_TELECA_REGEXP, RegexOptions.Compiled | RegexOptions.IgnoreCase);
+
+
+
+        protected override Browser BuildBrowser(UserAgent userAgent, string layoutEngine, string layoutEngineVersion, int hintedWidth, int hintedHeight)
+        {
+            String version = null;
+
+            int confidence = 60;
+            Browser identified = new Browser();
+            identified.SetVendor("Obigo");
+            identified.SetModel("Obigo Browser");
+
+            if (!versionRegex.IsMatch(userAgent.completeUserAgent))
+            {
+                version = null;
+
+            }
+            else
+            {
+                Match versionMatcher = versionRegex.Match(userAgent.completeUserAgent);
+                GroupCollection groups = versionMatcher.Groups;
+
+                if (groups[1] != null && groups[1].Value.Trim().Length > 0)
+                {
+                    version = groups[1].Value;
+                }
+            }
+
+            if (version == null)
+            {
+                if (!versionRegex2.IsMatch(userAgent.completeUserAgent))
+                {
+                    version = null;
+
+                }
+                else
+                {
+                    Match versionMatcher2 = versionRegex2.Match(userAgent.completeUserAgent);
+                    GroupCollection groups = versionMatcher2.Groups;
+
+                    if (groups[1] != null && groups[1].Value.Trim().Length > 0)
+                    {
+                        version = groups[1].Value;
+                    }
+                }
+            }
+
+            if (version == null)
+            {
+                if (!versionRegex3.IsMatch(userAgent.completeUserAgent))
+                {
+                    version = null;
+
+                }
+                else
+                {
+                    Match versionMatcher3 = versionRegex3.Match(userAgent.completeUserAgent);
+                    GroupCollection groups = versionMatcher3.Groups;
+
+                    if (groups[1] != null && groups[1].Value.Trim().Length > 0)
+                    {
+                        version = groups[1].Value;
+                    }
+                }
+            }
+
+            if (version == null)
+            {
+                if (!versionRegex4.IsMatch(userAgent.completeUserAgent))
+                {
+                    version = null;
+
+                }
+                else
+                {
+                    Match versionMatcher4 = versionRegex4.Match(userAgent.completeUserAgent);
+                    GroupCollection groups = versionMatcher4.Groups;
+
+                    if (groups[1] != null && groups[1].Value.Trim().Length > 0)
+                    {
+                        version = groups[1].Value;
+                    }
+                }
+            }
+
+            if (version == null)
+            {
+                if (!versionRegex5.IsMatch(userAgent.completeUserAgent))
+                {
+                    version = null;
+
+                }
+                else
+                {
+                    Match versionMatcher5 = versionRegex5.Match(userAgent.completeUserAgent);
+                    GroupCollection groups = versionMatcher5.Groups;
+
+                    if (groups[1] != null && groups[1].Value.Trim().Length > 0)
+                    {
+                        version = groups[1].Value;
+                        identified.SetModel("Teleca-Obigo");
+                    }
+                }
+            }
+
+            if (version == null)
+            {
+                return null;
+            }
+
+            identified.SetVersion(version);
+
+            if (layoutEngine != null)
+            {
+                identified.SetLayoutEngine(layoutEngine);
+                identified.SetLayoutEngineVersion(layoutEngineVersion);
+            }
+
+            identified.SetDisplayWidth(hintedWidth);
+            identified.SetDisplayHeight(hintedHeight);
+            identified.confidence = confidence;
+
+            return identified;
+        }
+
+        public override bool CanBuild(UserAgent userAgent)
+        {
+            if (obigoTelecaRegex.IsMatch(userAgent.completeUserAgent))
+            {
+                return true;
+            }
+            return false;
+        }
+    }
+}

Added: incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/OpenWaveBrowserBuilder.cs
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/OpenWaveBrowserBuilder.cs?rev=1392912&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/OpenWaveBrowserBuilder.cs (added)
+++ incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/OpenWaveBrowserBuilder.cs Tue Oct  2 13:34:31 2012
@@ -0,0 +1,112 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Oddr.Models;
+using Oddr.Models.Browsers;
+using System.Text.RegularExpressions;
+
+namespace Oddr.Builders.Browsers
+{
+    public class OpenWaveBrowserBuilder : LayoutEngineBrowserBuilder
+    {
+        private const String VERSION_REGEXP = /*"(?i).*openwave[/ ]?([0-9\\.]+).*?"*/".*openwave[/ ]?([0-9\\.]+).*?";
+        private static Regex versionRegex = new Regex(VERSION_REGEXP, RegexOptions.Compiled | RegexOptions.IgnoreCase);
+
+        private const string OPENWAVE_REGEXP = /*"(?i).*openwave.*"*/".*openwave.*";
+        private static Regex openwaveRegex = new Regex(OPENWAVE_REGEXP, RegexOptions.Compiled | RegexOptions.IgnoreCase);
+
+        protected override Browser BuildBrowser(UserAgent userAgent, string layoutEngine, string layoutEngineVersion, int hintedWidth, int hintedHeight)
+        {
+            String version = null;
+
+            if (!versionRegex.IsMatch(userAgent.completeUserAgent))
+            {
+                return null;
+
+            }
+            else
+            {
+                Match versionMatcher = versionRegex.Match(userAgent.completeUserAgent);
+                GroupCollection groups = versionMatcher.Groups;
+
+                if (groups[1] != null && groups[1].Value.Trim().Length > 0)
+                {
+                    version = groups[1].Value;
+                }
+            }
+
+            int confidence = 60;
+            Browser identified = new Browser();
+
+            identified.SetVendor("Openwave");
+            identified.SetModel("OpenWave");
+            identified.SetVersion(version);
+
+            String[] versionEl = version.Split(".".ToCharArray());
+
+            if (versionEl.Length > 0)
+            {
+                identified.majorRevision = versionEl[0];
+            }
+
+            if (versionEl.Length > 1)
+            {
+                identified.minorRevision = versionEl[1];
+                confidence += 10;
+            }
+
+            if (versionEl.Length > 2)
+            {
+                identified.microRevision = versionEl[2];
+            }
+
+            if (versionEl.Length > 3)
+            {
+                identified.nanoRevision = versionEl[3];
+            }
+
+            if (layoutEngine != null)
+            {
+                identified.SetLayoutEngine(layoutEngine);
+                identified.SetLayoutEngineVersion(layoutEngineVersion);
+            }
+
+            identified.SetDisplayWidth(hintedWidth);
+            identified.SetDisplayHeight(hintedHeight);
+            identified.confidence = confidence;
+
+            return identified;
+        }
+
+        public override bool CanBuild(Models.UserAgent userAgent)
+        {
+            if (openwaveRegex.IsMatch(userAgent.completeUserAgent))
+            {
+                return true;
+            }
+            return false;
+        }
+    }
+}

Added: incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/OperaBrowserBuilder.cs
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/OperaBrowserBuilder.cs?rev=1392912&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/OperaBrowserBuilder.cs (added)
+++ incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/OperaBrowserBuilder.cs Tue Oct  2 13:34:31 2012
@@ -0,0 +1,152 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using Oddr.Models.Browsers;
+using Oddr.Models;
+
+namespace Oddr.Builders.Browsers
+{
+    public class OperaBrowserBuilder : LayoutEngineBrowserBuilder
+    {
+        private const String OPERAMINI_VERSION_REGEXP = "Opera Mobi/(.*)";
+        private const String OPERA_VERSION_REGEXP = ".* Opera ([0-9\\.]+).*";
+        private static Regex operaMiniVersionRegex = new Regex(OPERAMINI_VERSION_REGEXP, RegexOptions.Compiled);
+        private static Regex operaVersionRegex = new Regex(OPERA_VERSION_REGEXP, RegexOptions.Compiled);
+
+        protected override Browser BuildBrowser(UserAgent userAgent, string layoutEngine, string layoutEngineVersion, int hintedWidth, int hintedHeight)
+        {
+            if ((!userAgent.operaPattern || userAgent.operaVersion == null || userAgent.operaVersion.Length == 0) && (!operaVersionRegex.IsMatch(userAgent.completeUserAgent)))
+            {
+                return null;
+            }
+
+            int confidence = 60;
+            Browser identified = new Browser();
+
+            identified.SetVendor("Opera");
+            if (userAgent.completeUserAgent.Contains("Mobi"))
+            {
+                identified.SetModel("Opera Mobile");
+                confidence += 10;
+
+            }
+            else if (userAgent.completeUserAgent.Contains("Tablet"))
+            {
+                identified.SetModel("Opera Tablet");
+
+            }
+            else
+            {
+                identified.SetModel("Opera");
+            }
+
+            if (userAgent.operaVersion != null)
+            {
+                identified.SetVersion(userAgent.operaVersion);
+            }
+            else
+            {
+                if (operaVersionRegex.IsMatch(userAgent.completeUserAgent))
+                {
+                    Match operaMatcher = operaVersionRegex.Match(userAgent.completeUserAgent);
+                    GroupCollection groups = operaMatcher.Groups;
+
+                    if (groups[1] != null && groups[1].Value.Trim().Length > 0)
+                    {
+                        identified.SetVersion(groups[1].Value);
+                    }
+                }
+            }
+
+            String[] version = identified.GetVersion().Split(".".ToCharArray());
+
+            if (version.Length > 0)
+            {
+                identified.majorRevision = version[0];
+            }
+
+            if (version.Length > 1)
+            {
+                identified.minorRevision = version[1];
+                confidence += 10;
+            }
+
+            if (version.Length > 2)
+            {
+                identified.microRevision = version[2];
+            }
+
+            if (version.Length > 3)
+            {
+                identified.nanoRevision = version[3];
+            }
+
+            if (layoutEngine != null)
+            {
+                identified.SetLayoutEngine(layoutEngine);
+                identified.SetLayoutEngineVersion(layoutEngineVersion);
+                if (layoutEngine.Equals(LayoutEngineBrowserBuilder.PRESTO))
+                {
+                    confidence += 10;
+                }
+            }
+
+            if (userAgent.GetPatternElementsInside() != null)
+            {
+                String[] inside = userAgent.GetPatternElementsInside().Split(";".ToCharArray());
+                foreach (String token in inside)
+                {
+                    String element = token.Trim();
+
+                    if (operaMiniVersionRegex.IsMatch(element))
+                    {
+                        Match miniMatcher = operaMiniVersionRegex.Match(element);
+                        GroupCollection groups = miniMatcher.Groups;
+
+                        if (groups[1] != null && groups[1].Value.Trim().Length > 0)
+                        {
+                            identified.SetReferenceBrowser("Opera Mobi");
+                            identified.SetReferenceBrowserVersion(groups[1].Value);
+                            confidence += 10;
+                            break;
+                        }
+                    }
+                }
+            }
+
+            identified.SetDisplayWidth(hintedWidth);
+            identified.SetDisplayHeight(hintedHeight);
+            identified.confidence = confidence;
+
+            return identified;
+        }
+
+        public override bool CanBuild(UserAgent userAgent)
+        {
+            return ((userAgent.operaPattern || operaVersionRegex.IsMatch(userAgent.completeUserAgent)) && (!userAgent.completeUserAgent.Contains("Opera Mini")));
+        }
+    }
+}

Added: incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/OperaMiniBrowserBuilder.cs
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/OperaMiniBrowserBuilder.cs?rev=1392912&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/OperaMiniBrowserBuilder.cs (added)
+++ incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/OperaMiniBrowserBuilder.cs Tue Oct  2 13:34:31 2012
@@ -0,0 +1,117 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using Oddr.Models.Browsers;
+using Oddr.Models;
+
+namespace Oddr.Builders.Browsers
+{
+    public class OperaMiniBrowserBuilder : LayoutEngineBrowserBuilder
+    {
+        private const String VERSION_REGEXP = ".*?Opera Mini/(?:att/)?v?((\\d+)\\.(\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))?).*?";
+        private const String BUILD_REGEXP = ".*?Opera Mini/(?:att/)?v?.*?/(.*?);.*";
+        private static Regex versionRegex = new Regex(VERSION_REGEXP, RegexOptions.Compiled);
+        private static Regex buildRegex = new Regex(BUILD_REGEXP, RegexOptions.Compiled);
+
+        protected override Browser BuildBrowser(UserAgent userAgent, string layoutEngine, string layoutEngineVersion, int hintedWidth, int hintedHeight)
+        {
+            if (!versionRegex.IsMatch(userAgent.completeUserAgent))
+            {
+                return null;
+            }
+
+            Match versionMatcher = versionRegex.Match(userAgent.completeUserAgent);
+            GroupCollection groups = versionMatcher.Groups;
+
+            int confidence = 60;
+            Browser identified = new Browser();
+
+            identified.SetVendor("Opera");
+            identified.SetModel("Opera Mini");
+
+            if (groups[1] != null && groups[1].Value.Trim().Length > 0)
+            {
+                identified.SetVersion(groups[1].Value);
+            }
+            if (groups[2] != null && groups[2].Value.Trim().Length > 0)
+            {
+                identified.majorRevision = groups[2].Value;
+            }
+            if (groups[3] != null && groups[3].Value.Trim().Length > 0)
+            {
+                identified.minorRevision = groups[3].Value;
+            }
+            if (groups[4] != null && groups[4].Value.Trim().Length > 0)
+            {
+                identified.microRevision = groups[4].Value;
+            }
+            if (groups[5] != null && groups[5].Value.Trim().Length > 0)
+            {
+                identified.nanoRevision = groups[5].Value;
+            }
+
+            if (userAgent.operaPattern && userAgent.operaVersion != null)
+            {
+                identified.SetReferenceBrowser("Opera");
+                identified.SetReferenceBrowserVersion(userAgent.operaVersion);
+                confidence += 20;
+            }
+
+            if (buildRegex.IsMatch(userAgent.completeUserAgent))
+            {
+                Match buildMatcher = buildRegex.Match(userAgent.completeUserAgent);
+                GroupCollection buildGroups = buildMatcher.Groups;
+
+                if (buildGroups[1] != null && buildGroups[1].Value.Trim().Length > 0)
+                {
+                    identified.SetBuild(buildGroups[1].Value);
+                    confidence += 10;
+                }
+            }
+
+            if (layoutEngine != null)
+            {
+                identified.SetLayoutEngine(layoutEngine);
+                identified.SetLayoutEngineVersion(layoutEngineVersion);
+                if (layoutEngine.Equals(LayoutEngineBrowserBuilder.PRESTO))
+                {
+                    confidence += 10;
+                }
+            }
+
+            identified.SetDisplayWidth(hintedWidth);
+            identified.SetDisplayHeight(hintedHeight);
+            identified.confidence = confidence;
+
+            return identified;
+        }
+
+        public override bool CanBuild(UserAgent userAgent)
+        {
+            return userAgent.completeUserAgent.Contains("Opera Mini");
+        }
+    }
+}

Added: incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/PolarisBrowserBuilder.cs
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/PolarisBrowserBuilder.cs?rev=1392912&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/PolarisBrowserBuilder.cs (added)
+++ incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/PolarisBrowserBuilder.cs Tue Oct  2 13:34:31 2012
@@ -0,0 +1,104 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Oddr.Models.Browsers;
+using Oddr.Models;
+using System.Text.RegularExpressions;
+
+namespace Oddr.Builders.Browsers
+{
+    public class PolarisBrowserBuilder : LayoutEngineBrowserBuilder
+    {
+        private const String VERSION_REGEXP = ".*?(?:(?:Polaris)|(?:POLARIS))[/ ](?:v)?([0-9\\.]+).*?";
+        private static Regex versionRegex = new Regex(VERSION_REGEXP, RegexOptions.Compiled);
+
+        protected override Browser BuildBrowser(UserAgent userAgent, string layoutEngine, string layoutEngineVersion, int hintedWidth, int hintedHeight)
+        {
+            String version = null;
+
+            if (!versionRegex.IsMatch(userAgent.completeUserAgent))
+            {
+                return null;
+
+            }
+            else
+            {
+                Match versionMatcher = versionRegex.Match(userAgent.completeUserAgent);
+                GroupCollection groups = versionMatcher.Groups;
+
+                if (groups[1] != null && groups[1].Value.Trim().Length > 0)
+                {
+                    version = groups[1].Value;
+                }
+            }
+
+            int confidence = 60;
+            Browser identified = new Browser();
+
+            identified.SetVendor("Infraware");
+            identified.SetModel("Polaris");
+            identified.SetVersion(version);
+            String[] versionEl = version.Split(".".ToCharArray());
+
+            if (versionEl.Length > 0)
+            {
+                identified.majorRevision = versionEl[0];
+            }
+
+            if (versionEl.Length > 1)
+            {
+                identified.minorRevision = versionEl[1];
+                confidence += 10;
+            }
+
+            if (versionEl.Length > 2)
+            {
+                identified.microRevision = versionEl[2];
+            }
+
+            if (versionEl.Length > 3)
+            {
+                identified.nanoRevision = versionEl[3];
+            }
+
+            if (layoutEngine != null)
+            {
+                identified.SetLayoutEngine(layoutEngine);
+                identified.SetLayoutEngineVersion(layoutEngineVersion);
+            }
+
+            identified.SetDisplayWidth(hintedWidth);
+            identified.SetDisplayHeight(hintedHeight);
+            identified.confidence = confidence;
+
+            return identified;
+        }
+
+        public override bool CanBuild(UserAgent userAgent)
+        {
+            return userAgent.completeUserAgent.Contains("Polaris");
+        }
+    }
+}

Added: incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/SEMCBrowserBuilder.cs
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/SEMCBrowserBuilder.cs?rev=1392912&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/SEMCBrowserBuilder.cs (added)
+++ incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/SEMCBrowserBuilder.cs Tue Oct  2 13:34:31 2012
@@ -0,0 +1,105 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using Oddr.Models.Browsers;
+using Oddr.Models;
+
+namespace Oddr.Builders.Browsers
+{
+    public class SEMCBrowserBuilder : LayoutEngineBrowserBuilder
+    {
+        private const String VERSION_REGEXP = ".*SEMC?(?:(?:-Browser/)|(?:-BROWSER/)|(?:/NewsReader/)|(?:-Java/))(?:Symbian/)?([0-9\\.RA]+).*?";
+        private static Regex versionRegex = new Regex(VERSION_REGEXP);
+
+        protected override Browser BuildBrowser(UserAgent userAgent, string layoutEngine, string layoutEngineVersion, int hintedWidth, int hintedHeight)
+        {
+            String version = null;
+
+            if (!versionRegex.IsMatch(userAgent.completeUserAgent))
+            {
+                return null;
+
+            }
+            else
+            {
+                Match versionMatcher = versionRegex.Match(userAgent.completeUserAgent);
+                GroupCollection groups = versionMatcher.Groups;
+
+                if (groups[1] != null && groups[1].Value.Trim().Length > 0)
+                {
+                    version = groups[1].Value;
+                }
+            }
+
+            int confidence = 60;
+            Browser identified = new Browser();
+
+            identified.SetVendor("SonyEricsson");
+            identified.SetModel("Mobile Browser");
+            identified.SetVersion(version);
+
+            String[] versionEl = version.Split(".".ToCharArray());
+
+            if (versionEl.Length > 0)
+            {
+                identified.majorRevision = versionEl[0];
+            }
+
+            if (versionEl.Length > 1)
+            {
+                identified.minorRevision = versionEl[1];
+                confidence += 10;
+            }
+
+            if (versionEl.Length > 2)
+            {
+                identified.microRevision = versionEl[2];
+            }
+
+            if (versionEl.Length > 3)
+            {
+                identified.nanoRevision = versionEl[3];
+            }
+
+            if (layoutEngine != null)
+            {
+                identified.SetLayoutEngine(layoutEngine);
+                identified.SetLayoutEngineVersion(layoutEngineVersion);
+            }
+
+            identified.SetDisplayWidth(hintedWidth);
+            identified.SetDisplayHeight(hintedHeight);
+            identified.confidence = confidence;
+
+            return identified;
+        }
+
+        public override bool CanBuild(UserAgent userAgent)
+        {
+            return userAgent.completeUserAgent.Contains("SEMC");
+        }
+    }
+}

Added: incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/SafariBrowserBuilder.cs
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/SafariBrowserBuilder.cs?rev=1392912&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/SafariBrowserBuilder.cs (added)
+++ incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/SafariBrowserBuilder.cs Tue Oct  2 13:34:31 2012
@@ -0,0 +1,104 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Oddr.Models.Browsers;
+using Oddr.Models;
+using System.Text.RegularExpressions;
+
+namespace Oddr.Builders.Browsers
+{
+    public class SafariBrowserBuilder : LayoutEngineBrowserBuilder
+    {
+        private const String SAFARI_VERSION_REGEXP = ".*Version/([0-9\\.]+).*";
+        private static Regex safariVersionRegex = new Regex(SAFARI_VERSION_REGEXP);
+
+        protected override Browser BuildBrowser(UserAgent userAgent, string layoutEngine, string layoutEngineVersion, int hintedWidth, int hintedHeight)
+        {
+            if (!(userAgent.mozillaPattern)) {
+                return null;
+            }
+
+            int confidence = 60;
+            Browser identified = new Browser();
+
+            identified.SetVendor("Apple");
+            identified.SetModel("Safari");
+            identified.SetVersion("-");
+            identified.majorRevision = "-";
+
+            if (safariVersionRegex.IsMatch(userAgent.completeUserAgent)) {
+                Match safariMatcher = safariVersionRegex.Match(userAgent.completeUserAgent);
+                GroupCollection groups = safariMatcher.Groups;
+
+                if (groups[1] != null && groups[1].Value.Trim().Length > 0) {
+                    identified.SetVersion(groups[1].Value);
+
+                    string versionFullString = groups[1].Value;
+                    String[] version = versionFullString.Split(".".ToCharArray());
+
+                    if (version.Length > 0) {
+                        identified.majorRevision = version[0];
+                        if (identified.majorRevision.Length == 0) {
+                            identified.majorRevision = "1";
+                        }
+                    }
+
+                    if (version.Length > 1) {
+                        identified.minorRevision = version[1];
+                        confidence += 10;
+                    }
+
+                    if (version.Length > 2) {
+                        identified.microRevision = version[2];
+                    }
+
+                    if (version.Length > 3) {
+                        identified.nanoRevision = version[3];
+                    }
+                }
+
+            }
+
+            if (layoutEngine != null) {
+                identified.SetLayoutEngine(layoutEngine);
+                identified.SetLayoutEngineVersion(layoutEngineVersion);
+                if (layoutEngine.Equals(LayoutEngineBrowserBuilder.GECKO)) {
+                    confidence += 10;
+                }
+            }
+
+            identified.SetDisplayWidth(hintedWidth);
+            identified.SetDisplayHeight(hintedHeight);
+            identified.confidence = confidence;
+
+            return identified;
+        }
+
+        public override bool CanBuild(UserAgent userAgent)
+        {
+            return (userAgent.completeUserAgent.Contains("Safari") && !userAgent.completeUserAgent.Contains("Mobile"));
+        }
+    }
+}

Added: incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/SafariMobileBrowserBuilder.cs
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/SafariMobileBrowserBuilder.cs?rev=1392912&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/SafariMobileBrowserBuilder.cs (added)
+++ incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/SafariMobileBrowserBuilder.cs Tue Oct  2 13:34:31 2012
@@ -0,0 +1,129 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using Oddr.Models;
+using Oddr.Models.Browsers;
+
+namespace Oddr.Builders.Browsers
+{
+    public class SafariMobileBrowserBuilder : LayoutEngineBrowserBuilder
+    {
+        private const string VERSION_REGEXP = ".*Version/([0-9\\.]+).*?";
+        private const string SAFARI_REGEXP = ".*Safari/([0-9\\.]+).*?";
+        private static Regex versionRegex = new Regex(VERSION_REGEXP);
+        private static Regex safariRegex = new Regex(SAFARI_REGEXP);
+
+
+        protected override Browser BuildBrowser(UserAgent userAgent, string layoutEngine, string layoutEngineVersion, int hintedWidth, int hintedHeight)
+        {
+            if (!userAgent.containsIOSDevices)
+            {
+                return null;
+            }
+
+            int confidence = 70;
+            Browser identified = new Browser();
+
+            identified.SetVendor("Apple");
+            identified.SetModel("Mobile Safari");
+
+            if (versionRegex.IsMatch(userAgent.completeUserAgent))
+            {
+                Match versionMatcher = versionRegex.Match(userAgent.completeUserAgent);
+                GroupCollection groups = versionMatcher.Groups;
+
+                if (groups[1] != null && groups[1].Value.Trim().Length > 0)
+                {
+                    identified.SetVersion(groups[1].Value);
+                    string versionFullString = groups[1].Value;
+                    String[] version = versionFullString.Split(".".ToCharArray());
+
+                    if (version.Length > 0)
+                    {
+                        identified.majorRevision = version[0];
+                    }
+
+                    if (version.Length > 1)
+                    {
+                        identified.minorRevision = version[1];
+                        confidence += 10;
+                    }
+
+                    if (version.Length > 2)
+                    {
+                        identified.microRevision = version[2];
+                    }
+
+                    if (version.Length > 3)
+                    {
+                        identified.nanoRevision = version[3];
+                    }
+                }
+
+            }
+            else
+            {
+                //fallback version
+                identified.SetVersion("1.0");
+                identified.majorRevision = "1";
+            }
+
+            if (layoutEngine != null)
+            {
+                identified.SetLayoutEngine(layoutEngine);
+                identified.SetLayoutEngineVersion(layoutEngineVersion);
+                if (layoutEngine.Equals(LayoutEngineBrowserBuilder.APPLEWEBKIT))
+                {
+                    confidence += 10;
+                }
+            }
+
+            if (safariRegex.IsMatch(userAgent.completeUserAgent))
+            {
+                Match safariMatcher = safariRegex.Match(userAgent.completeUserAgent);
+                GroupCollection groups = safariMatcher.Groups;
+
+                if (groups[1] != null && groups[1].Value.Trim().Length > 0)
+                {
+                    identified.SetReferenceBrowser("Safari");
+                    identified.SetReferenceBrowserVersion(groups[1].Value);
+                    confidence += 10;
+                }
+            }
+
+            identified.SetDisplayWidth(hintedWidth);
+            identified.SetDisplayHeight(hintedHeight);
+            identified.confidence = confidence;
+
+            return identified;
+        }
+
+        public override bool CanBuild(UserAgent userAgent)
+        {
+            return userAgent.containsIOSDevices;
+        }
+    }
+}

Added: incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/SilkBrowserBuilder.cs
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/SilkBrowserBuilder.cs?rev=1392912&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/SilkBrowserBuilder.cs (added)
+++ incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/SilkBrowserBuilder.cs Tue Oct  2 13:34:31 2012
@@ -0,0 +1,140 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using Oddr.Models;
+using Oddr.Models.Browsers;
+
+namespace Oddr.Builders.Browsers
+{
+    public class SilkBrowserBuilder : LayoutEngineBrowserBuilder
+    {
+        private const String VERSION_REGEXP = ".*Version/([0-9\\.]+).*?";
+        private const String SILK_VERSION_REGEXP = ".*Silk/([0-9a-z\\.\\-]+)";
+        private static Regex versionRegex = new Regex(VERSION_REGEXP, RegexOptions.Compiled);
+        private static Regex silkVersionRegex = new Regex(SILK_VERSION_REGEXP, RegexOptions.Compiled);
+
+        public override bool CanBuild(UserAgent userAgent)
+        {
+            return (userAgent.completeUserAgent.Contains("Silk-Accelerated"));
+        }
+
+        protected override Browser BuildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight)
+        {
+            if (!(userAgent.mozillaPattern))
+            {
+                return null;
+            }
+
+            int confidence = 60;
+            Browser identified = new Browser();
+
+            identified.SetVendor("Amazon");
+            identified.SetModel("Silk");
+            identified.SetVersion("-");
+            identified.majorRevision = "-";
+
+            Match silkMatcher = silkVersionRegex.Match(userAgent.GetPatternElementsInside());
+            GroupCollection groups = silkMatcher.Groups;
+
+            if (silkMatcher.Success)
+            {
+                if (groups[1] != null && groups[1].Value.Trim().Length > 0)
+                {
+                    identified.SetVersion(groups[1].Value);
+                    string versionFullString = groups[1].Value;
+                    String[] version = versionFullString.Split(".".ToCharArray());
+
+                    if (version.Length > 0)
+                    {
+                        identified.majorRevision = version[0];
+                        if (identified.majorRevision.Length == 0)
+                        {
+                            identified.majorRevision = "1";
+                        }
+                    }
+
+                    if (version.Length > 1)
+                    {
+                        identified.minorRevision = version[1];
+                        confidence += 10;
+                    }
+
+                    if (version[2] != null)
+                    {
+                        String[] subVersion = version[2].Split("-".ToCharArray());
+
+                        if (subVersion.Length > 0)
+                        {
+                            identified.microRevision = subVersion[0];
+                        }
+
+                        if (subVersion.Length > 1)
+                        {
+                            identified.nanoRevision = subVersion[1];
+                        }
+                    }
+                }
+
+            }
+            else
+            {
+                //fallback version
+                identified.SetVersion("1.0");
+                identified.majorRevision = "1";
+            }
+
+            if (layoutEngine != null)
+            {
+                identified.SetLayoutEngine(layoutEngine);
+                identified.SetLayoutEngineVersion(layoutEngineVersion);
+                if (layoutEngine.Equals(LayoutEngineBrowserBuilder.APPLEWEBKIT))
+                {
+                    confidence += 10;
+                }
+            }
+
+
+            if (userAgent.containsAndroid)
+            {
+                identified.SetReferenceBrowser("Android Browser");
+                Match androidMatcher = versionRegex.Match(userAgent.completeUserAgent);
+                GroupCollection androidGroups = androidMatcher.Groups;
+
+                if (androidMatcher.Success)
+                {
+                    if (androidGroups[1] != null && androidGroups[1].Value.Trim().Length > 0)
+                    {
+                        identified.SetReferenceBrowserVersion(androidGroups[1].Value);
+                        confidence += 5;
+                    }
+                }
+                confidence += 5;
+            }
+            else if (userAgent.completeUserAgent.Contains("Safari") && !userAgent.completeUserAgent.Contains("Mobile"))
+            {
+                identified.SetReferenceBrowser("Safari");
+                Match safariMatcher = versionRegex.Match(userAgent.completeUserAgent);
+                GroupCollection safariGroups = safariMatcher.Groups;
+
+                if (safariMatcher.Success)
+                {
+                    if (safariGroups[1] != null && safariGroups[1].Value.Trim().Length > 0)
+                    {
+                        identified.SetReferenceBrowserVersion(safariGroups[1].Value);
+                        confidence += 5;
+                    }
+                }
+                confidence += 5;
+            }
+
+
+            identified.SetDisplayWidth(hintedWidth);
+            identified.SetDisplayHeight(hintedHeight);
+            identified.confidence = confidence;
+
+            return identified;
+        }
+    }
+}

Added: incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/UPBrowserBuilder.cs
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/UPBrowserBuilder.cs?rev=1392912&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/UPBrowserBuilder.cs (added)
+++ incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/UPBrowserBuilder.cs Tue Oct  2 13:34:31 2012
@@ -0,0 +1,105 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using Oddr.Models;
+using Oddr.Models.Browsers;
+
+namespace Oddr.Builders.Browsers
+{
+    public class UPBrowserBuilder : LayoutEngineBrowserBuilder
+    {
+        private const String VERSION_REGEXP = ".*?(?:(?:UP\\.Browser))[/ ]?(?:WAP)?([0-9\\.abcd]+).*?";
+        private static Regex versionRegex = new Regex(VERSION_REGEXP);
+
+
+        protected override Browser BuildBrowser(UserAgent userAgent, string layoutEngine, string layoutEngineVersion, int hintedWidth, int hintedHeight)
+        {
+            String version = null;
+
+            if (!versionRegex.IsMatch(userAgent.completeUserAgent))
+            {
+                return null;
+
+            }
+            else
+            {
+                Match versionMatcher = versionRegex.Match(userAgent.completeUserAgent);
+                GroupCollection groups = versionMatcher.Groups;
+
+                if (groups[1] != null && groups[1].Value.Trim().Length > 0)
+                {
+                    version = groups[1].Value;
+                }
+            }
+
+            int confidence = 60;
+            Browser identified = new Browser();
+
+            identified.SetVendor("Openwave");
+            identified.SetModel("UP.Browser");
+            identified.SetVersion(version);
+            String[] versionEl = version.Split(".".ToCharArray());
+
+            if (versionEl.Length > 0)
+            {
+                identified.majorRevision = versionEl[0];
+            }
+
+            if (versionEl.Length > 1)
+            {
+                identified.microRevision = versionEl[1];
+                confidence += 10;
+            }
+
+            if (versionEl.Length > 2)
+            {
+                identified.microRevision = versionEl[2];
+            }
+
+            if (versionEl.Length > 3)
+            {
+                identified.nanoRevision = versionEl[3];
+            }
+
+            if (layoutEngine != null)
+            {
+                identified.SetLayoutEngine(layoutEngine);
+                identified.SetLayoutEngineVersion(layoutEngineVersion);
+            }
+
+            identified.SetDisplayWidth(hintedWidth);
+            identified.SetDisplayHeight(hintedHeight);
+            identified.confidence = confidence;
+
+            return identified;
+        }
+
+        public override bool CanBuild(UserAgent userAgent)
+        {
+            return userAgent.completeUserAgent.Contains("UP.Browser");
+        }
+    }
+}

Added: incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/WebOsBrowserBuilder.cs
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/WebOsBrowserBuilder.cs?rev=1392912&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/WebOsBrowserBuilder.cs (added)
+++ incubator/devicemap/trunk/openddr/csharp/OpenDDR-CSharp/Builders/Browsers/WebOsBrowserBuilder.cs Tue Oct  2 13:34:31 2012
@@ -0,0 +1,74 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using Oddr.Models.Browsers;
+using Oddr.Models;
+
+namespace Oddr.Builders.Browsers
+{
+    class WebOsBrowserBuilder : LayoutEngineBrowserBuilder
+    {
+        private const String VERSION_REGEXP = ".*webOSBrowser/([0-9\\.]+).*?";
+        private static Regex versionRegex = new Regex(VERSION_REGEXP);
+
+
+        protected override Browser BuildBrowser(UserAgent userAgent, string layoutEngine, string layoutEngineVersion, int hintedWidth, int hintedHeight)
+        {
+            String version = null;
+
+            if (!versionRegex.IsMatch(userAgent.completeUserAgent))
+            {
+                return null;
+
+            }
+            else
+            {
+                Match versionMatcher = versionRegex.Match(userAgent.completeUserAgent);
+                GroupCollection groups = versionMatcher.Groups;
+
+                if (groups[1] != null && groups[1].Value.Trim().Length > 0)
+                {
+                    version = groups[1].Value;
+                }
+            }
+
+            int confidence = 60;
+            Browser identified = new Browser();
+
+            identified.SetVendor("HP");
+            identified.SetModel("Web OS Browser");
+            identified.SetVersion(version);
+            String[] versionEl = version.Split(".".ToCharArray());
+
+            if (versionEl.Length > 0)
+            {
+                identified.majorRevision = versionEl[0];
+            }
+
+            if (versionEl.Length > 1)
+            {
+                identified.microRevision = versionEl[1];
+                confidence += 10;
+            }
+
+            if (layoutEngine != null)
+            {
+                identified.SetLayoutEngine(layoutEngine);
+                identified.SetLayoutEngineVersion(layoutEngineVersion);
+            }
+
+            identified.SetDisplayWidth(hintedWidth);
+            identified.SetDisplayHeight(hintedHeight);
+            identified.confidence = confidence;
+
+            return identified;
+        }
+
+        public override bool CanBuild(UserAgent userAgent)
+        {
+            return userAgent.completeUserAgent.Contains("webOSBrowser");
+        }
+    }
+}