LinkedChild.cs 971 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. /// <summary>
  11. /// Serves as a cache
  12. /// </summary>
  13. [IgnoreDataMember]
  14. public Guid ItemId { get; set; }
  15. }
  16. public enum LinkedChildType
  17. {
  18. Manual = 1,
  19. Shortcut = 2
  20. }
  21. public class LinkedChildComparer : IEqualityComparer<LinkedChild>
  22. {
  23. public bool Equals(LinkedChild x, LinkedChild y)
  24. {
  25. if (x.Type == y.Type)
  26. {
  27. return string.Equals(x.Path, y.Path, StringComparison.OrdinalIgnoreCase);
  28. }
  29. return false;
  30. }
  31. public int GetHashCode(LinkedChild obj)
  32. {
  33. return (obj.Path + obj.Type.ToString()).GetHashCode();
  34. }
  35. }
  36. }