private void ProduceDeletedSnapshot(DirectorySnapshot snapshot) { try { snapshot.CreateSnapshot(); var snapshots = snapshot.GetDeletedSnapshots(Filters); var messages = snapshots.Select(x => ReadSnapshot(x)).ToArray(); _deletedQueue.Produce(_producerTokenSource.Token, messages); } catch (Exception e) { OnException?.Invoke(this, e); } }
private void ProduceCreatedFiles(string directory) { var snapshot = new DirectorySnapshot(directory, _searchOption); if (!IncludeExistingFiles) { snapshot.CreateSnapshot(); } while (!_createdQueue.IsAddingCompleted) { SpinWait.SpinUntil(() => false, Interval); ProduceCreatedSnapshot(snapshot); } }