LinkedChildComparer.cs 859 B

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