Exemple #1
0
        public FileSystemOverseer(IFileSystemPoller poller, IFileSystemWatcher watcher) : base(watcher)
        {
            _reportedItems     = new HashSet <string>();
            _reportedFilesLock = new object();

            InitPollerErrorPolicies();

            // Initiating poller
            _poller = poller;
            if (_poller.Path != watcher.Path)
            {
                _poller.Path = watcher.Path;
            }

            EnableRaisingEvents = false;

            _poller.Created += OnCreatedPolled;
            _poller.Deleted += OnDeletedPolled;
            _poller.Error   += OnPollerError;

            // Getting initial directory content by forcing a poll
            _poller.PollingType = PollingType.Poll;
            _poller.ForcePoll();

            // For the rest of the Overseer's lifespan, keep the poller as a 'watcher'
            _poller.PollingType = PollingType.Watch;
        }
Exemple #2
0
 public FileSystemOverseer(IFileSystemPoller poller) : this(poller, new FileSystemWatcherAdapter(poller.Path, poller.Filter))
 {
 }
Exemple #3
0
 public FileSystemOverseer(IFileSystemPoller poller, FileSystemWatcher watcher) : this(poller, new FileSystemWatcherAdapter(watcher))
 {
 }
 public FileSystemOverseer(IFileSystemPoller poller) : this(poller, new FileSystemWatcherAdapter(poller.Path, poller.Filter))
 {
 }
 public FileSystemOverseer(IFileSystemPoller poller, FileSystemWatcher watcher) : this(poller, new FileSystemWatcherAdapter(watcher))
 {
 }
        public FileSystemOverseer(IFileSystemPoller poller, IFileSystemWatcher watcher) : base(watcher)
        {
            _reportedItems = new HashSet<string>();
            _reportedFilesLock = new object();

            InitPollerErrorPolicies();
            
            // Initiating poller
            _poller = poller;
            if(_poller.Path != watcher.Path)
            {
                _poller.Path = watcher.Path;
            }

            EnableRaisingEvents = false;

            _poller.Created += OnCreatedPolled;
            _poller.Deleted += OnDeletedPolled;
            _poller.Error += OnPollerError;

            // Getting initial directory content by forcing a poll
            _poller.PollingType = PollingType.Poll;
            _poller.ForcePoll();

            // For the rest of the Overseer's lifespan, keep the poller as a 'watcher'
            _poller.PollingType = PollingType.Watch;
        }