jellyfin/Emby.Naming/AudioBook/AudioBookFileInfo.cs

69 lines
1.8 KiB
C#
Raw Normal View History

2018-09-12 17:26:21 +00:00
using System;
namespace Emby.Naming.AudioBook
{
/// <summary>
/// Represents a single video file
/// </summary>
public class AudioBookFileInfo : IComparable<AudioBookFileInfo>
{
/// <summary>
/// Gets or sets the path.
/// </summary>
/// <value>The path.</value>
public string Path { get; set; }
2019-05-10 18:37:42 +00:00
2018-09-12 17:26:21 +00:00
/// <summary>
/// Gets or sets the container.
/// </summary>
/// <value>The container.</value>
public string Container { get; set; }
2019-05-10 18:37:42 +00:00
2018-09-12 17:26:21 +00:00
/// <summary>
/// Gets or sets the part number.
/// </summary>
/// <value>The part number.</value>
public int? PartNumber { get; set; }
2019-05-10 18:37:42 +00:00
2018-09-12 17:26:21 +00:00
/// <summary>
/// Gets or sets the chapter number.
/// </summary>
/// <value>The chapter number.</value>
public int? ChapterNumber { get; set; }
2019-05-10 18:37:42 +00:00
2018-09-12 17:26:21 +00:00
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>The type.</value>
public bool IsDirectory { get; set; }
2019-05-10 18:37:42 +00:00
/// <inheritdoc/>
2018-09-12 17:26:21 +00:00
public int CompareTo(AudioBookFileInfo other)
{
2019-05-10 18:37:42 +00:00
if (ReferenceEquals(this, other))
{
return 0;
}
if (ReferenceEquals(null, other))
{
return 1;
}
2018-09-12 17:26:21 +00:00
var chapterNumberComparison = Nullable.Compare(ChapterNumber, other.ChapterNumber);
2019-05-10 18:37:42 +00:00
if (chapterNumberComparison != 0)
{
return chapterNumberComparison;
}
2018-09-12 17:26:21 +00:00
var partNumberComparison = Nullable.Compare(PartNumber, other.PartNumber);
2019-05-10 18:37:42 +00:00
if (partNumberComparison != 0)
{
return partNumberComparison;
}
2018-09-12 17:26:21 +00:00
return string.Compare(Path, other.Path, StringComparison.Ordinal);
}
}
}