private void FileChange(object sender, FileSystemEventArgs e) { FileAction action; Uri file = new Uri(e.FullPath); switch (e.ChangeType) { case WatcherChangeTypes.Created: CopyQueue.AddItem(file); action = FileAction.Copy; break; case WatcherChangeTypes.Deleted: DeleteQueue.AddItem(file); action = FileAction.Delete; break; case WatcherChangeTypes.Changed: UpdateQueue.AddItem(file); action = FileAction.Update; break; case WatcherChangeTypes.Renamed: RenameQueue.AddItem(file); action = FileAction.Rename; break; case WatcherChangeTypes.All: default: action = FileAction.Copy | FileAction.Delete | FileAction.Rename | FileAction.Update; break; } OnChangeDetected?.Invoke(action); }
private void OnRepositoryChangeDetected(Repository repo) { string path = repo?.Path; if (string.IsNullOrEmpty(path)) { return; } if (_repositoryIgnoreStore.IsIgnored(repo.Path)) { return; } if (!_repositoryInformationAggregator.HasRepository(path)) { CreateRepositoryObserver(repo, path); // use that delay to prevent a lot of sequential writes // when a lot repositories get found in a row _storeFlushTimer.Change(5000, Timeout.Infinite); } OnChangeDetected?.Invoke(this, repo); _repositoryInformationAggregator.Add(repo); }