AudioBookFileInfo.cs 1.6 KB

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