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