C#.net FileSystemWatcher Events and Passing
Posted on 2009-02-21
I hope this explanation explains things and is understandable!
I have a program, at runtime a 2D array of SystemFileWatchers are created, all works perfect, events are triggered etc.
I have 4 FileWatcher events:
fw[i, y].Changed += fwchanged;
fw[i, y].Deleted += fwdeleted;
fw[i, y].Renamed += fwrenamed;
fw[i, y].Created += fwcreated;
Which trigger the events, as the example bellow:
private void fwchanged(object sender, System.IO.FileSystemEventArgs e)
trw.writetolog(e.ChangeType + ": " + e.FullPath, "DirMonLog");
This is all ok.
However, i want to addapt this and I am im not sure how and if it is even possible!
What i want to achive is the ability to access the FileWatchers NotifyFilter with in the event - such as - private void fwchanged(object sender, System.IO.FileSystemEventArgs e) - for example.
In order to do this i want to pass the NotifyFilter as a string to the event in a way like the half pesudo code bellow:
convert fw[i,y].NotifyFilter to string (if required)
fw[i, y].Changed += fwchanged(string notifyfilter);
private void fwchanged(object sender, System.IO.FileSystemEventArgs e, string notifyfilter)
In order to do such if i am defining what i wish to pass i must also define the 'sender' and 'System.IO.FileSystemEventArgs':
fw[i, y].Changed += fwchanged(sender, System.IO.FileSystemEventArgs, string notifyfilter);
My question is: How do i pass the 'System.IO.FileSystemEventArgs'? I can pass the sender by simply using this...i think? but i am unsure of how and if it is even possible to pass the 'System.IO.FileSystemEventArgs'?