private void Watcher_Created(object sender, FileSystemEventArgs e) { //string fileEvent = "создан"; //string filePath = e.FullPath; var data = FileProvider.TryReadAllLines(e.FullPath); int rowNumber = 0; LayerInfo layer = new LayerInfo() { EventDate = DateTime.Now, ChangeType = WatcherChangeTypes.Changed, FileName = Path.GetFileName(e.Name), RelativePath = RelativePathFinder.GetRelativePath(e.FullPath, FileSystemWatcher.Path), AddOrUpdateData = new AddOrUpdateData() { ChangesRows = data .Select( elem => new RowInformation() { RowNumber = rowNumber++, Content = elem } ) .ToList(), LastRowNumber = data.Length } }; OnDirectoryEvent? .Invoke(layer, e.ChangeType); }
private void Watcher_Changed(object sender, FileSystemEventArgs e) { //string fileEvent = "изменен"; //string filePath = e.FullPath; LayerInfo layer = new LayerInfo() { EventDate = DateTime.Now, ChangeType = WatcherChangeTypes.Changed, FileName = Path.GetFileName(e.Name), RelativePath = RelativePathFinder.GetRelativePath(e.FullPath, FileSystemWatcher.Path) }; OnDirectoryEvent? .Invoke(layer, e.ChangeType); }
private void Watcher_Renamed(object sender, RenamedEventArgs e) { //string fileEvent = "переименован в " + e.FullPath; //string filePath = e.OldFullPath; LayerInfo layer = new LayerInfo() { EventDate = DateTime.Now, ChangeType = WatcherChangeTypes.Renamed, FileName = Path.GetFileName(e.OldName), NewName = Path.GetFileName(e.Name), RelativePath = RelativePathFinder.GetRelativePath(e.FullPath, FileSystemWatcher.Path) }; OnDirectoryEvent?.Invoke(layer, e.ChangeType); }