mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-05 21:37:10 -04:00
Make ResolveArgs self-creating if need be
This commit is contained in:
parent
7cfa489c6e
commit
922fd3acae
@ -1,5 +1,6 @@
|
|||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
|
using MediaBrowser.Controller.IO;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -8,12 +9,34 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
public abstract class BaseItem : BaseEntity, IHasProviderIds
|
public abstract class BaseItem : BaseEntity, IHasProviderIds
|
||||||
{
|
{
|
||||||
|
protected ItemResolveEventArgs _resolveArgs;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// We attach these to the item so that we only ever have to hit the file system once
|
/// 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)
|
/// (this includes the children of the containing folder)
|
||||||
/// Use ResolveArgs.FileSystemChildren to check for the existence of files instead of File.Exists
|
/// Use ResolveArgs.FileSystemChildren to check for the existence of files instead of File.Exists
|
||||||
/// </summary>
|
/// </summary>
|
||||||
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; }
|
public string SortName { get; set; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user