diff options
Diffstat (limited to 'MediaBrowser.Controller/Entities/CollectionFolder.cs')
| -rw-r--r-- | MediaBrowser.Controller/Entities/CollectionFolder.cs | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index d88b7da34..537beb26b 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -27,17 +27,8 @@ namespace MediaBrowser.Controller.Entities public CollectionFolder() { - PhysicalLocationsList = new List<string>(); - PhysicalFolderIds = new List<Guid>(); - } - - [IgnoreDataMember] - protected override bool SupportsShortcutChildren - { - get - { - return true; - } + PhysicalLocationsList = EmptyStringArray; + PhysicalFolderIds = EmptyGuidArray; } [IgnoreDataMember] @@ -149,7 +140,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override IEnumerable<string> PhysicalLocations + public override string[] PhysicalLocations { get { @@ -162,10 +153,10 @@ namespace MediaBrowser.Controller.Entities return true; } - public List<string> PhysicalLocationsList { get; set; } - public List<Guid> PhysicalFolderIds { get; set; } + public string[] PhysicalLocationsList { get; set; } + public Guid[] PhysicalFolderIds { get; set; } - protected override IEnumerable<FileSystemMetadata> GetFileSystemChildren(IDirectoryService directoryService) + protected override FileSystemMetadata[] GetFileSystemChildren(IDirectoryService directoryService) { return CreateResolveArgs(directoryService, true).FileSystemChildren; } @@ -177,9 +168,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)) { @@ -189,7 +180,7 @@ namespace MediaBrowser.Controller.Entities if (!changed) { - var folderIds = PhysicalFolderIds.ToList(); + var folderIds = PhysicalFolderIds; var newFolderIds = GetPhysicalFolders(false).Select(i => i.Id).ToList(); @@ -249,17 +240,17 @@ namespace MediaBrowser.Controller.Entities var changed = !linkedChildren.SequenceEqual(LinkedChildren, new LinkedChildComparer(FileSystem)); - LinkedChildren = linkedChildren; + LinkedChildren = linkedChildren.ToArray(linkedChildren.Count); - var folderIds = PhysicalFolderIds.ToList(); - var newFolderIds = physicalFolders.Select(i => i.Id).ToList(); + var folderIds = PhysicalFolderIds; + var newFolderIds = physicalFolders.Select(i => i.Id).ToArray(); if (!folderIds.SequenceEqual(newFolderIds)) { changed = true; if (setFolders) { - PhysicalFolderIds = newFolderIds.ToList(); + PhysicalFolderIds = newFolderIds; } } @@ -301,24 +292,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; |
