LinkedChild.cs 985 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #nullable disable
  2. #pragma warning disable CS1591
  3. using System;
  4. using System.Globalization;
  5. namespace MediaBrowser.Controller.Entities
  6. {
  7. public class LinkedChild
  8. {
  9. public LinkedChild()
  10. {
  11. }
  12. public string Path { get; set; }
  13. public LinkedChildType Type { get; set; }
  14. public string LibraryItemId { get; set; }
  15. /// <summary>
  16. /// Gets or sets the linked item id.
  17. /// </summary>
  18. public Guid? ItemId { get; set; }
  19. public static LinkedChild Create(BaseItem item)
  20. {
  21. ArgumentNullException.ThrowIfNull(item);
  22. var child = new LinkedChild
  23. {
  24. Path = item.Path,
  25. Type = LinkedChildType.Manual
  26. };
  27. if (string.IsNullOrEmpty(child.Path))
  28. {
  29. child.LibraryItemId = item.Id.ToString("N", CultureInfo.InvariantCulture);
  30. }
  31. return child;
  32. }
  33. }
  34. }