diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 17f32c0e6..dc148da36 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1,5 +1,6 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.IO; using System; using System.Collections.Generic; using System.Linq; @@ -8,12 +9,34 @@ namespace MediaBrowser.Controller.Entities { public abstract class BaseItem : BaseEntity, IHasProviderIds { + protected ItemResolveEventArgs _resolveArgs; /// /// We attach these to the item so that we only ever have to hit the file system once /// (this includes the children of the containing folder) /// Use ResolveArgs.FileSystemChildren to check for the existence of files instead of File.Exists /// - public ItemResolveEventArgs ResolveArgs { get; set; } + public ItemResolveEventArgs ResolveArgs + { + get + { + if (_resolveArgs == null) + { + _resolveArgs = new ItemResolveEventArgs() + { + FileInfo = FileData.GetFileData(this.Path), + Parent = this.Parent, + Cancel = false, + Path = this.Path + }; + _resolveArgs = FileSystemHelper.FilterChildFileSystemEntries(_resolveArgs, (this.Parent != null && this.Parent.IsRoot)); + } + return _resolveArgs; + } + set + { + _resolveArgs = value; + } + } public string SortName { get; set; }