public void Release() { lock (_lock) { UnsubscribeToWatcher(); SharedWatcher.Release(); } }
public SharedWatcher(string uniquePath, PathWatcher pathWatcher) { UniquePath = uniquePath; PathWatcher = pathWatcher; string folderPath = FileSystem.GetFolderPath(uniquePath); if (folderPath == null) { throw new InvalidOperationException(); } FolderPath = FileSystem.UniqueFolder(folderPath); _parentWatcher = PathWatcher.GetSharedWatcher(FolderPath); TryGetInternalWatcher(); StartWatchFolder(); StartWatchParentFolder(); }
public PathHandlersBase(string uniquePath, SharedWatcher sharedWatcher, bool subscribeToChanged) { UniquePath = uniquePath; PathPattern = new PathPattern(uniquePath, sharedWatcher.FileSystem.PathsCaseSensitive); SharedWatcher = sharedWatcher; _subscribeToChanged = subscribeToChanged; SharedWatcher.Increment(); SharedWatcher.FolderCreated += OnParentFolderCreated; SharedWatcher.FolderDeleted += OnParentFolderDeleted; PathCaseComparison caseComparison = sharedWatcher.FileSystem.PathsCaseSensitive ? PathCaseComparison.RespectCase : PathCaseComparison.IgnoreCase; var existingPathComparer = new PathComparer(caseComparison, FolderPathEquality.RespectAmbiguity); _matchingPaths = new ConcurrentDictionary <string, bool>(existingPathComparer); RefreshExistingMatchingPaths(); SubscribeToWatcher(); }
public FolderHandlers(string uniquePath, SharedWatcher sharedWatcher, FolderChangedEventHandler handler, LogLevel logLevel) : base(uniquePath, sharedWatcher, subscribeToChanged: false) { _handler = handler; _logLevel = logLevel; }
public FileHandlers(string uniquePath, SharedWatcher sharedWatcher, FileChangedEventHandler handler, LogLevel logLevel) : base(uniquePath, sharedWatcher, subscribeToChanged: true) { _handler = handler; _logLevel = logLevel; }