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