/// <summary> /// Check for data updates (new files) in monitoring directory /// <remarks> /// For now, we track new files by creation time, and don't delete any of them, /// another option might be to delete files once they have been processed</remarks> /// </summary> private void CheckUpdates() { var now = DateTime.UtcNow; // save the 'now' time var files = _fileSystemManager.GetNewFilesFromDirectory(_lastCheckUpdates, MonitoringDirectory); // check directory for new files _lastCheckUpdates = now; // update last checked time // go for parallel file processing: Parallel.ForEach(files, (file) => { // for any new file check if we could load data from it if (_tradeDataLoader.CouldLoad(file)) { var data = _tradeDataLoader.LoadTradeData(file); // load data OnTradeDataUpdate(data); // notify about update } }); }