protected virtual BrowscapXmlHelper GetBrowscapXmlHelper()
        {
            if (Singleton <BrowscapXmlHelper> .Instance != null)
            {
                return(Singleton <BrowscapXmlHelper> .Instance);
            }

            //no database created
            if (String.IsNullOrEmpty(_config.UserAgentStringsPath))
            {
                return(null);
            }

            //prevent multi loading data
            lock (_locker)
            {
                //data can be loaded while we waited
                if (Singleton <BrowscapXmlHelper> .Instance != null)
                {
                    return(Singleton <BrowscapXmlHelper> .Instance);
                }

                var filePath          = CommonHelper.MapPath(_config.UserAgentStringsPath);
                var browscapXmlHelper = new BrowscapXmlHelper(filePath);
                Singleton <BrowscapXmlHelper> .Instance = browscapXmlHelper;

                return(Singleton <BrowscapXmlHelper> .Instance);
            }
        }
Esempio n. 2
0
        protected virtual BrowscapXmlHelper GetBrowscapXmlHelper()
        {
            if (Singleton <BrowscapXmlHelper> .Instance != null)
            {
                return(Singleton <BrowscapXmlHelper> .Instance);
            }

            //no database created
            if (String.IsNullOrEmpty(_config.UserAgentStringsPath))
            {
                return(null);
            }

            var filePath         = CommonHelper.MapPath(_config.UserAgentStringsPath);
            var bowscapXmlHelper = new BrowscapXmlHelper(filePath);

            Singleton <BrowscapXmlHelper> .Instance = bowscapXmlHelper;
            return(Singleton <BrowscapXmlHelper> .Instance);
        }