public GeoIpService(ISettingsProvider settingsProvider)
        {
            _geoIpSettings = settingsProvider.GetSettings <GeoIpPluginSettings>("GeoIpPluginConfiguration");

            if (System.IO.File.Exists(_geoIpSettings.Webnet77CSVData))
            {
                LoadWebNet77Data loadWebNet77DataThread = new LoadWebNet77Data(_geoIpSettings.Webnet77CSVData, _tempIpCity);
                loadWebNet77DataThread.ThreadFinishing += LoadWebNet77DataThread_ThreadFinishing;
                ThreadManager.ThreadStart(loadWebNet77DataThread, "Load GeoIp Data", System.Threading.ThreadPriority.Highest);
            }

            // create the cache
            _geoIpCache = new CacheManager("GeoIp Data Cache", new TimeSpan(365, 0, 0, 0), true, false);
        }
Пример #2
0
        public GeoIpService(ISettingsProvider settingsProvider, ILogger logger)
        {
            _geoIpSettings = settingsProvider.GetSettings <GeoIpPluginSettings>("GeoIpPluginConfiguration");

            if (_geoIpSettings.AutoDownloadWebnet77Data ||
                File.Exists(Path.Combine(_geoIpSettings.Webnet77CSVDataPath, Constants.Webnet77CsvDataFileName)))
            {
                LoadWebNet77Data loadWebNet77DataThread = new LoadWebNet77Data(logger,
                                                                               _geoIpSettings.Webnet77CSVDataPath,
                                                                               _tempIpCity,
                                                                               _geoIpSettings.AutoDownloadWebnet77Data,
                                                                               _geoIpSettings.Webnet77CsvUrl,
                                                                               _geoIpSettings.DownloadFrequency);
                loadWebNet77DataThread.ThreadFinishing += LoadWebNet77DataThread_ThreadFinishing;
                ThreadManager.ThreadStart(loadWebNet77DataThread, "Load GeoIp Data", System.Threading.ThreadPriority.Highest);
            }

            // create the cache
            _geoIpCache = new CacheManager("GeoIp Data Cache", new TimeSpan(365, 0, 0, 0), true, false);
        }