예제 #1
0
        /// <summary>
        /// Removes a directory from the list of directories tracked by this <see cref="FileProcessor"/>.
        /// </summary>
        /// <param name="path">The path to the directory to stop tracking.</param>
        public void RemoveTrackedDirectory(string path)
        {
            string fullPath = FilePath.GetAbsolutePath(path);

            List <FileSystemWatcher> fileWatchersToRemove;

            lock (m_fileWatchers)
            {
                fileWatchersToRemove = m_fileWatchers
                                       .Where(w => fullPath.Equals(w.Path, StringComparison.OrdinalIgnoreCase))
                                       .ToList();

                foreach (FileSystemWatcher watcher in fileWatchersToRemove)
                {
                    RemoveFileWatcher(watcher);
                }

                if (m_fileWatchers.Count == 0)
                {
                    m_processingQueue.Stop();
                    m_fileWatchTimer.Stop();
                    m_processedFiles.Close();
                }
            }
        }