private bool tryGetWatcher(VirtualDirectory src, out VirtualDirectoryWatcher watcher) { lock (_lockObject) { watcher = null; if (_isDisposed) { return(false); } var retv = _directoryWatchers.ContainsKey(src); if (retv) { watcher = _directoryWatchers[src]; } return(retv); } }
public VirtualDirectoryWatcher Alloc(VirtualDirectory directory) { lock (_lockObject) { if (_isDisposed) { throw new ObjectDisposedException(nameof(VirtualDirectoryWatcherSource)); } if (!_directoryWatchers.ContainsKey(directory)) { var newWatcher = new VirtualDirectoryWatcher(directory, this); _directoryWatchers[directory] = newWatcher; _watchersAllocations[newWatcher] = 0; } var watcher = _directoryWatchers[directory]; _watchersAllocations[watcher]++; return(watcher); } }
internal VirtualDirectoryWatcher(VirtualDirectory directory, VirtualDirectoryWatcherSource source) { Directory = directory ?? throw new ArgumentNullException(nameof(directory)); _source = source ?? throw new ArgumentNullException(nameof(source)); }
internal void RaiseDeleted(VirtualDirectory directory) { DirectoryEvent?.Invoke(this, new DirectoryEventArgs(directory, WatcherEvent.Deleted)); }
internal DirectoryEventArgs(VirtualDirectory directory, WatcherEvent @event) { Directory = directory; Event = @event; }