-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
Hello,
I would need to retrieve which EventHandler did fire the events when I handle them.
Could you add a "sender" argument in the event signature in further releases? This only requires a very few changes in the code:
public delegate void FileEventHandler(EventWatcher sender, string name, ulong processId);
public delegate void MoveEventHandler(EventWatcher sender, string name, string oldName, ulong processId);
private void DeliverEvent(FileSystemEvent fileEvent, bool postponeDelivery)
{
switch (fileEvent.Type)
{
case EventType.Change:
OnChange?.Invoke(this,fileEvent.Filename, fileEvent.ProcessId);
break;
case EventType.Create:
OnCreate?.Invoke(this,fileEvent.Filename, fileEvent.ProcessId);
break;
case EventType.Delete:
OnDelete?.Invoke(this,fileEvent.Filename, fileEvent.ProcessId);
break;
case EventType.Move:
OnRenameOrMove?.Invoke(this,fileEvent.Filename, ((RenameOrMoveEvent) fileEvent).OldFilename, fileEvent.ProcessId);
break;
default:
break;
}
}
I made the change by myself for now and I built the library locally, but this prevents me from being synchronized with the NuGet package and from getting the updates.
Also, could you add a public property to indicate which paths are being watched (like the Path property of the standard FileSystemWatcher)? Maybe you could create a list populated when calling WatchPath.
Or, easier, you could create a "Tag" object field to be set manually with the watched path(s) (or any other useful data).
Sincerely,
E__Man.
Metadata
Metadata
Assignees
Labels
No labels