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; }