Beispiel #1
0
        public FileDataSource(IFeatureStore featureStore, List <string> paths, bool autoUpdate, TimeSpan pollInterval,
                              Func <string, object> alternateParser)
        {
            _featureStore = featureStore;
            _paths        = new List <string>(paths);
            _parser       = new FlagFileParser(alternateParser);
            if (autoUpdate)
            {
                try
                {
#if NETSTANDARD1_4 || NETSTANDARD1_6
                    _reloader = new FilePollingReloader(_paths, TriggerReload, pollInterval);
#else
                    _reloader = new FileWatchingReloader(_paths, TriggerReload);
#endif
                }
                catch (Exception e)
                {
                    Log.ErrorFormat("Unable to watch files for auto-updating: {0}", e);
                    _reloader = null;
                }
            }
            else
            {
                _reloader = null;
            }
        }