mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-15 23:58:57 +00:00
Enable nullable reference types for Emby.Server.Implementations
This commit is contained in:
@@ -16,7 +16,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||
/// <param name="x">The x.</param>
|
||||
/// <param name="y">The y.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public int Compare(BaseItem x, BaseItem y)
|
||||
public int Compare(BaseItem? x, BaseItem? y)
|
||||
{
|
||||
if (x == null)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||
/// <param name="x">The x.</param>
|
||||
/// <param name="y">The y.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public int Compare(BaseItem x, BaseItem y)
|
||||
public int Compare(BaseItem? x, BaseItem? y)
|
||||
{
|
||||
return string.Compare(GetValue(x), GetValue(y), StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
@@ -28,7 +28,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||
/// </summary>
|
||||
/// <param name="x">The x.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
private static string GetValue(BaseItem x)
|
||||
private static string? GetValue(BaseItem? x)
|
||||
{
|
||||
var audio = x as IHasAlbumArtist;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||
/// <param name="x">The x.</param>
|
||||
/// <param name="y">The y.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public int Compare(BaseItem x, BaseItem y)
|
||||
public int Compare(BaseItem? x, BaseItem? y)
|
||||
{
|
||||
return string.Compare(GetValue(x), GetValue(y), StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
@@ -27,7 +27,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||
/// </summary>
|
||||
/// <param name="x">The x.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
private static string GetValue(BaseItem x)
|
||||
private static string? GetValue(BaseItem? x)
|
||||
{
|
||||
var audio = x as Audio;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||
public string Name => ItemSortBy.Artist;
|
||||
|
||||
/// <inheritdoc />
|
||||
public int Compare(BaseItem x, BaseItem y)
|
||||
public int Compare(BaseItem? x, BaseItem? y)
|
||||
{
|
||||
return string.Compare(GetValue(x), GetValue(y), StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
@@ -25,7 +25,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||
/// </summary>
|
||||
/// <param name="x">The x.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
private static string GetValue(BaseItem x)
|
||||
private static string? GetValue(BaseItem? x)
|
||||
{
|
||||
if (!(x is Audio audio))
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||
/// <param name="x">The x.</param>
|
||||
/// <param name="y">The y.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public int Compare(BaseItem x, BaseItem y)
|
||||
public int Compare(BaseItem? x, BaseItem? y)
|
||||
{
|
||||
if (x == null)
|
||||
{
|
||||
|
||||
@@ -15,14 +15,14 @@ namespace Emby.Server.Implementations.Sorting
|
||||
/// <param name="x">The x.</param>
|
||||
/// <param name="y">The y.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public int Compare(BaseItem x, BaseItem y)
|
||||
public int Compare(BaseItem? x, BaseItem? y)
|
||||
{
|
||||
return GetValue(x).CompareTo(GetValue(y));
|
||||
}
|
||||
|
||||
private static float GetValue(BaseItem x)
|
||||
private static float GetValue(BaseItem? x)
|
||||
{
|
||||
return x.CriticRating ?? 0;
|
||||
return x?.CriticRating ?? 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||
/// <param name="x">The x.</param>
|
||||
/// <param name="y">The y.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public int Compare(BaseItem x, BaseItem y)
|
||||
public int Compare(BaseItem? x, BaseItem? y)
|
||||
{
|
||||
if (x == null)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable disable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable disable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using Jellyfin.Data.Entities;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||
/// <param name="x">The x.</param>
|
||||
/// <param name="y">The y.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public int Compare(BaseItem x, BaseItem y)
|
||||
public int Compare(BaseItem? x, BaseItem? y)
|
||||
{
|
||||
return GetValue(x).CompareTo(GetValue(y));
|
||||
}
|
||||
@@ -30,9 +30,9 @@ namespace Emby.Server.Implementations.Sorting
|
||||
/// </summary>
|
||||
/// <param name="x">The x.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
private static int GetValue(BaseItem x)
|
||||
private static int GetValue(BaseItem? x)
|
||||
{
|
||||
return x.IsFolder ? 0 : 1;
|
||||
return x?.IsFolder ?? true ? 0 : 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using Jellyfin.Data.Entities;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using Jellyfin.Data.Entities;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||
/// <param name="x">The x.</param>
|
||||
/// <param name="y">The y.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public int Compare(BaseItem x, BaseItem y)
|
||||
public int Compare(BaseItem? x, BaseItem? y)
|
||||
{
|
||||
if (x == null)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||
/// <param name="x">The x.</param>
|
||||
/// <param name="y">The y.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public int Compare(BaseItem x, BaseItem y)
|
||||
public int Compare(BaseItem? x, BaseItem? y)
|
||||
{
|
||||
if (x == null)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#nullable disable
|
||||
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||
/// <param name="x">The x.</param>
|
||||
/// <param name="y">The y.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public int Compare(BaseItem x, BaseItem y)
|
||||
public int Compare(BaseItem? x, BaseItem? y)
|
||||
{
|
||||
return GetDate(x).CompareTo(GetDate(y));
|
||||
}
|
||||
@@ -26,8 +26,13 @@ namespace Emby.Server.Implementations.Sorting
|
||||
/// </summary>
|
||||
/// <param name="x">The x.</param>
|
||||
/// <returns>DateTime.</returns>
|
||||
private static DateTime GetDate(BaseItem x)
|
||||
private static DateTime GetDate(BaseItem? x)
|
||||
{
|
||||
if (x == null)
|
||||
{
|
||||
return DateTime.MinValue;
|
||||
}
|
||||
|
||||
if (x.PremiereDate.HasValue)
|
||||
{
|
||||
return x.PremiereDate.Value;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||
/// <param name="x">The x.</param>
|
||||
/// <param name="y">The y.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public int Compare(BaseItem x, BaseItem y)
|
||||
public int Compare(BaseItem? x, BaseItem? y)
|
||||
{
|
||||
return GetValue(x).CompareTo(GetValue(y));
|
||||
}
|
||||
@@ -25,8 +25,13 @@ namespace Emby.Server.Implementations.Sorting
|
||||
/// </summary>
|
||||
/// <param name="x">The x.</param>
|
||||
/// <returns>DateTime.</returns>
|
||||
private static int GetValue(BaseItem x)
|
||||
private static int GetValue(BaseItem? x)
|
||||
{
|
||||
if (x == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (x.ProductionYear.HasValue)
|
||||
{
|
||||
return x.ProductionYear.Value;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||
/// <param name="x">The x.</param>
|
||||
/// <param name="y">The y.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public int Compare(BaseItem x, BaseItem y)
|
||||
public int Compare(BaseItem? x, BaseItem? y)
|
||||
{
|
||||
return Guid.NewGuid().CompareTo(Guid.NewGuid());
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Sorting;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Sorting;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
||||
Reference in New Issue
Block a user