コード例 #1
0
ファイル: LibraryMonitor.cs プロジェクト: rickardrocks/Emby
 private void DisposeRefresher(FileRefresher refresher)
 {
     lock (_activeRefreshers)
     {
         refresher.Dispose();
         _activeRefreshers.Remove(refresher);
     }
 }
コード例 #2
0
ファイル: LibraryMonitor.cs プロジェクト: rickardrocks/Emby
        private void CreateRefresher(string path)
        {
            var parentPath = Path.GetDirectoryName(path);

            lock (_activeRefreshers)
            {
                var refreshers = _activeRefreshers.ToList();
                foreach (var refresher in refreshers)
                {
                    // Path is already being refreshed
                    if (string.Equals(path, refresher.Path, StringComparison.Ordinal))
                    {
                        refresher.RestartTimer();
                        return;
                    }

                    // Parent folder is already being refreshed
                    if (_fileSystem.ContainsSubPath(refresher.Path, path))
                    {
                        refresher.AddPath(path);
                        return;
                    }

                    // New path is a parent
                    if (_fileSystem.ContainsSubPath(path, refresher.Path))
                    {
                        refresher.ResetPath(path, null);
                        return;
                    }

                    // They are siblings. Rebase the refresher to the parent folder.
                    if (string.Equals(parentPath, Path.GetDirectoryName(refresher.Path), StringComparison.Ordinal))
                    {
                        refresher.ResetPath(parentPath, path);
                        return;
                    }
                }

                var newRefresher = new FileRefresher(path, _fileSystem, ConfigurationManager, LibraryManager, TaskManager, Logger);
                newRefresher.Completed += NewRefresher_Completed;
                _activeRefreshers.Add(newRefresher);
            }
        }
コード例 #3
0
ファイル: LibraryMonitor.cs プロジェクト: t-andre/Emby
 private void DisposeRefresher(FileRefresher refresher)
 {
     lock (_activeRefreshers)
     {
         refresher.Dispose();
         _activeRefreshers.Remove(refresher);
     }
 }
コード例 #4
0
ファイル: LibraryMonitor.cs プロジェクト: t-andre/Emby
        private void CreateRefresher(string path)
        {
            var parentPath = Path.GetDirectoryName(path);

            lock (_activeRefreshers)
            {
                var refreshers = _activeRefreshers.ToList();
                foreach (var refresher in refreshers)
                {
                    // Path is already being refreshed
                    if (string.Equals(path, refresher.Path, StringComparison.Ordinal))
                    {
                        refresher.RestartTimer();
                        return;
                    }

                    // Parent folder is already being refreshed
                    if (_fileSystem.ContainsSubPath(refresher.Path, path))
                    {
                        refresher.AddPath(path);
                        return;
                    }

                    // New path is a parent
                    if (_fileSystem.ContainsSubPath(path, refresher.Path))
                    {
                        refresher.ResetPath(path, null);
                        return;
                    }

                    // They are siblings. Rebase the refresher to the parent folder.
                    if (string.Equals(parentPath, Path.GetDirectoryName(refresher.Path), StringComparison.Ordinal))
                    {
                        refresher.ResetPath(parentPath, path);
                        return;
                    }
                }

                var newRefresher = new FileRefresher(path, _fileSystem, ConfigurationManager, LibraryManager, TaskManager, Logger);
                newRefresher.Completed += NewRefresher_Completed;
                _activeRefreshers.Add(newRefresher);
            }
        }