diff options
Diffstat (limited to 'MediaBrowser.Controller/Entities/AggregateFolder.cs')
| -rw-r--r-- | MediaBrowser.Controller/Entities/AggregateFolder.cs | 51 |
1 files changed, 22 insertions, 29 deletions
diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs index e8ebbdb70..2105ef907 100644 --- a/MediaBrowser.Controller/Entities/AggregateFolder.cs +++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs @@ -20,19 +20,7 @@ namespace MediaBrowser.Controller.Entities { public AggregateFolder() { - PhysicalLocationsList = new List<string>(); - } - - /// <summary> - /// We don't support manual shortcuts - /// </summary> - [IgnoreDataMember] - protected override bool SupportsShortcutChildren - { - get - { - return false; - } + PhysicalLocationsList = EmptyStringArray; } [IgnoreDataMember] @@ -70,7 +58,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override IEnumerable<string> PhysicalLocations + public override string[] PhysicalLocations { get { @@ -78,23 +66,23 @@ namespace MediaBrowser.Controller.Entities } } - public List<string> PhysicalLocationsList { get; set; } + public string[] PhysicalLocationsList { get; set; } - protected override IEnumerable<FileSystemMetadata> GetFileSystemChildren(IDirectoryService directoryService) + protected override FileSystemMetadata[] GetFileSystemChildren(IDirectoryService directoryService) { return CreateResolveArgs(directoryService, true).FileSystemChildren; } - private List<Guid> _childrenIds = null; + private Guid[] _childrenIds = null; private readonly object _childIdsLock = new object(); protected override List<BaseItem> LoadChildren() { lock (_childIdsLock) { - if (_childrenIds == null || _childrenIds.Count == 0) + if (_childrenIds == null || _childrenIds.Length == 0) { - var list = base.LoadChildren().ToList(); - _childrenIds = list.Select(i => i.Id).ToList(); + var list = base.LoadChildren(); + _childrenIds = list.Select(i => i.Id).ToArray(); return list; } @@ -117,9 +105,9 @@ namespace MediaBrowser.Controller.Entities if (!changed) { - var locations = PhysicalLocations.ToList(); + var locations = PhysicalLocations; - var newLocations = CreateResolveArgs(new DirectoryService(Logger, FileSystem), false).PhysicalLocations.ToList(); + var newLocations = CreateResolveArgs(new DirectoryService(Logger, FileSystem), false).PhysicalLocations; if (!locations.SequenceEqual(newLocations)) { @@ -160,24 +148,22 @@ namespace MediaBrowser.Controller.Entities // When resolving the root, we need it's grandchildren (children of user views) var flattenFolderDepth = isPhysicalRoot ? 2 : 0; - var fileSystemDictionary = FileData.GetFilteredFileSystemEntries(directoryService, args.Path, FileSystem, Logger, args, flattenFolderDepth: flattenFolderDepth, resolveShortcuts: isPhysicalRoot || args.IsVf); + var files = FileData.GetFilteredFileSystemEntries(directoryService, args.Path, FileSystem, Logger, args, flattenFolderDepth: flattenFolderDepth, resolveShortcuts: isPhysicalRoot || args.IsVf); // Need to remove subpaths that may have been resolved from shortcuts // Example: if \\server\movies exists, then strip out \\server\movies\action if (isPhysicalRoot) { - var paths = LibraryManager.NormalizeRootPathList(fileSystemDictionary.Values); - - fileSystemDictionary = paths.ToDictionary(i => i.FullName); + files = LibraryManager.NormalizeRootPathList(files).ToArray(); } - args.FileSystemDictionary = fileSystemDictionary; + args.FileSystemChildren = files; } _requiresRefresh = _requiresRefresh || !args.PhysicalLocations.SequenceEqual(PhysicalLocations); if (setPhysicalLocations) { - PhysicalLocationsList = args.PhysicalLocations.ToList(); + PhysicalLocationsList = args.PhysicalLocations; } return args; @@ -226,7 +212,14 @@ namespace MediaBrowser.Controller.Entities throw new ArgumentNullException("id"); } - return _virtualChildren.FirstOrDefault(i => i.Id == id); + foreach (var child in _virtualChildren) + { + if (child.Id == id) + { + return child; + } + } + return null; } } } |
