public DFileSystemWatcher(
            ILogger <DFileSystemWatcher> logger
            , FileInputFilterOptions options
            )
        {
            _logger  = logger;
            _options = options;

            InitWatcher();
        }
예제 #2
0
        public FileAnalyser(
            ILogger <FileAnalyser> logger
            , FileInputFilterOptions options
            )
        {
            _logger  = logger;
            _options = options;

            mre_pauseToStart = new ManualResetEvent(true);
            mre_addFile      = new ManualResetEvent(false);

            _isPause = false;
            _queue   = new Queue <IDFile>();

            AnyThresd();
        }
예제 #3
0
        public override bool Init(ICollectFilterOptions options)
        {
            _options = options.ConvertTo <FileInputFilterOptions>();

            _watcher  = new DFileSystemWatcher(_loggerFactory.CreateLogger <DFileSystemWatcher>(), _options);
            _analyser = new FileAnalyser(_loggerFactory.CreateLogger <FileAnalyser>(), _options);

            _watcher.SetFileChangeAction((file) =>
            {
                _analyser.Analyse(file);
            });

            _analyser.SetDealContextAction((collectContext) =>
            {
                if (!OutputContext(collectContext))
                {
                    this.Pause();
                }
            });

            return(true);
        }