2013-09-10 20:56:00 +02:00
|
|
|
|
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
|
|
|
|
|
{
|
2013-09-10 20:56:00 +02:00
|
|
|
|
Dictionary<Guid, ItemByNameCounts> UserItemCounts { get; set; }
|
2013-06-27 21:29:58 +02:00
|
|
|
|
}
|
2013-09-10 21:30:56 +02:00
|
|
|
|
|
2013-11-21 21:48:26 +01:00
|
|
|
|
public interface IHasDualAccess : IItemByName
|
|
|
|
|
{
|
|
|
|
|
bool IsAccessedByName { get; }
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
}
|