Merge pull request #8618 from jgriff6/remove-tolists

This commit is contained in:
Bond-009 2022-10-30 14:19:07 +01:00 committed by GitHub
commit 4c61bf1bdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 34 deletions

View File

@ -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));

View File

@ -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);

View File

@ -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));

View File

@ -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);

View File

@ -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)
{

View File

@ -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();

View File

@ -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);
}
}