Example #1
0
        public FileSystemEventProducer(IFileSizeEstimator fileSizeEstimator, string path,
                                       int internalBufferSize = 32768)
        {
            _fileSizeEstimator = fileSizeEstimator ?? throw new ArgumentNullException(nameof(fileSizeEstimator));
            _path   = path ?? throw new ArgumentNullException(nameof(path));
            _rootId = new FileSystemEntryId(path);

            _fileSystemWatcher = new FileSystemWatcher(path)
            {
                IncludeSubdirectories = true,
                NotifyFilter          = NotifyFilters.DirectoryName | NotifyFilters.FileName | NotifyFilters.Size,
                SynchronizingObject   = new SynchronizingObject(_fswEventBuffer),
                InternalBufferSize    = internalBufferSize
            };

            _fileSystemWatcher.Created += OnCreated;
            _fileSystemWatcher.Changed += OnChanged;
            _fileSystemWatcher.Renamed += OnRenamed;
            _fileSystemWatcher.Deleted += OnDeleted;
            _fileSystemWatcher.Error   += OnError;
        }
Example #2
0
 public FileSystemIndexer(IFileSizeEstimator fileSizeEstimator)
 {
     _fileSizeEstimator = fileSizeEstimator;
 }