From a508a997d9e7605c40f4442e367b9dd74e54f5e3 Mon Sep 17 00:00:00 2001 From: LukePulverenti Luke Pulverenti luke pulverenti Date: Sat, 18 Aug 2012 15:38:27 -0400 Subject: Added a VirtualFolder entity, a resolver, and a CollectionType property. --- MediaBrowser.Model/Entities/BaseItem.cs | 23 +++++++++++++++++++++++ MediaBrowser.Model/Entities/Folder.cs | 8 -------- MediaBrowser.Model/Entities/IHasProviderIds.cs | 2 +- MediaBrowser.Model/Entities/ItemSpecialCounts.cs | 2 +- MediaBrowser.Model/Entities/VirtualFolder.cs | 8 ++++++++ 5 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 MediaBrowser.Model/Entities/VirtualFolder.cs (limited to 'MediaBrowser.Model/Entities') diff --git a/MediaBrowser.Model/Entities/BaseItem.cs b/MediaBrowser.Model/Entities/BaseItem.cs index 506c051c52..7d3663fb23 100644 --- a/MediaBrowser.Model/Entities/BaseItem.cs +++ b/MediaBrowser.Model/Entities/BaseItem.cs @@ -6,6 +6,29 @@ namespace MediaBrowser.Model.Entities { public abstract class BaseItem : BaseEntity, IHasProviderIds { + /// + /// Goes up the tree to find the virtual folder parent + /// + public VirtualFolder VirtualFolder + { + get + { + var vf = this as VirtualFolder; + + if (vf != null) + { + return vf; + } + + if (Parent != null) + { + return Parent.VirtualFolder; + } + + return null; + } + } + public string SortName { get; set; } /// diff --git a/MediaBrowser.Model/Entities/Folder.cs b/MediaBrowser.Model/Entities/Folder.cs index 105151f315..50ce9d45ef 100644 --- a/MediaBrowser.Model/Entities/Folder.cs +++ b/MediaBrowser.Model/Entities/Folder.cs @@ -8,14 +8,6 @@ namespace MediaBrowser.Model.Entities { public bool IsRoot { get; set; } - public bool IsVirtualFolder - { - get - { - return Parent != null && Parent.IsRoot; - } - } - public BaseItem[] Children { get; set; } /// diff --git a/MediaBrowser.Model/Entities/IHasProviderIds.cs b/MediaBrowser.Model/Entities/IHasProviderIds.cs index 3406d618bd..8b9852dda3 100644 --- a/MediaBrowser.Model/Entities/IHasProviderIds.cs +++ b/MediaBrowser.Model/Entities/IHasProviderIds.cs @@ -3,7 +3,7 @@ namespace MediaBrowser.Model.Entities { /// - /// Since BaseItem and DTOBaseItem both have ProviderIds, this interface helps avoid code repition using extension methods + /// Since BaseItem and DTOBaseItem both have ProviderIds, this interface helps avoid code repition by using extension methods /// public interface IHasProviderIds { diff --git a/MediaBrowser.Model/Entities/ItemSpecialCounts.cs b/MediaBrowser.Model/Entities/ItemSpecialCounts.cs index 9add9fe99e..8dd9a2fbd9 100644 --- a/MediaBrowser.Model/Entities/ItemSpecialCounts.cs +++ b/MediaBrowser.Model/Entities/ItemSpecialCounts.cs @@ -2,7 +2,7 @@ namespace MediaBrowser.Model.Entities { /// - /// Since it can be slow to collect this data. This class helps provide a way to calculate them all at once. + /// Since it can be slow to collect this data, this class helps provide a way to calculate them all at once. /// public class ItemSpecialCounts { diff --git a/MediaBrowser.Model/Entities/VirtualFolder.cs b/MediaBrowser.Model/Entities/VirtualFolder.cs new file mode 100644 index 0000000000..f25db3e41b --- /dev/null +++ b/MediaBrowser.Model/Entities/VirtualFolder.cs @@ -0,0 +1,8 @@ + +namespace MediaBrowser.Model.Entities +{ + public class VirtualFolder : Folder + { + public string CollectionType { get; set; } + } +} -- cgit v1.2.3