c# - FileSystemWatcher missing file changes from other program -
Specific questions I have set up a program that looks at changes in numbers with a text file.
FileSystemWatcher Mike Water = New FileSystemWatcher (); System IiAetfor Changedcentant Post Mike; String filePath = @ "c: \ path.txt"; Mike Water Path = path.gate directoryname (file path); Mike Water Filter = path. GetFileName (file path); // Wait for change in file post Mike = Mike Water Waiting for (system .o.watchange type changed);
After the WaitForChanged flag is complete the code continues with the process.
...
The issue I am encountering when the flag is triggered successfully when I manually change the text file and save it when the second program (matlab ) Writes and saves that file, the flag does not seem to trigger.
I have confirmed that this is actually changing the same file (path is correct) and the change is registered in "Last modified date". Also, it seems that the muteab process is locking after saving the text file, so this is not release, I do not think so.
Any ideas or advice? It would be easiest to replace my C # code for me, then the matlab code. Any suggestion will be appreciated!
The solution here is to stop using the FileSystemWatcher, and in return for scanning the directory Use timer for
I have tried to use FileSystemWatcher in two projects and in both cases I found it very unreliable. It will remember some events, delay some incidents and report some incidents twice.
This answer can not be popular but I believe that the only correct way to use FileSystemWatcher is in the comment, like:
// FileSystemWatcher tried, But it was very unbelievable.
Comments
Post a Comment