public bool DetectCapabilities(HttpRequest httpRequest) { _manager = WurflLoader.GetManager(); _device = _manager.GetDeviceForRequest(httpRequest); if (_device != null) { _capabilityDictionary = new Dictionary <string, string>(_device.GetCapabilities()); _httpRequest = httpRequest; _loaded = true; return(true); } else { return(false); } }
/// <summary> /// One-time setup for the wrapper. /// </summary> static WURFL_Wrapper() { // Load configuration data. If a config section exists, set the location of the WURFL // data and patch files. // // WurflLoader is a static class with the sole exception of the // SetDataPath method. Because it was created externally, we don't // want to refactor it, but because we only reference it via WURFL_Wrapper, // we can safely initialize it in a static constructor and override the // default data and patch file locations. CapabilitiesDetectionSection config = (CapabilitiesDetectionSection)ConfigurationManager.GetSection("nci/web/capabilities"); if (config != null) { WurflLoader loader = new WurflLoader(); loader.SetDataPath(config.DeviceData.dataFile, config.DeviceData.patchFile); } }