2012-07-26 02:33:11 +00:00
|
|
|
|
using System.ComponentModel.Composition;
|
2012-07-12 06:55:27 +00:00
|
|
|
|
using MediaBrowser.Controller.Events;
|
2012-07-26 02:33:11 +00:00
|
|
|
|
using MediaBrowser.Model.Entities;
|
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>
|
|
|
|
|
{
|
|
|
|
|
protected override Folder Resolve(ItemResolveEventArgs args)
|
|
|
|
|
{
|
|
|
|
|
if (args.IsFolder)
|
|
|
|
|
{
|
|
|
|
|
return new Folder();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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-18 19:38:27 +00:00
|
|
|
|
protected override void SetItemValues(TItemType item, ItemResolveEventArgs args)
|
2012-07-12 06:55:27 +00:00
|
|
|
|
{
|
|
|
|
|
base.SetItemValues(item, args);
|
|
|
|
|
|
|
|
|
|
item.IsRoot = args.Parent == null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|