using System; using Emby.Naming.Video; namespace Emby.Naming.AudioBook { /// /// Represents a single video file /// public class AudioBookFileInfo : IComparable { /// /// Gets or sets the path. /// /// The path. public string Path { get; set; } /// /// Gets or sets the container. /// /// The container. public string Container { get; set; } /// /// Gets or sets the part number. /// /// The part number. public int? PartNumber { get; set; } /// /// Gets or sets the chapter number. /// /// The chapter number. public int? ChapterNumber { get; set; } /// /// Gets or sets the type. /// /// The type. public bool IsDirectory { get; set; } public int CompareTo(AudioBookFileInfo other) { if (ReferenceEquals(this, other)) return 0; if (ReferenceEquals(null, other)) return 1; var chapterNumberComparison = Nullable.Compare(ChapterNumber, other.ChapterNumber); if (chapterNumberComparison != 0) return chapterNumberComparison; var partNumberComparison = Nullable.Compare(PartNumber, other.PartNumber); if (partNumberComparison != 0) return partNumberComparison; return string.Compare(Path, other.Path, StringComparison.Ordinal); } } }