jellyfin-server/MediaBrowser.Controller/Entities/IItemByName.cs

35 lines
789 B
C#
Raw Normal View History

using MediaBrowser.Model.Dto;
using System;
using System.Collections.Generic;
2013-06-27 19:29:58 +00:00
namespace MediaBrowser.Controller.Entities
{
/// <summary>
/// Marker interface
/// </summary>
public interface IItemByName
{
Dictionary<Guid, ItemByNameCounts> UserItemCounts { get; set; }
2013-06-27 19:29:58 +00:00
}
2013-09-10 19:30:56 +00:00
public static class IItemByNameExtensions
{
public static ItemByNameCounts GetItemByNameCounts(this IItemByName item, User user)
{
if (user == null)
{
2013-09-11 17:54:59 +00:00
throw new ArgumentNullException("user");
2013-09-10 19:30:56 +00:00
}
ItemByNameCounts counts;
if (item.UserItemCounts.TryGetValue(user.Id, out counts))
{
return counts;
}
return null;
}
}
2013-06-27 19:29:58 +00:00
}