Esempio n. 1
0
        protected virtual void WatchFileChanges(PhysicalFileProvider fileProvider, string pattern)
        {
            var changeToken = fileProvider.Watch(pattern);

            var handleWatcherObjects = new HandleWatcherObjects
            {
                _fileProvider = fileProvider,
                _pattern      = pattern
            };

            changeToken.RegisterChangeCallback(ProcessFileState, handleWatcherObjects);
        }
Esempio n. 2
0
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            _workDirectory = Path.Combine(Directory.GetCurrentDirectory(), _autoDebitFolder, _bankFolder);
            var directoryPath = Path.Combine(_workDirectory, _retornoFolder, _processedFilesFolder);

            Directory.CreateDirectory(directoryPath);

            try
            {
                var fileProvider = new PhysicalFileProvider(Path.Combine(directoryPath, ".."));

                var handleWatcherObjects = new HandleWatcherObjects
                {
                    _fileProvider = fileProvider,
                    _pattern      = "*.*"
                };

                ProcessFileState(handleWatcherObjects);
                await Task.CompletedTask;
            }
            catch (Exception)
            {
            }
        }