From 57915240908beb100c6f0966ba43816502cdf187 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 20 Aug 2013 11:33:45 -0400 Subject: [PATCH] use a dictionary for quicker comparison --- MediaBrowser.Controller/Entities/CollectionFolder.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index b080478b8..76abbe627 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -75,11 +75,11 @@ namespace MediaBrowser.Controller.Entities { get { - ItemResolveArgs resolveArgs; + Dictionary locationsDicionary; try { - resolveArgs = ResolveArgs; + locationsDicionary = ResolveArgs.PhysicalLocations.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase); } catch (IOException ex) { @@ -89,7 +89,7 @@ namespace MediaBrowser.Controller.Entities return LibraryManager.RootFolder.RecursiveChildren .OfType() - .Where(i => i.Path != null && resolveArgs.PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase)) + .Where(i => i.Path != null && locationsDicionary.ContainsKey(i.Path)) .SelectMany(c => c.LinkedChildren).ToList(); } @@ -107,11 +107,11 @@ namespace MediaBrowser.Controller.Entities { get { - ItemResolveArgs resolveArgs; + Dictionary locationsDicionary; try { - resolveArgs = ResolveArgs; + locationsDicionary = ResolveArgs.PhysicalLocations.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase); } catch (IOException ex) { @@ -122,7 +122,7 @@ namespace MediaBrowser.Controller.Entities var ourChildren = LibraryManager.RootFolder.RecursiveChildren .OfType() - .Where(i => i.Path != null && resolveArgs.PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase)) + .Where(i => i.Path != null && locationsDicionary.ContainsKey(i.Path)) .SelectMany(c => c.Children); return new ConcurrentDictionary(ourChildren.ToDictionary(i => i.Id));