Example #1
0
        private void CreatedAndChangedHandler(object sender, FileSystemEventArgs e)
        {
            if (!_filesInTheWork.ContainsKey(e.FullPath))
            {
                while (!_filesInTheWork.TryAdd(e.FullPath, DateTime.Now))
                {
                    ;
                }
                _queue.Enqueue(new FileAction(e.FullPath, FileActionTypesConverter.Convert(e.ChangeType)));
                return;
            }

            DateTime datetime;

            while (!_filesInTheWork.TryGetValue(e.FullPath, out datetime))
            {
                ;
            }
            _filesInTheWork.AddOrUpdate(e.FullPath, DateTime.Now, (path, date) => date);
            if (DateTime.Now.Subtract(datetime).Seconds < 2)
            {
                return;
            }

            _queue.Enqueue(new FileAction(e.FullPath, FileActionTypesConverter.Convert(e.ChangeType)));
        }
Example #2
0
 private void DeletedHandler(object sender, FileSystemEventArgs e)
 {
     _queue.Enqueue(new FileAction(e.FullPath, FileActionTypesConverter.Convert(e.ChangeType)));
 }
Example #3
0
 private void RenamedHandler(object sender, RenamedEventArgs e)
 {
     _queue.Enqueue(
         new FileAction(e.FullPath, FileActionTypesConverter.Convert(e.ChangeType), e.OldFullPath)
         );
 }