public FileDataSource(IDataSourceUpdates dataSourceUpdates, FileDataTypes.IFileReader fileReader,
                       List <string> paths, bool autoUpdate, Func <string, object> alternateParser, bool skipMissingPaths,
                       FileDataTypes.DuplicateKeysHandling duplicateKeysHandling,
                       Logger logger)
 {
     _logger            = logger;
     _dataSourceUpdates = dataSourceUpdates;
     _paths             = new List <string>(paths);
     _parser            = new FlagFileParser(alternateParser);
     _dataMerger        = new FlagFileDataMerger(duplicateKeysHandling);
     _fileReader        = fileReader;
     _skipMissingPaths  = skipMissingPaths;
     if (autoUpdate)
     {
         try
         {
             _reloader = new FileWatchingReloader(_paths, TriggerReload);
         }
         catch (Exception e)
         {
             LogHelpers.LogException(_logger, "Unable to watch files for auto-updating", e);
             _reloader = null;
         }
     }
     else
     {
         _reloader = null;
     }
 }
Beispiel #2
0
 /// <summary>
 /// Specifies an alternate file reader which can support custom OS error handling and retry logic.
 /// </summary>
 /// <param name="fileReader">The flag file reader.</param>
 /// <returns>the same factory object</returns>
 public FileDataSourceBuilder FileReader(FileDataTypes.IFileReader fileReader)
 {
     _fileReader = fileReader;
     return(this);
 }