using System;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
namespace Emby.Server.Implementations.Sorting
{
class SeriesSortNameComparer : IBaseItemComparer
{
///
/// Compares the specified x.
///
/// The x.
/// The y.
/// System.Int32.
public int Compare(BaseItem x, BaseItem y)
{
return string.Compare(GetValue(x), GetValue(y), StringComparison.CurrentCultureIgnoreCase);
}
private static string GetValue(BaseItem item)
{
var hasSeries = item as IHasSeries;
return hasSeries != null ? hasSeries.FindSeriesSortName() : null;
}
///
/// Gets the name.
///
/// The name.
public string Name => ItemSortBy.SeriesSortName;
}
}