/// <summary> /// Gets the linked child. /// </summary> /// <param name="info">The info.</param> /// <returns>BaseItem.</returns> private BaseItem GetLinkedChild(LinkedChild info) { var item = LibraryManager.RootFolder.FindByPath(info.Path); if (item == null) { Logger.Warn("Unable to find linked item at {0}", info.Path); } return(item); }
public static LinkedChild Create(BaseItem item) { var child = new LinkedChild { Path = item.Path, Type = LinkedChildType.Manual }; if (string.IsNullOrEmpty(child.Path)) { child.LibraryItemId = item.Id.ToString("N", CultureInfo.InvariantCulture); } return(child); }
public static LinkedChild Create(BaseItem item) { var child = new LinkedChild { Path = item.Path, Type = LinkedChildType.Manual }; if (string.IsNullOrWhiteSpace(child.Path)) { child.LibraryItemId = item.Id.ToString("N"); } return(child); }
/// <summary> /// Gets the linked child. /// </summary> /// <param name="info">The info.</param> /// <returns>BaseItem.</returns> private BaseItem GetLinkedChild(LinkedChild info) { if (string.IsNullOrEmpty(info.Path)) { throw new ArgumentException("Encountered linked child with empty path."); } var item = LibraryManager.RootFolder.FindByPath(info.Path); if (item == null) { Logger.Warn("Unable to find linked item at {0}", info.Path); } return(item); }
/// <summary> /// Gets the linked child. /// </summary> /// <param name="info">The info.</param> /// <returns>BaseItem.</returns> private BaseItem GetLinkedChild(LinkedChild info) { if (string.IsNullOrEmpty(info.Path)) { throw new ArgumentException("Encountered linked child with empty path."); } BaseItem item = null; // First get using the cached Id if (info.ItemId.HasValue) { if (info.ItemId.Value == Guid.Empty) { return(null); } item = LibraryManager.GetItemById(info.ItemId.Value); } // If still null, search by path if (item == null) { item = LibraryManager.RootFolder.FindByPath(info.Path); } // If still null, log if (item == null) { Logger.Warn("Unable to find linked item at {0}", info.Path); // Don't keep searching over and over info.ItemId = Guid.Empty; } else { // Cache the id for next time info.ItemId = item.Id; } return(item); }
/// <summary> /// Gets the linked child. /// </summary> /// <param name="info">The info.</param> /// <returns>BaseItem.</returns> private BaseItem GetLinkedChild(LinkedChild info) { if (string.IsNullOrEmpty(info.Path)) { throw new ArgumentException("Encountered linked child with empty path."); } BaseItem item = null; // First get using the cached Id if (info.ItemId != Guid.Empty) { item = LibraryManager.GetItemById(info.ItemId); } // If still null, search by path if (item == null) { item = LibraryManager.RootFolder.FindByPath(info.Path); } // If still null, log if (item == null) { Logger.Warn("Unable to find linked item at {0}", info.Path); } else { // Cache the id for next time info.ItemId = item.Id; } return item; }
/// <summary> /// Gets the linked child. /// </summary> /// <param name="info">The info.</param> /// <returns>BaseItem.</returns> private BaseItem GetLinkedChild(LinkedChild info) { var item = LibraryManager.RootFolder.FindByPath(info.Path); if (item == null) { Logger.Warn("Unable to find linked item at {0}", info.Path); } return item; }
/// <summary> /// Gets the linked child. /// </summary> /// <param name="info">The info.</param> /// <returns>BaseItem.</returns> private BaseItem GetLinkedChild(LinkedChild info) { if (string.IsNullOrEmpty(info.Path)) { throw new ArgumentException("Encountered linked child with empty path."); } var item = LibraryManager.RootFolder.FindByPath(info.Path); if (item == null) { Logger.Warn("Unable to find linked item at {0}", info.Path); } return item; }