2
0

LinkedChild.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Runtime.Serialization;
  4. namespace MediaBrowser.Controller.Entities
  5. {
  6. public class LinkedChild
  7. {
  8. public string Path { get; set; }
  9. public LinkedChildType Type { get; set; }
  10. public string ItemName { get; set; }
  11. public string ItemType { get; set; }
  12. public int? ItemYear { get; set; }
  13. /// <summary>
  14. /// Serves as a cache
  15. /// </summary>
  16. [IgnoreDataMember]
  17. public Guid? ItemId { get; set; }
  18. }
  19. public enum LinkedChildType
  20. {
  21. Manual = 0,
  22. Shortcut = 1
  23. }
  24. public class LinkedChildComparer : IEqualityComparer<LinkedChild>
  25. {
  26. public bool Equals(LinkedChild x, LinkedChild y)
  27. {
  28. if (x.Type == y.Type)
  29. {
  30. return string.Equals(x.Path, y.Path, StringComparison.OrdinalIgnoreCase);
  31. }
  32. return false;
  33. }
  34. public int GetHashCode(LinkedChild obj)
  35. {
  36. return (obj.Path + obj.Type).GetHashCode();
  37. }
  38. }
  39. }