private void parseUA(string _userAgent) { int client_id = 0; int client_class_id = -1; int os_id = 0; int deviceclass_id = 0; System.Text.RegularExpressions.Regex searchTerm; PerlRegExpConverter regConv; if (!string.IsNullOrEmpty(_userAgent)) { userAgent.UaString = this.ua; userAgent.UaClass = "Unrecognized"; userAgent.UaClassCode = "unrecognized"; if (dt.Connected) { DataTable crawlerList = dt.selectQuery(@"SELECT udger_crawler_list.id as botid,name,ver,ver_major,last_seen,respect_robotstxt,family,family_code,family_homepage,family_icon,vendor,vendor_code,vendor_homepage,crawler_classification,crawler_classification_code FROM udger_crawler_list LEFT JOIN udger_crawler_class ON udger_crawler_class.id = udger_crawler_list.class_id WHERE ua_string = '" + _userAgent + "'"); // crawler if (crawlerList.Rows.Count > 0) { client_class_id = 99; this.prepareCrawler(crawlerList.Rows[0]); } else { //client DataTable clientRegex = dt.selectQuery(@"SELECT class_id,client_id,regstring,name,name_code,homepage,icon,icon_big,engine,vendor,vendor_code,vendor_homepage,uptodate_current_version,client_classification,client_classification_code FROM udger_client_regex JOIN udger_client_list ON udger_client_list.id = udger_client_regex.client_id JOIN udger_client_class ON udger_client_class.id = udger_client_list.class_id ORDER BY sequence ASC"); if (clientRegex != null) { foreach (DataRow row in clientRegex.Rows) { regConv = new PerlRegExpConverter(row["regstring"].ToString(), "", Encoding.UTF8); searchTerm = regConv.Regex; if (searchTerm.IsMatch(_userAgent)) { var match = searchTerm.Match(_userAgent); if (match.Success && match.Groups.Count > 1) { this.prepareClientRegex(row, match, ref client_id, ref client_class_id); break; } else if (match.Success && match.Groups.Count == 1) { this.prepareClientRegex(row, match, ref client_id, ref client_class_id); break; } } } } } // OS DataTable osRegex = dt.selectQuery(@"SELECT os_id,regstring,family,family_code,name,name_code,homepage,icon,icon_big,vendor,vendor_code,vendor_homepage FROM udger_os_regex JOIN udger_os_list ON udger_os_list.id = udger_os_regex.os_id ORDER BY sequence ASC"); if (osRegex != null) { foreach (DataRow row in osRegex.Rows) { regConv = new PerlRegExpConverter(row["regstring"].ToString(), "", Encoding.UTF8); searchTerm = regConv.Regex; if (searchTerm.IsMatch(_userAgent)) { this.prepareOs(row, ref os_id); break; } } } // client_os_relation if (os_id == 0 && client_id != 0) { DataTable clientOSRelations = dt.selectQuery(@"SELECT os_id,family,family_code,name,name_code,homepage,icon,icon_big,vendor,vendor_code,vendor_homepage FROM udger_client_os_relation JOIN udger_os_list ON udger_os_list.id = udger_client_os_relation.os_id WHERE client_id = '" + client_id.ToString() + "'"); if (clientOSRelations != null && clientOSRelations.Rows.Count > 0) { this.prepareOs(clientOSRelations.Rows[0], ref os_id); } } // device DataTable device = dt.selectQuery(@"SELECT deviceclass_id,regstring,name,name_code,icon,icon_big FROM udger_deviceclass_regex JOIN udger_deviceclass_list ON udger_deviceclass_list.id=udger_deviceclass_regex.deviceclass_id ORDER BY sequence ASC"); if (device != null) { foreach (DataRow row in device.Rows) { regConv = new PerlRegExpConverter(row["regstring"].ToString(), "", Encoding.UTF8); searchTerm = regConv.Regex; if (searchTerm.IsMatch(_userAgent)) { this.prepareDevice(row, ref deviceclass_id); break; } } } if (deviceclass_id == 0 && client_class_id != -1) { DataTable deviceList = dt.selectQuery(@"SELECT deviceclass_id,name,name_code,icon,icon_big FROM udger_deviceclass_list JOIN udger_client_class ON udger_client_class.deviceclass_id = udger_deviceclass_list.id WHERE udger_client_class.id = '" + client_class_id.ToString() + "'"); if (deviceList != null && deviceList.Rows.Count > 0) { this.prepareDevice(deviceList.Rows[0], ref deviceclass_id); } } } } }
private void parseUA(string _userAgent) { int client_id = 0; int client_class_id = -1; int os_id = 0; int deviceclass_id = 0; System.Text.RegularExpressions.Regex searchTerm; PerlRegExpConverter regConv; if (!string.IsNullOrEmpty(_userAgent)) { userAgent.UaString = this.ua; userAgent.UaClass = "Unrecognized"; userAgent.UaClassCode = "unrecognized"; if (dt.Connected) { DataTable crawlerList = dt.selectQuery(@"SELECT udger_crawler_list.id as botid,name,ver,ver_major,last_seen,respect_robotstxt,family,family_code,family_homepage,family_icon,vendor,vendor_code,vendor_homepage,crawler_classification,crawler_classification_code FROM udger_crawler_list LEFT JOIN udger_crawler_class ON udger_crawler_class.id = udger_crawler_list.class_id WHERE ua_string = '" + _userAgent + "'"); // crawler if (crawlerList.Rows.Count > 0) { client_class_id = 99; this.prepareCrawler(crawlerList.Rows[0]); } else { //client DataTable clientRegex = dt.selectQuery(@"SELECT class_id,client_id,regstring,name,name_code,homepage,icon,icon_big,engine,vendor,vendor_code,vendor_homepage,uptodate_current_version,client_classification,client_classification_code FROM udger_client_regex JOIN udger_client_list ON udger_client_list.id = udger_client_regex.client_id JOIN udger_client_class ON udger_client_class.id = udger_client_list.class_id ORDER BY sequence ASC"); if (clientRegex != null) foreach (DataRow row in clientRegex.Rows) { regConv = new PerlRegExpConverter(row["regstring"].ToString(), "", Encoding.UTF8); searchTerm = regConv.Regex; if (searchTerm.IsMatch(_userAgent)) { var match = searchTerm.Match(_userAgent); if (match.Success && match.Groups.Count > 1) { this.prepareClientRegex(row, match, ref client_id, ref client_class_id); break; } else if (match.Success && match.Groups.Count == 1) { this.prepareClientRegex(row, match, ref client_id, ref client_class_id); break; } } } } // OS DataTable osRegex = dt.selectQuery(@"SELECT os_id,regstring,family,family_code,name,name_code,homepage,icon,icon_big,vendor,vendor_code,vendor_homepage FROM udger_os_regex JOIN udger_os_list ON udger_os_list.id = udger_os_regex.os_id ORDER BY sequence ASC"); if (osRegex != null) foreach (DataRow row in osRegex.Rows) { regConv = new PerlRegExpConverter(row["regstring"].ToString(), "", Encoding.UTF8); searchTerm = regConv.Regex; if (searchTerm.IsMatch(_userAgent)) { this.prepareOs(row, ref os_id); break; } } // client_os_relation if (os_id == 0 && client_id != 0) { DataTable clientOSRelations = dt.selectQuery(@"SELECT os_id,family,family_code,name,name_code,homepage,icon,icon_big,vendor,vendor_code,vendor_homepage FROM udger_client_os_relation JOIN udger_os_list ON udger_os_list.id = udger_client_os_relation.os_id WHERE client_id = '" + client_id.ToString() + "'"); if (clientOSRelations != null && clientOSRelations.Rows.Count > 0) { this.prepareOs(clientOSRelations.Rows[0], ref os_id); } } // device DataTable device = dt.selectQuery(@"SELECT deviceclass_id,regstring,name,name_code,icon,icon_big FROM udger_deviceclass_regex JOIN udger_deviceclass_list ON udger_deviceclass_list.id=udger_deviceclass_regex.deviceclass_id ORDER BY sequence ASC"); if (device != null) foreach (DataRow row in device.Rows) { regConv = new PerlRegExpConverter(row["regstring"].ToString(), "", Encoding.UTF8); searchTerm = regConv.Regex; if (searchTerm.IsMatch(_userAgent)) { this.prepareDevice(row, ref deviceclass_id); break; } } if (deviceclass_id == 0 && client_class_id != -1) { DataTable deviceList = dt.selectQuery(@"SELECT deviceclass_id,name,name_code,icon,icon_big FROM udger_deviceclass_list JOIN udger_client_class ON udger_client_class.deviceclass_id = udger_deviceclass_list.id WHERE udger_client_class.id = '" + client_class_id.ToString() + "'"); if (deviceList != null && deviceList.Rows.Count > 0) { this.prepareDevice(deviceList.Rows[0], ref deviceclass_id); } } } } }
/// <summary> /// Parse the useragent string /// /// </summary> /// <param name="_useragent">user agent string</param> /// <returns>Dictionary</returns> public Dictionary <string, object> parse(string _useragent) { this.WriteDebug("parse: start"); Dictionary <string, object> ret = new Dictionary <string, object>(); if (String.IsNullOrEmpty(_useragent)) { this.WriteDebug("parse: Missing mandatory parameter"); ret.Add("flag", 1); ret.Add("errortext", "missing mandatory parameter"); return(ret); } dt.connect(this); if (!dt.Connected) { this.WriteDebug("Data file not found, download the data manually"); ret.Add("flag", 3); ret.Add("errortext", "data file not found"); return(ret); } Dictionary <string, object> fragments = new Dictionary <string, object>(); Dictionary <string, object> info = new Dictionary <string, object>(); Dictionary <string, object> uptodate = new Dictionary <string, object>(); string browser_id = ""; string os_id = ""; string device_id = ""; #region set empty buffer info.Add("type", "unknown"); info.Add("ua_name", "unknown"); info.Add("ua_ver", ""); info.Add("ua_family", "unknown"); info.Add("ua_url", "unknown"); info.Add("ua_company", "unknown"); info.Add("ua_company_url", "unknown"); info.Add("ua_icon", "unknown.png"); info.Add("ua_engine", "n/a"); info.Add("ua_udger_url", ""); info.Add("os_name", "unknown"); info.Add("os_family", "unknown"); info.Add("os_url", "unknown"); info.Add("os_company", "unknown"); info.Add("os_company_url", "unknown"); info.Add("os_icon", "unknown.png"); info.Add("os_udger_url", ""); info.Add("device_name", "Personal computer"); info.Add("device_icon", "desktop.png"); info.Add("device_udger_url", "http://udger.com/resources/ua-list/device-detail?device,Personal%20computer"); //set empty uptodate buffer uptodate.Add("controlled", false); uptodate.Add("is", false); uptodate.Add("ver", ""); uptodate.Add("url", ""); #endregion DataTable table2 = dt.selectQuery("SELECT name,family,url,company,url_company,icon FROM c_robots where md5='" + this.CreateMD5(_useragent) + "'"); if (table2.Rows.Count > 0) { DataRow row = table2.Rows[0]; info["type"] = "Robot"; info["ua_name"] = row["name"]; info["ua_family"] = row["family"]; info["ua_url"] = row["url"]; info["ua_company"] = row["company"]; info["ua_company_url"] = row["url_company"]; info["ua_icon"] = row["icon"]; info["ua_udger_url"] = "http://udger.com/resources/ua-list/bot-detail?bot=" + row["family"]; info["device_name"] = "Other"; info["device_icon"] = "other.png"; info["device_udger_url"] = "http://udger.com/resources/ua-list/device-detail?device=Other"; ret.Add("flag", 1); ret.Add("info", info); ret.Add("fragments", fragments); ret.Add("uptodate", uptodate); return(ret); } DataTable table = dt.selectQuery("SELECT browser, regstring FROM reg_browser ORDER by sequence ASC"); System.Text.RegularExpressions.Regex searchTerm; foreach (DataRow dr in table.Rows) { PerlRegExpConverter regConv = new PerlRegExpConverter(dr["regstring"].ToString(), "", Encoding.UTF8); searchTerm = regConv.Regex; if (searchTerm.IsMatch(_useragent)) { string matchRes = ""; browser_id = dr["browser"].ToString(); DataTable c_browser = dt.selectQuery("SELECT type,name,engine,url,company,company_url,icon FROM c_browser WHERE id=" + browser_id + " "); System.Text.RegularExpressions.Match m = searchTerm.Match(_useragent); if (m.Success) { if (m.Groups.Count > 1) { matchRes = m.Groups[1].Value; } } if (c_browser.Rows.Count > 0) { DataRow c_BwrRow = c_browser.Rows[0]; DataTable c_browser_type = dt.selectQuery("SELECT name FROM c_browser_type WHERE type=" + c_BwrRow["type"] + " "); if (c_browser_type.Rows.Count > 0) { DataRow c_BwrRowType = c_browser_type.Rows[0]; info["type"] = c_BwrRowType["name"]; info["ua_name"] = c_BwrRow["name"].ToString() + " " + matchRes; info["ua_ver"] = matchRes; info["ua_family"] = c_BwrRow["name"]; info["ua_url"] = c_BwrRow["url"]; info["ua_company"] = c_BwrRow["company"]; info["ua_company_url"] = c_BwrRow["company_url"]; info["ua_icon"] = c_BwrRow["icon"]; info["ua_engine"] = c_BwrRow["engine"]; info["ua_udger_url"] = "http://udger.com/resources/ua-list/browser-detail?browser=" + c_BwrRow["name"]; break; } } } } if (browser_id != "") { DataTable c_browser_os = dt.selectQuery("SELECT os FROM c_browser_os where browser=" + browser_id + ""); if (c_browser_os.Rows.Count > 0) { DataRow c_brwOsType = c_browser_os.Rows[0]; os_id = c_brwOsType["os"].ToString(); } } if (os_id == "") { DataTable reg_os = dt.selectQuery("SELECT os, regstring FROM reg_os ORDER by sequence ASC"); if (reg_os.Rows.Count > 0) { foreach (DataRow reg_osRow in reg_os.Rows) { PerlRegExpConverter regOsConv = new PerlRegExpConverter(reg_osRow["regstring"].ToString(), "", Encoding.UTF8); searchTerm = regOsConv.Regex; if (searchTerm.IsMatch(_useragent)) { os_id = reg_osRow["os"].ToString(); break; } } } } if (os_id != "") { DataTable c_os = dt.selectQuery("SELECT name, family, url, company, company_url, icon FROM c_os where id=" + os_id + ""); if (c_os.Rows.Count > 0) { DataRow c_osRow = c_os.Rows[0]; info["os_name"] = c_osRow["name"]; info["os_family"] = c_osRow["family"]; info["os_url"] = c_osRow["url"]; info["os_company"] = c_osRow["company"]; info["os_company_url"] = c_osRow["company_url"]; info["os_icon"] = c_osRow["icon"]; info["os_udger_url"] = @"http://udger.com/resources/ua-list/os-detail?os=" + c_osRow["name"]; } } DataTable reg_device = dt.selectQuery("SELECT device, regstring FROM reg_device ORDER by sequence ASC"); if (reg_device.Rows.Count > 0) { foreach (DataRow reg_deviceRow in reg_device.Rows) { PerlRegExpConverter regOsConv = new PerlRegExpConverter(reg_deviceRow["regstring"].ToString(), "", Encoding.UTF8); searchTerm = regOsConv.Regex; if (searchTerm.IsMatch(_useragent)) { device_id = reg_deviceRow["device"].ToString(); break; } } } if (device_id != "") { DataTable c_device = dt.selectQuery("SELECT name,icon FROM c_device WHERE id=" + device_id + " "); if (c_device.Rows.Count > 0) { DataRow c_deviceRow = c_device.Rows[0]; info["device_name"] = c_deviceRow["name"]; info["device_icon"] = c_deviceRow["icon"]; info["device_udger_url"] = "http://udger.com/resources/ua-list/device-detail?device=" + c_deviceRow["name"]; } } else if (info["type"].ToString() == "Mobile Browser") { info["device_name"] = "Smartphone"; info["device_icon"] = "phone.png"; info["device_udger_url"] = "http://udger.com/resources/ua-list/device-detail?device=Smartphone"; } if (browser_id != "") { char delimiterChars = '.'; int testVer; string[] ver_major = info["ua_ver"].ToString().Split(delimiterChars); if (!String.IsNullOrEmpty(ver_major[0])) { if (int.TryParse(ver_major[0], out testVer)) { DataTable c_browser_uptodate = dt.selectQuery("SELECT ver, url FROM c_browser_uptodate WHERE browser_id='" + browser_id + "' AND (os_independent = 1 OR os_family = '" + info["os_family"] + "')"); if (c_browser_uptodate.Rows.Count > 0) { DataRow c_browser_uptodateRow = c_browser_uptodate.Rows[0]; uptodate["controlled"] = true; if (Convert.ToInt32(ver_major[0]) >= Convert.ToInt32(c_browser_uptodateRow["ver"])) { uptodate["is"] = true; } uptodate["ver"] = c_browser_uptodateRow["ver"]; uptodate["url"] = c_browser_uptodateRow["url"]; } } } } //// TODO : Parse Fragmet ret.Add("flag", 1); ret.Add("info", info); ret.Add("fragments", fragments); ret.Add("uptodate", uptodate); return(ret); }
/// <summary> /// Parse the useragent string /// /// </summary> /// <param name="_useragent">user agent string</param> /// <returns>Dictionary</returns> public Dictionary<string, object> parse(string _useragent) { this.WriteDebug("parse: start"); Dictionary<string, object> ret = new Dictionary<string, object>(); if (String.IsNullOrEmpty(_useragent)) { this.WriteDebug("parse: Missing mandatory parameter"); ret.Add("flag", 1); ret.Add("errortext", "missing mandatory parameter"); return ret; } dt.connect(this); if (!dt.Connected) { this.WriteDebug("Data file not found, download the data manually"); ret.Add("flag", 3); ret.Add("errortext", "data file not found"); return ret; } Dictionary<string, object> fragments = new Dictionary<string, object>(); Dictionary<string, object> info = new Dictionary<string, object>(); Dictionary<string, object> uptodate = new Dictionary<string, object>(); string browser_id = ""; string os_id = ""; string device_id = ""; #region set empty buffer info.Add("type", "unknown"); info.Add("ua_name", "unknown"); info.Add("ua_ver", ""); info.Add("ua_family", "unknown"); info.Add("ua_url", "unknown"); info.Add("ua_company", "unknown"); info.Add("ua_company_url", "unknown"); info.Add("ua_icon", "unknown.png"); info.Add("ua_engine", "n/a"); info.Add("ua_udger_url", ""); info.Add("os_name", "unknown"); info.Add("os_family", "unknown"); info.Add("os_url", "unknown"); info.Add("os_company", "unknown"); info.Add("os_company_url", "unknown"); info.Add("os_icon", "unknown.png"); info.Add("os_udger_url", ""); info.Add("device_name", "Personal computer"); info.Add("device_icon", "desktop.png"); info.Add("device_udger_url", "http://udger.com/resources/ua-list/device-detail?device,Personal%20computer"); //set empty uptodate buffer uptodate.Add("controlled", false); uptodate.Add("is", false); uptodate.Add("ver", ""); uptodate.Add("url", ""); #endregion DataTable table2 = dt.selectQuery("SELECT name,family,url,company,url_company,icon FROM c_robots where md5='" + this.CreateMD5(_useragent) + "'"); if (table2.Rows.Count > 0) { DataRow row = table2.Rows[0]; info["type"] = "Robot"; info["ua_name"] = row["name"]; info["ua_family"] = row["family"]; info["ua_url"] = row["url"]; info["ua_company"] = row["company"]; info["ua_company_url"] = row["url_company"]; info["ua_icon"] = row["icon"]; info["ua_udger_url"] = "http://udger.com/resources/ua-list/bot-detail?bot=" + row["family"]; info["device_name"] = "Other"; info["device_icon"] = "other.png"; info["device_udger_url"] = "http://udger.com/resources/ua-list/device-detail?device=Other"; ret.Add("flag", 1); ret.Add("info", info); ret.Add("fragments", fragments); ret.Add("uptodate", uptodate); return ret; } DataTable table = dt.selectQuery("SELECT browser, regstring FROM reg_browser ORDER by sequence ASC"); System.Text.RegularExpressions.Regex searchTerm; foreach (DataRow dr in table.Rows) { PerlRegExpConverter regConv = new PerlRegExpConverter(dr["regstring"].ToString(), "", Encoding.UTF8); searchTerm = regConv.Regex; if (searchTerm.IsMatch(_useragent)) { string matchRes = ""; browser_id = dr["browser"].ToString(); DataTable c_browser = dt.selectQuery("SELECT type,name,engine,url,company,company_url,icon FROM c_browser WHERE id=" + browser_id + " "); System.Text.RegularExpressions.Match m = searchTerm.Match(_useragent); if (m.Success) { if (m.Groups.Count > 1) matchRes = m.Groups[1].Value; } if (c_browser.Rows.Count > 0) { DataRow c_BwrRow = c_browser.Rows[0]; DataTable c_browser_type = dt.selectQuery("SELECT name FROM c_browser_type WHERE type=" + c_BwrRow["type"] + " "); if (c_browser_type.Rows.Count > 0) { DataRow c_BwrRowType = c_browser_type.Rows[0]; info["type"] = c_BwrRowType["name"]; info["ua_name"] = c_BwrRow["name"].ToString() + " " + matchRes; info["ua_ver"] = matchRes; info["ua_family"] = c_BwrRow["name"]; info["ua_url"] = c_BwrRow["url"]; info["ua_company"] = c_BwrRow["company"]; info["ua_company_url"] = c_BwrRow["company_url"]; info["ua_icon"] = c_BwrRow["icon"]; info["ua_engine"] = c_BwrRow["engine"]; info["ua_udger_url"] = "http://udger.com/resources/ua-list/browser-detail?browser=" + c_BwrRow["name"]; break; } } } } if (browser_id != "") { DataTable c_browser_os = dt.selectQuery("SELECT os FROM c_browser_os where browser=" + browser_id + ""); if (c_browser_os.Rows.Count > 0) { DataRow c_brwOsType = c_browser_os.Rows[0]; os_id = c_brwOsType["os"].ToString(); } } if (os_id == "") { DataTable reg_os = dt.selectQuery("SELECT os, regstring FROM reg_os ORDER by sequence ASC"); if (reg_os.Rows.Count > 0) { foreach (DataRow reg_osRow in reg_os.Rows) { PerlRegExpConverter regOsConv = new PerlRegExpConverter(reg_osRow["regstring"].ToString(), "", Encoding.UTF8); searchTerm = regOsConv.Regex; if (searchTerm.IsMatch(_useragent)) { os_id = reg_osRow["os"].ToString(); break; } } } } if (os_id != "") { DataTable c_os = dt.selectQuery("SELECT name, family, url, company, company_url, icon FROM c_os where id=" + os_id + ""); if (c_os.Rows.Count > 0) { DataRow c_osRow = c_os.Rows[0]; info["os_name"] = c_osRow["name"]; info["os_family"] = c_osRow["family"]; info["os_url"] = c_osRow["url"]; info["os_company"] = c_osRow["company"]; info["os_company_url"] = c_osRow["company_url"]; info["os_icon"] = c_osRow["icon"]; info["os_udger_url"] = @"http://udger.com/resources/ua-list/os-detail?os=" + c_osRow["name"]; } } DataTable reg_device = dt.selectQuery("SELECT device, regstring FROM reg_device ORDER by sequence ASC"); if (reg_device.Rows.Count > 0) { foreach (DataRow reg_deviceRow in reg_device.Rows) { PerlRegExpConverter regOsConv = new PerlRegExpConverter(reg_deviceRow["regstring"].ToString(), "", Encoding.UTF8); searchTerm = regOsConv.Regex; if (searchTerm.IsMatch(_useragent)) { device_id = reg_deviceRow["device"].ToString(); break; } } } if (device_id != "") { DataTable c_device = dt.selectQuery("SELECT name,icon FROM c_device WHERE id=" + device_id + " "); if (c_device.Rows.Count > 0) { DataRow c_deviceRow = c_device.Rows[0]; info["device_name"] = c_deviceRow["name"]; info["device_icon"] = c_deviceRow["icon"]; info["device_udger_url"] = "http://udger.com/resources/ua-list/device-detail?device=" + c_deviceRow["name"]; } } else if (info["type"].ToString() == "Mobile Browser") { info["device_name"] = "Smartphone"; info["device_icon"] = "phone.png"; info["device_udger_url"] = "http://udger.com/resources/ua-list/device-detail?device=Smartphone"; } if (browser_id != "") { char delimiterChars = '.'; int testVer; string[] ver_major = info["ua_ver"].ToString().Split(delimiterChars); if(!String.IsNullOrEmpty(ver_major[0])) { if (int.TryParse(ver_major[0], out testVer)) { DataTable c_browser_uptodate = dt.selectQuery("SELECT ver, url FROM c_browser_uptodate WHERE browser_id='" + browser_id + "' AND (os_independent = 1 OR os_family = '" + info["os_family"] + "')"); if (c_browser_uptodate.Rows.Count > 0) { DataRow c_browser_uptodateRow = c_browser_uptodate.Rows[0]; uptodate["controlled"] = true; if (Convert.ToInt32(ver_major[0]) >= Convert.ToInt32(c_browser_uptodateRow["ver"])) { uptodate["is"] = true; } uptodate["ver"] = c_browser_uptodateRow["ver"]; uptodate["url"] = c_browser_uptodateRow["url"]; } } } } //// TODO : Parse Fragmet ret.Add("flag", 1); ret.Add("info", info); ret.Add("fragments", fragments); ret.Add("uptodate", uptodate); return ret; }