public override bool RequiresRefresh() { var changed = base.RequiresRefresh() || _requiresRefresh; if (!changed) { var locations = PhysicalLocations.ToList(); var newLocations = CreateResolveArgs(new DirectoryService(Logger, FileSystem), false).PhysicalLocations.ToList(); if (!locations.SequenceEqual(newLocations)) { changed = true; } } if (!changed) { var folderIds = PhysicalFolderIds.ToList(); var newFolderIds = GetPhysicalFolders(false).Select(i => i.Id).ToList(); if (!folderIds.SequenceEqual(newFolderIds)) { changed = true; } } return(changed); }
private List <LinkedChild> GetLinkedChildrenInternal() { return(LibraryManager.RootFolder.Children .OfType <Folder>() .Where(i => i.Path != null && PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase)) .SelectMany(c => c.LinkedChildren) .ToList()); }
private IEnumerable <BaseItem> GetActualChildren() { return (LibraryManager.RootFolder.Children .OfType <Folder>() .Where(i => i.Path != null && PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase)) .SelectMany(c => c.Children)); }
public IEnumerable <Folder> GetPhysicalParents() { var rootChildren = LibraryManager.RootFolder.Children .OfType <Folder>() .ToList(); return(PhysicalLocations.Where(i => !string.Equals(i, Path, StringComparison.OrdinalIgnoreCase)).SelectMany(i => GetPhysicalParents(i, rootChildren)).DistinctBy(i => i.Id)); }
private IEnumerable <Folder> GetPhysicalFolders(bool enableCache) { if (enableCache) { return(PhysicalFolderIds.Select(i => LibraryManager.GetItemById(i)).OfType <Folder>()); } var rootChildren = LibraryManager.RootFolder.Children .OfType <Folder>() .ToList(); return(PhysicalLocations.Where(i => !string.Equals(i, Path, StringComparison.OrdinalIgnoreCase)).SelectMany(i => GetPhysicalParents(i, rootChildren)).DistinctBy(i => i.Id)); }
private IEnumerable <Folder> GetPhysicalFolders(bool enableCache) { if (enableCache) { return(PhysicalFolderIds.Select(i => LibraryManager.GetItemById(i)).OfType <Folder>()); } var rootChildren = LibraryManager.RootFolder.Children .OfType <Folder>() .ToList(); return(PhysicalLocations.Where(i => !FileSystem.AreEqual(i, Path)).SelectMany(i => GetPhysicalParents(i, rootChildren)).DistinctBy(i => i.Id)); }
public override bool RequiresRefresh() { var changed = base.RequiresRefresh() || _requiresRefresh; if (!changed) { var locations = PhysicalLocations.ToList(); var newLocations = CreateResolveArgs(new DirectoryService(BaseItem.FileSystem), false).PhysicalLocations.ToList(); if (!locations.SequenceEqual(newLocations)) { changed = true; } } return(changed); }
private List <LinkedChild> GetLinkedChildrenInternal() { Dictionary <string, string> locationsDicionary; try { locationsDicionary = PhysicalLocations.Distinct(StringComparer.OrdinalIgnoreCase).ToDictionary(i => i, StringComparer.OrdinalIgnoreCase); } catch (IOException ex) { Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path); return(new List <LinkedChild>()); } return(LibraryManager.RootFolder.Children .OfType <Folder>() .Where(i => i.Path != null && locationsDicionary.ContainsKey(i.Path)) .SelectMany(c => c.LinkedChildren) .ToList()); }
/// <summary> /// Finds an item by path, recursively /// </summary> /// <param name="path">The path.</param> /// <returns>BaseItem.</returns> /// <exception cref="System.ArgumentNullException"></exception> public BaseItem FindByPath(string path) { if (string.IsNullOrEmpty(path)) { throw new ArgumentNullException(); } if (string.Equals(Path, path, StringComparison.OrdinalIgnoreCase)) { return(this); } if (PhysicalLocations.Contains(path, StringComparer.OrdinalIgnoreCase)) { return(this); } return(RecursiveChildren.FirstOrDefault(i => string.Equals(i.Path, path, StringComparison.OrdinalIgnoreCase) || (!i.IsFolder && !i.IsInMixedFolder && string.Equals(i.ContainingFolderPath, path, StringComparison.OrdinalIgnoreCase)) || i.PhysicalLocations.Contains(path, StringComparer.OrdinalIgnoreCase))); }
public IEnumerable <Folder> GetPhysicalParents() { return(LibraryManager.RootFolder.Children .OfType <Folder>() .Where(i => i.Path != null && PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase))); }