Esempio n. 1
0
        static DeviceDetector()
        {
            Log.Info("Start: Initializing the WURFL Manager");
            try
            {
                var wurflDataFilePath =
                    HttpContext.Current.Server.MapPath(String.Format("~/{0}", WebConfig.Get <string>("WURFL:DatabaseFilePath")).Replace("//", "/"));
                var configurer = new WURFL.Config.InMemoryConfigurer().MainFile(wurflDataFilePath);

                var patches = WebConfig.Get <string>("WURFL:PatchFilePaths").Split(new[] { '|', ';', ':' }, StringSplitOptions.RemoveEmptyEntries);

                if (patches.Length > 0)
                {
                    foreach (var patch in patches)
                    {
                        var wurflPatchFilePath = HttpContext.Current.Server.MapPath(String.Format("~/{0}", patch).Replace("//", "/"));
                        configurer.PatchFile(wurflPatchFilePath);
                    }
                }

                WurflManager = WURFLManagerBuilder.Build(configurer);
                Log.Info("Stop: Initializing the WURFL Manager");
            }
            catch (Exception ex)
            {
                Log.Error("DeviceDetector() ctor:", ex);
                throw;
            }
        }
        protected void Application_Start(object sender, EventArgs e)
        {
            var wurflDataFile = HttpContext.Current.Server.MapPath(WurflDataFilePath);


            var configurer = new WURFL.Config.InMemoryConfigurer()
                             .MainFile(wurflDataFile);

            AnaysisStart.wurflContainer = WURFLManagerBuilder.Build(configurer);
        }