2012-09-11 01:34:02 +00:00
|
|
|
|
using MediaBrowser.Controller.Entities;
|
2012-08-23 20:51:10 +00:00
|
|
|
|
using MediaBrowser.Controller.Library;
|
2012-09-11 01:34:02 +00:00
|
|
|
|
using System.ComponentModel.Composition;
|
2012-07-12 06:55:27 +00:00
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Resolvers
|
|
|
|
|
{
|
2012-07-26 02:33:11 +00:00
|
|
|
|
[Export(typeof(IBaseItemResolver))]
|
2012-07-12 06:55:27 +00:00
|
|
|
|
public class FolderResolver : BaseFolderResolver<Folder>
|
|
|
|
|
{
|
2012-08-20 15:55:05 +00:00
|
|
|
|
public override ResolverPriority Priority
|
|
|
|
|
{
|
|
|
|
|
get { return ResolverPriority.Last; }
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-12 06:55:27 +00:00
|
|
|
|
protected override Folder Resolve(ItemResolveEventArgs args)
|
|
|
|
|
{
|
2012-09-19 14:22:53 +00:00
|
|
|
|
if (args.IsDirectory)
|
2012-07-12 06:55:27 +00:00
|
|
|
|
{
|
2012-09-20 17:52:56 +00:00
|
|
|
|
return new Folder();
|
2012-07-12 06:55:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-18 19:38:27 +00:00
|
|
|
|
public abstract class BaseFolderResolver<TItemType> : BaseItemResolver<TItemType>
|
|
|
|
|
where TItemType : Folder, new()
|
2012-07-12 06:55:27 +00:00
|
|
|
|
{
|
2012-08-19 20:38:31 +00:00
|
|
|
|
protected override void SetInitialItemValues(TItemType item, ItemResolveEventArgs args)
|
2012-07-12 06:55:27 +00:00
|
|
|
|
{
|
2012-08-19 20:38:31 +00:00
|
|
|
|
base.SetInitialItemValues(item, args);
|
2012-07-12 06:55:27 +00:00
|
|
|
|
|
|
|
|
|
item.IsRoot = args.Parent == null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|