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)); }
private IEnumerable <Folder> GetPhysicalParents(string path, List <Folder> rootChildren) { var result = rootChildren .Where(i => FileSystem.AreEqual(i.Path, path)) .ToList(); if (result.Count == 0) { if (LibraryManager.FindByPath(path, true) is Folder folder) { result.Add(folder); } } return(result); }
private static bool ContainsPath(string parent, string path) { return(FileSystem.AreEqual(parent, path) || FileSystem.ContainsSubPath(parent, path)); }