private void OnWatcherChanged(object source, FileSystemEventArgs e) { var path = GetPath(e.FullPath); // ignore event for srcPath (don't know why it occurs rarely) if (string.IsNullOrEmpty(path)) { return; } if (!_gitIsBusy && e.ChangeType == WatcherChangeTypes.Created && path == GitIndexLockFilename) { SetGitIsBusy(true); } if (_excludeList.IsMatch(path)) { return; } AddChange(FsSenderChange.CreateChange(path), withSubdirectories: e.ChangeType == WatcherChangeTypes.Created); }
private void OnWatcherChanged(object source, FileSystemEventArgs e) { // ignore event for srcPath (don't know why it occurs rarely) if (e.FullPath == _srcPath) { return; } var path = GetPath(e.FullPath); if (!_gitIsBusy && e.ChangeType == WatcherChangeTypes.Created && path == GIT_INDEX_LOCK_FILENAME) { SetGitIsBusy(true); } if (_excludeList.IsMatch(path)) { return; } AddChange(FsChange.CreateChange(path), withSubdirectories: e.ChangeType == WatcherChangeTypes.Created); }
public void TestMasks() { var fileList = new FileMaskList(); fileList.SetList(new List <string> { "*.txt", "/var", "dist", "!/var/log", "start*end.cpp" }); // txt Assert.True(fileList.IsMatch("test.txt")); Assert.True(fileList.IsMatch("home/test.txt")); Assert.False(fileList.IsMatch("test.txt1")); // var Assert.True(fileList.IsMatch("var/www")); Assert.False(fileList.IsMatch("www/var")); // dist Assert.True(fileList.IsMatch("home/www/dist")); Assert.True(fileList.IsMatch("dist")); Assert.False(fileList.IsMatch("distX")); // negative Assert.False(fileList.IsMatch("var/log")); Assert.True(fileList.IsMatch("var/log1")); Assert.False(fileList.IsMatch("var/log/test")); // wildcard Assert.True(fileList.IsMatch("start_middle_end.cpp")); Assert.False(fileList.IsMatch("start_middle.cpp")); }
public void Masks() { // txt _fileList.IsMatch("test.txt"); _fileList.IsMatch("home/test.txt"); _fileList.IsMatch("test.txt1"); // var _fileList.IsMatch("var/www"); _fileList.IsMatch("www/var"); // dist _fileList.IsMatch("home/www/dist"); _fileList.IsMatch("dist"); _fileList.IsMatch("distX"); // negative _fileList.IsMatch("var/log"); _fileList.IsMatch("var/log1"); _fileList.IsMatch("var/log/test"); // wildcard _fileList.IsMatch("start_middle_end.cpp"); _fileList.IsMatch("start_middle.cpp"); }