You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.5 KiB
58 lines
1.5 KiB
4 years ago
|
#nullable disable
|
||
|
|
||
6 years ago
|
using MediaBrowser.Controller.Entities;
|
||
6 years ago
|
using MediaBrowser.Controller.Library;
|
||
|
|
||
|
namespace MediaBrowser.Controller.Resolvers
|
||
|
{
|
||
|
/// <summary>
|
||
4 years ago
|
/// Class ItemResolver.
|
||
6 years ago
|
/// </summary>
|
||
4 years ago
|
/// <typeparam name="T">The type of BaseItem.</typeparam>
|
||
6 years ago
|
public abstract class ItemResolver<T> : IItemResolver
|
||
|
where T : BaseItem, new()
|
||
|
{
|
||
4 years ago
|
/// <summary>
|
||
|
/// Gets the priority.
|
||
|
/// </summary>
|
||
|
/// <value>The priority.</value>
|
||
|
public virtual ResolverPriority Priority => ResolverPriority.First;
|
||
|
|
||
6 years ago
|
/// <summary>
|
||
|
/// Resolves the specified args.
|
||
|
/// </summary>
|
||
|
/// <param name="args">The args.</param>
|
||
|
/// <returns>`0.</returns>
|
||
4 years ago
|
public virtual T Resolve(ItemResolveArgs args)
|
||
6 years ago
|
{
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
4 years ago
|
/// Sets initial values on the newly resolved item.
|
||
6 years ago
|
/// </summary>
|
||
|
/// <param name="item">The item.</param>
|
||
|
/// <param name="args">The args.</param>
|
||
|
protected virtual void SetInitialItemValues(T item, ItemResolveArgs args)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Resolves the path.
|
||
|
/// </summary>
|
||
|
/// <param name="args">The args.</param>
|
||
|
/// <returns>BaseItem.</returns>
|
||
|
BaseItem IItemResolver.ResolvePath(ItemResolveArgs args)
|
||
|
{
|
||
|
var item = Resolve(args);
|
||
|
|
||
|
if (item != null)
|
||
|
{
|
||
|
SetInitialItemValues(item, args);
|
||
|
}
|
||
|
|
||
|
return item;
|
||
|
}
|
||
|
}
|
||
|
}
|