LinkedChildComparer.cs 823 B

12345678910111213141516171819202122232425262728293031323334
  1. #nullable disable
  2. #pragma warning disable CS1591
  3. using System.Collections.Generic;
  4. using MediaBrowser.Model.IO;
  5. namespace MediaBrowser.Controller.Entities
  6. {
  7. public class LinkedChildComparer : IEqualityComparer<LinkedChild>
  8. {
  9. private readonly IFileSystem _fileSystem;
  10. public LinkedChildComparer(IFileSystem fileSystem)
  11. {
  12. _fileSystem = fileSystem;
  13. }
  14. public bool Equals(LinkedChild x, LinkedChild y)
  15. {
  16. if (x.Type == y.Type)
  17. {
  18. return _fileSystem.AreEqual(x.Path, y.Path);
  19. }
  20. return false;
  21. }
  22. public int GetHashCode(LinkedChild obj)
  23. {
  24. return ((obj.Path ?? string.Empty) + (obj.LibraryItemId ?? string.Empty) + obj.Type).GetHashCode();
  25. }
  26. }
  27. }