private bool IeProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(browserCaps[string.Empty])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "MSIE (?\'version\'(?\'major\'\\d+)(\\.(?\'minor\'\\d+)?)(?\'letters\'\\w*))(?\'extra\'[^)]*)"); if ((result == false)) { return false; } headerValue = ((string)(browserCaps[string.Empty])); result = regexWorker.ProcessRegex(headerValue, "IEMobile"); if ((result == true)) { return false; } // Capture: header values regexWorker.ProcessRegex(((string)(browserCaps[string.Empty])), "Trident/(?\'layoutVersion\'\\d+)"); // Capabilities: set capabilities dictionary["browser"] = "IE"; dictionary["layoutEngine"] = "Trident"; dictionary["layoutEngineVersion"] = regexWorker["${layoutVersion}"]; dictionary["extra"] = regexWorker["${extra}"]; dictionary["isColor"] = "true"; dictionary["letters"] = regexWorker["${letters}"]; dictionary["majorversion"] = regexWorker["${major}"]; dictionary["minorversion"] = regexWorker["${minor}"]; dictionary["screenBitDepth"] = "8"; dictionary["type"] = regexWorker["IE${major}"]; dictionary["version"] = regexWorker["${version}"]; browserCaps.AddBrowser("IE"); this.IeProcessGateways(headers, browserCaps); // gateway, parent=IE this.IebetaProcess(headers, browserCaps); bool ignoreApplicationBrowsers = true; // browser, parent=IE if (this.Ie6plusProcess(headers, browserCaps)) { } else { ignoreApplicationBrowsers = false; } this.IeProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool ChromeProcess(NameValueCollection headers, HttpBrowserCapabilities browserCaps) { IDictionary capabilities = browserCaps.Capabilities; string target = browserCaps[string.Empty]; RegexWorker worker = new RegexWorker(browserCaps); if (!worker.ProcessRegex(target, @"Chrome/(?'version'(?'major'\d+)(\.(?'minor'\d+)?)\w*)")) { return false; } worker.ProcessRegex(browserCaps[string.Empty], @"AppleWebKit/(?'layoutVersion'\d+)"); capabilities["layoutEngine"] = "WebKit"; capabilities["layoutEngineVersion"] = worker["${layoutVersion}"]; capabilities["browser"] = "Chrome"; capabilities["majorversion"] = worker["${major}"]; capabilities["minorversion"] = worker["${minor}"]; capabilities["type"] = worker["Chrome${major}"]; capabilities["version"] = worker["${version}"]; capabilities["ecmascriptversion"] = "3.0"; capabilities["javascript"] = "true"; capabilities["javascriptversion"] = "1.7"; capabilities["w3cdomversion"] = "1.0"; capabilities["supportsAccesskeyAttribute"] = "true"; capabilities["tagwriter"] = "System.Web.UI.HtmlTextWriter"; capabilities["cookies"] = "true"; capabilities["frames"] = "true"; capabilities["javaapplets"] = "true"; capabilities["supportsCallback"] = "true"; capabilities["supportsDivNoWrap"] = "false"; capabilities["supportsFileUpload"] = "true"; capabilities["supportsMaintainScrollPositionOnPostback"] = "true"; capabilities["supportsMultilineTextBoxDisplay"] = "true"; capabilities["supportsXmlHttp"] = "true"; capabilities["tables"] = "true"; browserCaps.AddBrowser("Chrome"); this.ChromeProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = false; this.ChromeProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool BlackberryProcess(NameValueCollection headers, HttpBrowserCapabilities browserCaps) { IDictionary capabilities = browserCaps.Capabilities; string target = browserCaps[string.Empty]; RegexWorker worker = new RegexWorker(browserCaps); if (!worker.ProcessRegex(target, @"BlackBerry(?'deviceName'\w+)/(?'version'(?'major'\d+)(\.(?'minor'\d+)?)\w*)")) { return false; } capabilities["layoutEngine"] = "BlackBerry"; capabilities["browser"] = "BlackBerry"; capabilities["majorversion"] = worker["${major}"]; capabilities["minorversion"] = worker["${minor}"]; capabilities["type"] = worker["BlackBerry${major}"]; capabilities["mobileDeviceModel"] = worker["${deviceName}"]; capabilities["isMobileDevice"] = "true"; capabilities["version"] = worker["${version}"]; capabilities["ecmascriptversion"] = "3.0"; capabilities["javascript"] = "true"; capabilities["javascriptversion"] = "1.3"; capabilities["w3cdomversion"] = "1.0"; capabilities["supportsAccesskeyAttribute"] = "true"; capabilities["tagwriter"] = "System.Web.UI.HtmlTextWriter"; capabilities["cookies"] = "true"; capabilities["frames"] = "true"; capabilities["javaapplets"] = "true"; capabilities["supportsCallback"] = "true"; capabilities["supportsDivNoWrap"] = "false"; capabilities["supportsFileUpload"] = "true"; capabilities["supportsMultilineTextBoxDisplay"] = "true"; capabilities["supportsXmlHttp"] = "true"; capabilities["tables"] = "true"; capabilities["canInitiateVoiceCall"] = "true"; browserCaps.AddBrowser("BlackBerry"); this.BlackberryProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = false; this.BlackberryProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool Firefox35Process(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check capability matches string headerValue; headerValue = ((string)(dictionary["minorversion"])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "^[5-9]"); if ((result == false)) { return false; } // Capabilities: set capabilities browserCaps.AddBrowser("Firefox35"); this.Firefox35ProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = false; this.Firefox35ProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool Ie6plusProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check capability matches string headerValue; headerValue = ((string)(dictionary["majorversion"])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "^[6-9]|\\d{2,}$"); if ((result == false)) { return false; } // Capabilities: set capabilities dictionary["jscriptversion"] = "5.6"; dictionary["msdomversion"] = regexWorker["${majorversion}.${minorversion}"]; dictionary["ExchangeOmaSupported"] = "true"; dictionary["activexcontrols"] = "true"; dictionary["backgroundsounds"] = "true"; dictionary["javaapplets"] = "true"; dictionary["supportsVCard"] = "true"; dictionary["supportsAccessKeyAttribute"] = "true"; dictionary["vbscript"] = "true"; browserCaps.AddBrowser("IE6Plus"); this.Ie6plusProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = true; // browser, parent=IE6Plus if (this.Ie6to9Process(headers, browserCaps)) { } else { if (this.Ie10plusProcess(headers, browserCaps)) { } else { ignoreApplicationBrowsers = false; } } this.Ie6plusProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool ChromeProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(browserCaps[string.Empty])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "Chrome/(?\'version\'(?\'major\'\\d+)(\\.(?\'minor\'\\d+)?)\\w*)"); if ((result == false)) { return false; } // Capabilities: set capabilities dictionary["browser"] = "Chrome"; dictionary["majorversion"] = regexWorker["${major}"]; dictionary["minorversion"] = regexWorker["${minor}"]; dictionary["type"] = regexWorker["Chrome${major}"]; dictionary["version"] = regexWorker["${version}"]; dictionary["ecmascriptversion"] = "3.0"; dictionary["javascript"] = "true"; dictionary["javascriptversion"] = "1.7"; dictionary["w3cdomversion"] = "1.0"; dictionary["supportsAccesskeyAttribute"] = "true"; dictionary["tagwriter"] = "System.Web.UI.HtmlTextWriter"; dictionary["cookies"] = "true"; dictionary["frames"] = "true"; dictionary["javaapplets"] = "true"; dictionary["supportsCallback"] = "true"; dictionary["supportsDivNoWrap"] = "false"; dictionary["supportsFileUpload"] = "true"; dictionary["supportsMaintainScrollPositionOnPostback"] = "true"; dictionary["supportsMultilineTextBoxDisplay"] = "true"; dictionary["supportsXmlHttp"] = "true"; dictionary["tables"] = "true"; browserCaps.AddBrowser("Chrome"); this.ChromeProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = false; this.ChromeProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool Opera8plusProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check capability matches string headerValue; headerValue = ((string)(dictionary["majorversion"])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "^[8-9]|\\d{2,}$"); if ((result == false)) { return false; } // Capabilities: set capabilities dictionary["supportsMaintainScrollPositionOnPostback"] = "true"; browserCaps.AddBrowser("Opera8Plus"); this.Opera8plusProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = true; // browser, parent=Opera8Plus if (this.Opera8to9Process(headers, browserCaps)) { } else { if (this.Opera10Process(headers, browserCaps)) { } else { ignoreApplicationBrowsers = false; } } this.Opera8plusProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool IebetaProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check capability matches string headerValue; headerValue = ((string)(dictionary["letters"])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "^([bB]|ab)"); if ((result == false)) { return false; } // Capabilities: set capabilities dictionary["beta"] = "true"; this.IebetaProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = false; this.IebetaProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool WindowsphoneProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(browserCaps[string.Empty])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "Windows Phone OS"); if ((result == false)) { return false; } // Capabilities: set capabilities dictionary["javaapplets"] = "false"; dictionary["jscriptversion"] = "5.7"; browserCaps.AddBrowser("WindowsPhone"); this.WindowsphoneProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = false; this.WindowsphoneProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool IemobileProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(browserCaps[string.Empty])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "IEMobile.(?\'version\'(?\'major\'\\d+)(\\.(?\'minor\'\\d+)?)\\w*)"); if ((result == false)) { return false; } // Capture: header values regexWorker.ProcessRegex(((string)(browserCaps[string.Empty])), "MSIE (?\'msieMajorVersion\'\\d+)"); // Capabilities: set capabilities dictionary["layoutEngine"] = "Trident"; dictionary["browser"] = "IEMobile"; dictionary["majorversion"] = regexWorker["${major}"]; dictionary["minorversion"] = regexWorker["${minor}"]; dictionary["type"] = regexWorker["IEMobile${msieMajorVersion}"]; dictionary["isMobileDevice"] = "true"; dictionary["version"] = regexWorker["${version}"]; dictionary["jscriptversion"] = "5.6"; dictionary["msdomversion"] = regexWorker["${majorversion}.${minorversion}"]; dictionary["supportsAccesskeyAttribute"] = "true"; dictionary["javaapplets"] = "true"; dictionary["supportsDivNoWrap"] = "false"; dictionary["vbscript"] = "true"; dictionary["inputType"] = "virtualKeyboard"; dictionary["numberOfSoftkeys"] = "2"; browserCaps.AddBrowser("IEMobile"); this.IemobileProcessGateways(headers, browserCaps); // gateway, parent=IEMobile this.MonoProcess(headers, browserCaps); // gateway, parent=IEMobile this.PixelsProcess(headers, browserCaps); // gateway, parent=IEMobile this.OsProcess(headers, browserCaps); // gateway, parent=IEMobile this.CpuProcess(headers, browserCaps); // gateway, parent=IEMobile this.VoiceProcess(headers, browserCaps); bool ignoreApplicationBrowsers = true; // browser, parent=IEMobile if (this.WindowsphoneProcess(headers, browserCaps)) { } else { ignoreApplicationBrowsers = false; } this.IemobileProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool WebkitmobileProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(browserCaps[string.Empty])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "Mobile( Safari)?/(?\'iOSVersion\'[^ ]+)"); if ((result == false)) { return false; } // Capture: header values regexWorker.ProcessRegex(((string)(browserCaps[string.Empty])), "Mozilla/5.0 \\((?\'deviceName\'[^;]+)"); // Capabilities: set capabilities dictionary["mobileDeviceModel"] = regexWorker["${deviceName}"]; dictionary["isMobileDevice"] = "true"; dictionary["ecmascriptversion"] = "3.0"; dictionary["javascript"] = "true"; dictionary["javascriptversion"] = "1.6"; dictionary["w3cdomversion"] = "1.0"; dictionary["supportsAccesskeyAttribute"] = "true"; dictionary["tagwriter"] = "System.Web.UI.HtmlTextWriter"; dictionary["cookies"] = "true"; dictionary["frames"] = "true"; dictionary["supportsCallback"] = "true"; dictionary["supportsDivNoWrap"] = "false"; dictionary["supportsFileUpload"] = "true"; dictionary["supportsMaintainScrollPositionOnPostback"] = "true"; dictionary["supportsMultilineTextBoxDisplay"] = "true"; dictionary["supportsXmlHttp"] = "true"; dictionary["tables"] = "true"; this.WebkitmobileProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = false; this.WebkitmobileProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool WebkitProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(browserCaps[string.Empty])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "AppleWebKit"); if ((result == false)) { return false; } // Capture: header values regexWorker.ProcessRegex(((string)(browserCaps[string.Empty])), "AppleWebKit/(?\'layoutVersion\'\\d+)"); // Capabilities: set capabilities dictionary["layoutEngine"] = "WebKit"; dictionary["layoutEngineVersion"] = regexWorker["${layoutVersion}"]; browserCaps.AddBrowser("WebKit"); this.WebkitProcessGateways(headers, browserCaps); // gateway, parent=WebKit this.WebkitmobileProcess(headers, browserCaps); bool ignoreApplicationBrowsers = true; // browser, parent=WebKit if (this.ChromeProcess(headers, browserCaps)) { } else { if (this.SafariProcess(headers, browserCaps)) { } else { ignoreApplicationBrowsers = false; } } this.WebkitProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool MozillaProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(browserCaps[string.Empty])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "Mozilla"); if ((result == false)) { return false; } // Capabilities: set capabilities dictionary["browser"] = "Mozilla"; dictionary["cookies"] = "true"; dictionary["ecmascriptversion"] = "3.0"; dictionary["frames"] = "true"; dictionary["inputType"] = "keyboard"; dictionary["isColor"] = "true"; dictionary["isMobileDevice"] = "false"; dictionary["javascript"] = "true"; dictionary["javascriptversion"] = "1.5"; dictionary["maximumRenderedPageSize"] = "300000"; dictionary["screenBitDepth"] = "8"; dictionary["supportsBold"] = "true"; dictionary["supportsCallback"] = "true"; dictionary["supportsCss"] = "true"; dictionary["supportsDivNoWrap"] = "true"; dictionary["supportsFileUpload"] = "true"; dictionary["supportsFontName"] = "true"; dictionary["supportsFontSize"] = "true"; dictionary["supportsImageSubmit"] = "true"; dictionary["supportsItalic"] = "true"; dictionary["supportsMaintainScrollPositionOnPostback"] = "true"; dictionary["supportsMultilineTextBoxDisplay"] = "true"; dictionary["supportsXmlHttp"] = "true"; dictionary["tables"] = "true"; dictionary["tagwriter"] = "System.Web.UI.HtmlTextWriter"; dictionary["type"] = "Mozilla"; dictionary["w3cdomversion"] = "1.0"; browserCaps.AddBrowser("Mozilla"); this.MozillaProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = true; // browser, parent=Mozilla if (this.IeProcess(headers, browserCaps)) { } else { if (this.InternetexplorerProcess(headers, browserCaps)) { } else { if (this.FirefoxProcess(headers, browserCaps)) { } else { if (this.WebkitProcess(headers, browserCaps)) { } else { if (this.IemobileProcess(headers, browserCaps)) { } else { ignoreApplicationBrowsers = false; } } } } } this.MozillaProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool GenericdownlevelProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(browserCaps[string.Empty])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "^Generic Downlevel$"); if ((result == false)) { return false; } // Capabilities: set capabilities dictionary["cookies"] = "false"; dictionary["ecmascriptversion"] = "1.0"; dictionary["tables"] = "true"; dictionary["type"] = "Downlevel"; browserCaps.Adapters["System.Web.UI.WebControls.Menu, System.Web, Version=4.0.0.0, Culture=neutral, Pub" + "licKeyToken=b03f5f7f11d50a3a"] = "System.Web.UI.WebControls.Adapters.MenuAdapter"; browserCaps.AddBrowser("GenericDownlevel"); this.GenericdownlevelProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = false; this.GenericdownlevelProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool PlatformmacppcProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(browserCaps[string.Empty])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "Mac(_PowerPC|intosh.*PPC|_PPC)|PPC Mac"); if ((result == false)) { return false; } // Capabilities: set capabilities dictionary["platform"] = "MacPPC"; this.PlatformmacppcProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = false; this.PlatformmacppcProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool UcbrowserProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(browserCaps[string.Empty])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "(UC Browser |UCWEB)(?\'version\'(?\'major\'\\d+)(\\.(?\'minor\'[\\d\\.]+)?)\\w*)"); if ((result == false)) { return false; } // Capabilities: set capabilities dictionary["browser"] = "UCBrowser"; dictionary["majorversion"] = regexWorker["${major}"]; dictionary["minorversion"] = regexWorker["${minor}"]; dictionary["isMobileDevice"] = "true"; dictionary["version"] = regexWorker["${version}"]; dictionary["ecmascriptversion"] = "3.0"; dictionary["javascript"] = "true"; dictionary["javascriptversion"] = "1.5"; dictionary["tagwriter"] = "System.Web.UI.HtmlTextWriter"; dictionary["cookies"] = "true"; dictionary["frames"] = "true"; dictionary["supportsCallback"] = "true"; dictionary["supportsFileUpload"] = "true"; dictionary["supportsMultilineTextBoxDisplay"] = "true"; dictionary["supportsXmlHttp"] = "true"; dictionary["tables"] = "true"; browserCaps.AddBrowser("UCBrowser"); this.UcbrowserProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = false; this.UcbrowserProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool DefaultXhtmlmpProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(headers["Accept"])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "application/xhtml\\+xml; profile|application/vnd\\.wap\\.xhtml\\+xml"); if ((result == false)) { return false; } headerValue = ((string)(headers["Accept"])); result = regexWorker.ProcessRegex(headerValue, "text/hdml"); if ((result == true)) { return false; } headerValue = ((string)(headers["Accept"])); result = regexWorker.ProcessRegex(headerValue, "text/vnd\\.wap\\.wml"); if ((result == true)) { return false; } browserCaps.DisableOptimizedCacheKey(); // Capabilities: set capabilities dictionary["preferredRenderingMime"] = "text/html"; dictionary["preferredRenderingType"] = "xhtml-mp"; browserCaps.HtmlTextWriter = "System.Web.UI.XhtmlTextWriter"; bool ignoreApplicationBrowsers = false; this.DefaultXhtmlmpProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool MonoProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(headers["UA-COLOR"])); if (string.IsNullOrEmpty(headerValue)) { return false; } headerValue = ((string)(headers["UA-COLOR"])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "mono(?\'colorDepth\'\\d+)"); if ((result == false)) { return false; } browserCaps.DisableOptimizedCacheKey(); // Capabilities: set capabilities dictionary["isColor"] = "false"; dictionary["screenBitDepth"] = regexWorker["${colorDepth}"]; this.MonoProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = false; this.MonoProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool InternetexplorerProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(browserCaps[string.Empty])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "Trident/(?\'layoutVersion\'[7-9]|0*[1-9]\\d+)(\\.\\d+)?;(.*;)?\\s*rv:(?\'version\'(?\'major\'\\d+)(\\.(?\'minor\'\\d+)))"); if ((result == false)) { return false; } headerValue = ((string)(browserCaps[string.Empty])); result = regexWorker.ProcessRegex(headerValue, "IEMobile"); if ((result == true)) { return false; } result = regexWorker.ProcessRegex(headerValue, "MSIE "); if ((result == true)) { return false; } // Capabilities: set capabilities dictionary["browser"] = "InternetExplorer"; dictionary["version"] = regexWorker["${version}"]; dictionary["majorversion"] = regexWorker["${major}"]; dictionary["minorversion"] = regexWorker["${minor}"]; dictionary["layoutEngine"] = "Trident"; dictionary["layoutEngineVersion"] = regexWorker["${layoutVersion}"]; dictionary["type"] = regexWorker["InternetExplorer${major}"]; browserCaps.AddBrowser("InternetExplorer"); this.InternetexplorerProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = false; this.InternetexplorerProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool PixelsProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(headers["UA-PIXELS"])); if (string.IsNullOrEmpty(headerValue)) { return false; } headerValue = ((string)(headers["UA-PIXELS"])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "(?\'screenWidth\'\\d+)x(?\'screenHeight\'\\d+)"); if ((result == false)) { return false; } browserCaps.DisableOptimizedCacheKey(); // Capabilities: set capabilities dictionary["screenPixelsHeight"] = regexWorker["${screenHeight}"]; dictionary["screenPixelsWidth"] = regexWorker["${screenWidth}"]; this.PixelsProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = false; this.PixelsProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool OperaProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(browserCaps[string.Empty])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "Opera[ /](?\'version\'(?\'major\'\\d+)(\\.(?\'minor\'\\d+)?)(?\'letters\'\\w*))"); if ((result == false)) { return false; } // Capture: header values regexWorker.ProcessRegex(((string)(browserCaps[string.Empty])), "Presto/(?\'layoutVersion\'\\d+)"); // Capabilities: set capabilities dictionary["browser"] = "Opera"; dictionary["majorversion"] = regexWorker["${major}"]; dictionary["minorversion"] = regexWorker["${minor}"]; dictionary["type"] = regexWorker["Opera${major}"]; dictionary["version"] = regexWorker["${version}"]; dictionary["layoutEngine"] = "Presto"; dictionary["layoutEngineVersion"] = regexWorker["${layoutVersion}"]; dictionary["ecmascriptversion"] = "3.0"; dictionary["javascript"] = "true"; dictionary["javascriptversion"] = "1.5"; dictionary["letters"] = regexWorker["${letters}"]; dictionary["w3cdomversion"] = "1.0"; dictionary["tagwriter"] = "System.Web.UI.HtmlTextWriter"; dictionary["cookies"] = "true"; dictionary["frames"] = "true"; dictionary["javaapplets"] = "true"; dictionary["supportsAccesskeyAttribute"] = "true"; dictionary["supportsCallback"] = "true"; dictionary["supportsFileUpload"] = "true"; dictionary["supportsMultilineTextBoxDisplay"] = "true"; dictionary["supportsXmlHttp"] = "true"; dictionary["tables"] = "true"; dictionary["inputType"] = "keyboard"; dictionary["isColor"] = "true"; dictionary["isMobileDevice"] = "false"; dictionary["maximumRenderedPageSize"] = "300000"; dictionary["screenBitDepth"] = "8"; dictionary["supportsBold"] = "true"; dictionary["supportsCss"] = "true"; dictionary["supportsDivNoWrap"] = "true"; dictionary["supportsFontName"] = "true"; dictionary["supportsFontSize"] = "true"; dictionary["supportsImageSubmit"] = "true"; dictionary["supportsItalic"] = "true"; browserCaps.AddBrowser("Opera"); this.OperaProcessGateways(headers, browserCaps); // gateway, parent=Opera this.OperaminiProcess(headers, browserCaps); // gateway, parent=Opera this.OperamobileProcess(headers, browserCaps); bool ignoreApplicationBrowsers = true; // browser, parent=Opera if (this.Opera8plusProcess(headers, browserCaps)) { } else { ignoreApplicationBrowsers = false; } this.OperaProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool CpuProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(headers["UA-CPU"])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "(?\'cpu\'.+)"); if ((result == false)) { return false; } browserCaps.DisableOptimizedCacheKey(); // Capabilities: set capabilities dictionary["cpu"] = regexWorker["${cpu}"]; this.CpuProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = false; this.CpuProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool Opera10Process(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(browserCaps[string.Empty])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "Opera/10\\.|Version/10\\."); if ((result == false)) { return false; } // Capabilities: set capabilities dictionary["version"] = "10.00"; dictionary["majorversion"] = "10"; dictionary["minorversion"] = "00"; browserCaps.AddBrowser("Opera10"); this.Opera10ProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = false; this.Opera10ProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool VoiceProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(headers["UA-VOICE"])); if (string.IsNullOrEmpty(headerValue)) { return false; } headerValue = ((string)(headers["UA-VOICE"])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "(?i:TRUE)"); if ((result == false)) { return false; } browserCaps.DisableOptimizedCacheKey(); // Capabilities: set capabilities dictionary["canInitiateVoiceCall"] = "true"; this.VoiceProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = false; this.VoiceProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool FirefoxProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(browserCaps[string.Empty])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "Firefox\\/(?\'version\'(?\'major\'\\d+)(\\.(?\'minor\'\\d+)?)\\w*)"); if ((result == false)) { return false; } // Capture: header values regexWorker.ProcessRegex(((string)(browserCaps[string.Empty])), "Gecko/(?\'layoutVersion\'\\d+)"); // Capabilities: set capabilities dictionary["browser"] = "Firefox"; dictionary["majorversion"] = regexWorker["${major}"]; dictionary["minorversion"] = regexWorker["${minor}"]; dictionary["version"] = regexWorker["${version}"]; dictionary["type"] = regexWorker["Firefox${major}"]; dictionary["layoutEngine"] = "Gecko"; dictionary["layoutEngineVersion"] = regexWorker["${layoutVersion}"]; dictionary["supportsAccesskeyAttribute"] = "true"; dictionary["javaapplets"] = "true"; dictionary["supportsDivNoWrap"] = "false"; browserCaps.AddBrowser("Firefox"); this.FirefoxProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = true; // browser, parent=Firefox if (this.Firefox3plusProcess(headers, browserCaps)) { } else { ignoreApplicationBrowsers = false; } this.FirefoxProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool IpadProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(browserCaps[string.Empty])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "iPad"); if ((result == false)) { return false; } // Capabilities: set capabilities dictionary["isMobileDevice"] = "true"; dictionary["mobileDeviceManufacturer"] = "Apple"; dictionary["mobileDeviceModel"] = "IPad"; this.IpadProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = false; this.IpadProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool Firefox3plusProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check capability matches string headerValue; headerValue = ((string)(dictionary["majorversion"])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "[3-9]|\\d{2,}"); if ((result == false)) { return false; } // Capabilities: set capabilities dictionary["javascriptversion"] = "1.8"; browserCaps.AddBrowser("Firefox3Plus"); this.Firefox3plusProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = true; // browser, parent=Firefox3Plus if (this.Firefox3Process(headers, browserCaps)) { } else { ignoreApplicationBrowsers = false; } this.Firefox3plusProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool SafariProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(browserCaps[string.Empty])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "Safari"); if ((result == false)) { return false; } headerValue = ((string)(browserCaps[string.Empty])); result = regexWorker.ProcessRegex(headerValue, "Chrome"); if ((result == true)) { return false; } headerValue = ((string)(browserCaps[string.Empty])); result = regexWorker.ProcessRegex(headerValue, "Android"); if ((result == true)) { return false; } // Capabilities: set capabilities dictionary["browser"] = "Safari"; dictionary["type"] = "Safari"; browserCaps.AddBrowser("Safari"); this.SafariProcessGateways(headers, browserCaps); // gateway, parent=Safari this.IphoneProcess(headers, browserCaps); // gateway, parent=Safari this.IpodProcess(headers, browserCaps); // gateway, parent=Safari this.IpadProcess(headers, browserCaps); bool ignoreApplicationBrowsers = true; // browser, parent=Safari if (this.Safari3plusProcess(headers, browserCaps)) { } else { ignoreApplicationBrowsers = false; } this.SafariProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool CrawlerProcess(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check header matches string headerValue; headerValue = ((string)(browserCaps[string.Empty])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "crawler|Crawler|Googlebot|bingbot"); if ((result == false)) { return false; } // Capabilities: set capabilities dictionary["crawler"] = "true"; this.CrawlerProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = false; this.CrawlerProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }
private bool Safari3to4Process(System.Collections.Specialized.NameValueCollection headers, System.Web.HttpBrowserCapabilities browserCaps) { System.Collections.IDictionary dictionary; dictionary = browserCaps.Capabilities; // Identification: check capability matches string headerValue; headerValue = ((string)(dictionary["majorversion"])); bool result; RegexWorker regexWorker; regexWorker = new RegexWorker(browserCaps); result = regexWorker.ProcessRegex(headerValue, "^[3-4]$"); if ((result == false)) { return false; } // Capabilities: set capabilities browserCaps.AddBrowser("Safari3to4"); this.Safari3to4ProcessGateways(headers, browserCaps); bool ignoreApplicationBrowsers = true; // browser, parent=Safari3to4 if (this.Safari4Process(headers, browserCaps)) { } else { ignoreApplicationBrowsers = false; } this.Safari3to4ProcessBrowsers(ignoreApplicationBrowsers, headers, browserCaps); return true; }