Colleagues,
Here's what I have in the code:
It works, but this FW reacts on any modification (like adding/removing chars and then Ctrl+S) twice:
The file modification's monitoring Proc looks like this:
and this is what it writes into the LOG file:
Why it behaves like that, and what shall I do to prevent this duplication?
AHWBGA!
Regards,
Ilya
Here's what I have in the code:
Code:
'====================================================================================================================================
Private Sub MonitorFilesModifications()
'====================================================================================================================================
goFW_XML.Filter = "*.XML"
goFW_XML.Path = gsWorkDir
goFW_XML.IncludeSubdirectories = True
goFW_XML.EnableRaisingEvents = True
goFW_XML.NotifyFilter = NotifyFilters.Attributes Or
NotifyFilters.CreationTime Or
NotifyFilters.DirectoryName Or
NotifyFilters.FileName Or
NotifyFilters.LastWrite Or
NotifyFilters.Size
It works, but this FW reacts on any modification (like adding/removing chars and then Ctrl+S) twice:
The file modification's monitoring Proc looks like this:
Code:
'====================================================================================================================================
Private Sub OnChanged(sender As Object, e As FileSystemEventArgs)
'====================================================================================================================================
If e.ChangeType <> WatcherChangeTypes.Changed Then
Return
End If
Dim lsReptStr As String = Format(Now, "yyyy-MM-dd HH:mm:ss") + ": File " + e.FullPath + " was modified on " + gcMachineName + vbCrLf
My.Computer.FileSystem.WriteAllText(gsLogFile, lsReptStr, True)
End Sub
'====================================================================================================================================
and this is what it writes into the LOG file:
Code:
2024-07-29 14:01:34: File C:\Temp\YE1099NEC24032901220240329151525.XML was modified on MYWS
2024-07-29 14:01:35: File C:\Temp\YE1099NEC24032901220240329151525.XML was modified on MYWS
Why it behaves like that, and what shall I do to prevent this duplication?
AHWBGA!
Regards,
Ilya