From e5b383e47746248ed5c9d12afb365c2ea48905b4 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 13 Jun 2013 16:16:05 -0400 Subject: [PATCH] factor all files into file system stamp --- MediaBrowser.Controller/Entities/BaseItem.cs | 58 +++++--------------- 1 file changed, 14 insertions(+), 44 deletions(-) diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 264f66945..4c5575ae3 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -269,17 +269,29 @@ namespace MediaBrowser.Controller.Entities private Guid GetFileSystemStamp() { // If there's no path or the item is a file, there's nothing to do - if (LocationType != LocationType.FileSystem || !ResolveArgs.IsDirectory) + if (LocationType != LocationType.FileSystem) { return Guid.Empty; } + + try + { + if (!ResolveArgs.IsDirectory) + { + return Guid.Empty; + } + } + catch (IOException ex) + { + Logger.ErrorException("Error determining if path is directory: {0}", ex, ResolveArgs.Path); + throw; + } var sb = new StringBuilder(); // Record the name of each file // Need to sort these because accoring to msdn docs, our i/o methods are not guaranteed in any order foreach (var file in ResolveArgs.FileSystemChildren - .Where(i => (i.Attributes & FileAttributes.System) != FileAttributes.System) .OrderBy(f => f.Name)) { sb.Append(file.Name); @@ -491,48 +503,6 @@ namespace MediaBrowser.Controller.Entities [IgnoreDataMember] public Folder Parent { get; set; } - /// - /// Gets the collection folder parent. - /// - /// The collection folder parent. - [IgnoreDataMember] - public Folder CollectionFolder - { - get - { - if (this is AggregateFolder) - { - return null; - } - - if (IsFolder) - { - var iCollectionFolder = this as ICollectionFolder; - - if (iCollectionFolder != null) - { - return (Folder)this; - } - } - - var parent = Parent; - - while (parent != null) - { - var iCollectionFolder = parent as ICollectionFolder; - - if (iCollectionFolder != null) - { - return parent; - } - - parent = parent.Parent; - } - - return null; - } - } - /// /// When the item first debuted. For movies this could be premiere date, episodes would be first aired ///