Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 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());
 }
Ejemplo n.º 3
0
 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));
 }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
        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));
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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());
        }
Ejemplo n.º 9
0
        /// <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)));
        }
Ejemplo n.º 10
0
 public IEnumerable <Folder> GetPhysicalParents()
 {
     return(LibraryManager.RootFolder.Children
            .OfType <Folder>()
            .Where(i => i.Path != null && PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase)));
 }