Exemple #1
0
        protected void FileEventHandler(FileWatchInfo sender, IFileWatchEventArgs args)
        {
            IEnumerable <ChangeTrackerRegistrationKey> ctrks = GetAllChangeTrackerRegistrationsByPath(sender.Path);
            MediaSourceChangeType changeType = TranslateChangeType(args.ChangeType);

            foreach (ChangeTrackerRegistrationKey key in ctrks)
            {
                key.PathChangeDelegate(new LocalFsResourceAccessor(this, args.Path), args.OldPath, changeType);
            }
        }
 /// <summary>
 /// Returns whether an event may be raised for the given path and changetype.
 /// </summary>
 /// <param name="args">
 /// Arguments to compare to the requirements set by
 /// the current <see cref="FileWatcherInfo"/> for raising events.
 /// </param>
 /// <returns></returns>
 public bool MayRaiseEventFor(IFileWatchEventArgs args)
 {
   // Don't raise an event if no FileEventHandler is specified.
   if (_eventHandler == null)
     return false;
   // Do changes in the specified path need to be reported by the current FileWatcherInfo?
   if (!IsWatchedDirectory(args.Path))
     return false;
   // Check if the specified changetype must be reported.
   if (!CompliesToChangeType(args.ChangeType))
     return false;
   // Event may be raised if the old path matches the filter.
   return CompliesToFilterStrings(args.OldPath)
          // Event may also be raised if the new path matches the filter.
          || (args.Path != args.OldPath && CompliesToFilterStrings(args.Path));
 }
 /// <summary>
 /// Returns whether an event may be raised for the given path and changetype.
 /// </summary>
 /// <param name="args">
 /// Arguments to compare to the requirements set by
 /// the current <see cref="FileWatcherInfo"/> for raising events.
 /// </param>
 /// <returns></returns>
 public bool MayRaiseEventFor(IFileWatchEventArgs args)
 {
     // Don't raise an event if no FileEventHandler is specified.
     if (_eventHandler == null)
     {
         return(false);
     }
     // Do changes in the specified path need to be reported by the current FileWatcherInfo?
     if (!IsWatchedDirectory(args.Path))
     {
         return(false);
     }
     // Check if the specified changetype must be reported.
     if (!CompliesToChangeType(args.ChangeType))
     {
         return(false);
     }
     // Event may be raised if the old path matches the filter.
     return(CompliesToFilterStrings(args.OldPath)
            // Event may also be raised if the new path matches the filter.
            || (args.Path != args.OldPath && CompliesToFilterStrings(args.Path)));
 }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of EventData which holds an instance of FileWatchInfo
 /// and an instance of FileWatchEventArgs.
 /// </summary>
 /// <param name="fileWatchInfo"></param>
 /// <param name="fileWatchEventArgs"></param>
 public EventData(FileWatchInfo fileWatchInfo, IFileWatchEventArgs fileWatchEventArgs)
 {
     _fileWatchInfo      = fileWatchInfo;
     _fileWatchEventArgs = fileWatchEventArgs;
 }
Exemple #5
0
 /// <summary>
 /// Initializes a new instance of EventData which holds an instance of FileWatchInfo
 /// and an instance of FileWatchEventArgs.
 /// </summary>
 /// <param name="fileWatchInfo"></param>
 /// <param name="fileWatchEventArgs"></param>
 public EventData(FileWatchInfo fileWatchInfo, IFileWatchEventArgs fileWatchEventArgs)
 {
   _fileWatchInfo = fileWatchInfo;
   _fileWatchEventArgs = fileWatchEventArgs;
 }
 protected void FileEventHandler(FileWatchInfo sender, IFileWatchEventArgs args)
 {
   IEnumerable<ChangeTrackerRegistrationKey> ctrks = GetAllChangeTrackerRegistrationsByPath(sender.Path);
   MediaSourceChangeType changeType = TranslateChangeType(args.ChangeType);
   foreach (ChangeTrackerRegistrationKey key in ctrks)
     key.PathChangeDelegate(new LocalFsResourceAccessor(this, args.Path), args.OldPath, changeType);
 }