|   |  | 1 |  | using System; | 
|   |  | 2 |  |  | 
|   |  | 3 |  | namespace Emby.Naming.AudioBook | 
|   |  | 4 |  | { | 
|   |  | 5 |  |     /// <summary> | 
|   |  | 6 |  |     /// Represents a single video file. | 
|   |  | 7 |  |     /// </summary> | 
|   |  | 8 |  |     public class AudioBookFileInfo : IComparable<AudioBookFileInfo> | 
|   |  | 9 |  |     { | 
|   |  | 10 |  |         /// <summary> | 
|   |  | 11 |  |         /// Initializes a new instance of the <see cref="AudioBookFileInfo"/> class. | 
|   |  | 12 |  |         /// </summary> | 
|   |  | 13 |  |         /// <param name="path">Path to audiobook file.</param> | 
|   |  | 14 |  |         /// <param name="container">File type.</param> | 
|   |  | 15 |  |         /// <param name="partNumber">Number of part this file represents.</param> | 
|   |  | 16 |  |         /// <param name="chapterNumber">Number of chapter this file represents.</param> | 
|   |  | 17 |  |         public AudioBookFileInfo(string path, string container, int? partNumber = default, int? chapterNumber = default) | 
|   |  | 18 |  |         { | 
|   | 127 | 19 |  |             Path = path; | 
|   | 127 | 20 |  |             Container = container; | 
|   | 127 | 21 |  |             PartNumber = partNumber; | 
|   | 127 | 22 |  |             ChapterNumber = chapterNumber; | 
|   | 127 | 23 |  |         } | 
|   |  | 24 |  |  | 
|   |  | 25 |  |         /// <summary> | 
|   |  | 26 |  |         /// Gets or sets the path. | 
|   |  | 27 |  |         /// </summary> | 
|   |  | 28 |  |         /// <value>The path.</value> | 
|   |  | 29 |  |         public string Path { get; set; } | 
|   |  | 30 |  |  | 
|   |  | 31 |  |         /// <summary> | 
|   |  | 32 |  |         /// Gets or sets the container. | 
|   |  | 33 |  |         /// </summary> | 
|   |  | 34 |  |         /// <value>The container.</value> | 
|   |  | 35 |  |         public string Container { get; set; } | 
|   |  | 36 |  |  | 
|   |  | 37 |  |         /// <summary> | 
|   |  | 38 |  |         /// Gets or sets the part number. | 
|   |  | 39 |  |         /// </summary> | 
|   |  | 40 |  |         /// <value>The part number.</value> | 
|   |  | 41 |  |         public int? PartNumber { get; set; } | 
|   |  | 42 |  |  | 
|   |  | 43 |  |         /// <summary> | 
|   |  | 44 |  |         /// Gets or sets the chapter number. | 
|   |  | 45 |  |         /// </summary> | 
|   |  | 46 |  |         /// <value>The chapter number.</value> | 
|   |  | 47 |  |         public int? ChapterNumber { get; set; } | 
|   |  | 48 |  |  | 
|   |  | 49 |  |         /// <inheritdoc /> | 
|   |  | 50 |  |         public int CompareTo(AudioBookFileInfo? other) | 
|   |  | 51 |  |         { | 
|   | 28 | 52 |  |             if (ReferenceEquals(this, other)) | 
|   |  | 53 |  |             { | 
|   | 1 | 54 |  |                 return 0; | 
|   |  | 55 |  |             } | 
|   |  | 56 |  |  | 
|   | 27 | 57 |  |             if (ReferenceEquals(null, other)) | 
|   |  | 58 |  |             { | 
|   | 1 | 59 |  |                 return 1; | 
|   |  | 60 |  |             } | 
|   |  | 61 |  |  | 
|   | 26 | 62 |  |             var chapterNumberComparison = Nullable.Compare(ChapterNumber, other.ChapterNumber); | 
|   | 26 | 63 |  |             if (chapterNumberComparison != 0) | 
|   |  | 64 |  |             { | 
|   | 7 | 65 |  |                 return chapterNumberComparison; | 
|   |  | 66 |  |             } | 
|   |  | 67 |  |  | 
|   | 19 | 68 |  |             var partNumberComparison = Nullable.Compare(PartNumber, other.PartNumber); | 
|   | 19 | 69 |  |             if (partNumberComparison != 0) | 
|   |  | 70 |  |             { | 
|   | 7 | 71 |  |                 return partNumberComparison; | 
|   |  | 72 |  |             } | 
|   |  | 73 |  |  | 
|   | 12 | 74 |  |             return string.Compare(Path, other.Path, StringComparison.Ordinal); | 
|   |  | 75 |  |         } | 
|   |  | 76 |  |     } | 
|   |  | 77 |  | } |