AudioBookFileInfo.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. 
  2. using System;
  3. using Emby.Naming.Video;
  4. namespace Emby.Naming.AudioBook
  5. {
  6. /// <summary>
  7. /// Represents a single video file
  8. /// </summary>
  9. public class AudioBookFileInfo : IComparable<AudioBookFileInfo>
  10. {
  11. /// <summary>
  12. /// Gets or sets the path.
  13. /// </summary>
  14. /// <value>The path.</value>
  15. public string Path { get; set; }
  16. /// <summary>
  17. /// Gets or sets the container.
  18. /// </summary>
  19. /// <value>The container.</value>
  20. public string Container { get; set; }
  21. /// <summary>
  22. /// Gets or sets the part number.
  23. /// </summary>
  24. /// <value>The part number.</value>
  25. public int? PartNumber { get; set; }
  26. /// <summary>
  27. /// Gets or sets the chapter number.
  28. /// </summary>
  29. /// <value>The chapter number.</value>
  30. public int? ChapterNumber { get; set; }
  31. /// <summary>
  32. /// Gets or sets the type.
  33. /// </summary>
  34. /// <value>The type.</value>
  35. public bool IsDirectory { get; set; }
  36. public int CompareTo(AudioBookFileInfo other)
  37. {
  38. if (ReferenceEquals(this, other)) return 0;
  39. if (ReferenceEquals(null, other)) return 1;
  40. var chapterNumberComparison = Nullable.Compare(ChapterNumber, other.ChapterNumber);
  41. if (chapterNumberComparison != 0) return chapterNumberComparison;
  42. var partNumberComparison = Nullable.Compare(PartNumber, other.PartNumber);
  43. if (partNumberComparison != 0) return partNumberComparison;
  44. return string.Compare(Path, other.Path, StringComparison.Ordinal);
  45. }
  46. }
  47. }