Hi,
I am registering the file we add in project for tracking changes to file. For this I have used IVsFileChangeEvents. Problem is when i add the file to the project then also it is hitting IVsFileChangeEvents.FilesChanged method and it is hitting the the method more than once.
I do not want this method to be hit when we add a file in the project. I want this method to be hit only when we change the content of the file. And also it should not hit more than once.
Code is attached.
//below code is registering the file to file change event string scFileName = System.IO.Path.GetDirectoryName(_ProjectNode.Url) + "\\" + _currentFileName + FileExtension; //subscribe to file watcher. SourceControlOpenUpdate _openUpdate = new SourceControlOpenUpdate(_ProjectNode, HostConnector, _ProjectNode.Url); FileChangeTracker fileChangeTracker = new FileChangeTracker(_ProjectNode.Site, scFileName); fileChangeTracker.EnsureSubscription(); fileChangeTracker.UpdatedOnDisk += _openUpdate.SourceControlFileChanged; fileAddVariable = true; //below method is hitting again and again int IVsFileChangeEvents.FilesChanged(uint changeCount, string[] files, uint[] changes) { _fileChangeService.UnadviseFileChange(newCookie); var handler = UpdatedOnDisk; if (handler != null) { handler(this, EventArgs.Empty); } _fileChangeService.AdviseFileChange(_filePath, (uint)_VSFILECHANGEFLAGS.VSFILECHG_Time, this, out newCookie); return 0; }
Please anyone can help.
Thanks in advance