2
0
Эх сурвалжийг харах

Merge pull request #8618 from jgriff6/remove-tolists

Bond-009 2 жил өмнө
parent
commit
4c61bf1bdb

+ 1 - 2
Emby.Dlna/Eventing/DlnaEventManager.cs

@@ -127,8 +127,7 @@ namespace Emby.Dlna.Eventing
         public Task TriggerEvent(string notificationType, IDictionary<string, string> stateVariables)
         {
             var subs = _subscriptions.Values
-                .Where(i => !i.IsExpired && string.Equals(notificationType, i.NotificationType, StringComparison.OrdinalIgnoreCase))
-                .ToList();
+                .Where(i => !i.IsExpired && string.Equals(notificationType, i.NotificationType, StringComparison.OrdinalIgnoreCase));
 
             var tasks = subs.Select(i => TriggerEvent(i, stateVariables));
 

+ 1 - 2
Emby.Naming/AudioBook/AudioBookListResolver.cs

@@ -36,8 +36,7 @@ namespace Emby.Naming.AudioBook
             // File with empty fullname will be sorted out here.
             var audiobookFileInfos = files
                 .Select(i => _audioBookResolver.Resolve(i.FullName))
-                .OfType<AudioBookFileInfo>()
-                .ToList();
+                .OfType<AudioBookFileInfo>();
 
             var stackResult = StackResolver.ResolveAudioBooks(audiobookFileInfos);
 

+ 1 - 2
Emby.Notifications/NotificationManager.cs

@@ -88,8 +88,7 @@ namespace Emby.Notifications
             string description,
             CancellationToken cancellationToken)
         {
-            users = users.Where(i => IsEnabledForUser(service, i))
-                .ToList();
+            users = users.Where(i => IsEnabledForUser(service, i));
 
             var tasks = users.Select(i => SendNotification(request, service, title, description, i, cancellationToken));
 

+ 4 - 4
Emby.Server.Implementations/Collections/CollectionManager.cs

@@ -232,10 +232,10 @@ namespace Emby.Server.Implementations.Collections
 
             if (list.Count > 0)
             {
-                var newList = collection.LinkedChildren.ToList();
-                newList.AddRange(list);
-                collection.LinkedChildren = newList.ToArray();
-
+                LinkedChild[] newChildren = new LinkedChild[collection.LinkedChildren.Length + list.Count];
+                collection.LinkedChildren.CopyTo(newChildren, 0);
+                list.CopyTo(newChildren, collection.LinkedChildren.Length);
+                collection.LinkedChildren = newChildren;
                 collection.UpdateRatingToItems(linkedChildrenList);
 
                 await collection.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);

+ 1 - 1
Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs

@@ -115,7 +115,7 @@ namespace Emby.Server.Implementations.EntryPoints
             {
             }
 
-            var collectionFolders = _libraryManager.GetCollectionFolders(item).ToList();
+            var collectionFolders = _libraryManager.GetCollectionFolders(item);
 
             foreach (var collectionFolder in collectionFolders)
             {

+ 4 - 16
Emby.Server.Implementations/IO/LibraryMonitor.cs

@@ -79,14 +79,6 @@ namespace Emby.Server.Implementations.IO
             TemporarilyIgnore(path);
         }
 
-        public bool IsPathLocked(string path)
-        {
-            // This method is not used by the core but it used by auto-organize
-
-            var lockedPaths = _tempIgnoredPaths.Keys.ToList();
-            return lockedPaths.Any(i => _fileSystem.AreEqual(i, path) || _fileSystem.ContainsSubPath(i, path));
-        }
-
         public async void ReportFileSystemChangeComplete(string path, bool refreshPath)
         {
             if (string.IsNullOrEmpty(path))
@@ -145,8 +137,7 @@ namespace Emby.Server.Implementations.IO
                 .OfType<Folder>()
                 .SelectMany(f => f.PhysicalLocations)
                 .Distinct(StringComparer.OrdinalIgnoreCase)
-                .OrderBy(i => i)
-                .ToList();
+                .OrderBy(i => i);
 
             foreach (var path in paths)
             {
@@ -372,11 +363,8 @@ namespace Emby.Server.Implementations.IO
 
             var monitorPath = !IgnorePatterns.ShouldIgnore(path);
 
-            // Ignore certain files
-            var tempIgnorePaths = _tempIgnoredPaths.Keys.ToList();
-
-            // If the parent of an ignored path has a change event, ignore that too
-            if (tempIgnorePaths.Any(i =>
+            // Ignore certain files, If the parent of an ignored path has a change event, ignore that too
+            if (_tempIgnoredPaths.Keys.Any(i =>
             {
                 if (_fileSystem.AreEqual(i, path))
                 {
@@ -491,7 +479,7 @@ namespace Emby.Server.Implementations.IO
         {
             lock (_activeRefreshers)
             {
-                foreach (var refresher in _activeRefreshers.ToList())
+                foreach (var refresher in _activeRefreshers)
                 {
                     refresher.Completed -= OnNewRefresherCompleted;
                     refresher.Dispose();

+ 0 - 7
MediaBrowser.Controller/Library/ILibraryMonitor.cs

@@ -34,12 +34,5 @@ namespace MediaBrowser.Controller.Library
         /// </summary>
         /// <param name="path">The path.</param>
         void ReportFileSystemChanged(string path);
-
-        /// <summary>
-        /// Determines whether [is path locked] [the specified path].
-        /// </summary>
-        /// <param name="path">The path.</param>
-        /// <returns><c>true</c> if [is path locked] [the specified path]; otherwise, <c>false</c>.</returns>
-        bool IsPathLocked(string path);
     }
 }