From 6e5d2aadaa17d891b9c4b4f17faf1316f43aaee6 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Fri, 28 Dec 2018 16:48:26 +0100 Subject: [PATCH] Remove custom ToArray extension --- Emby.Dlna/ContentDirectory/ControlHandler.cs | 20 +++++------ Emby.Dlna/Didl/DidlBuilder.cs | 2 +- Emby.Dlna/PlayTo/Device.cs | 2 +- Emby.Dlna/PlayTo/PlayToController.cs | 2 +- Emby.Dlna/Profiles/DefaultProfile.cs | 2 +- Emby.Dlna/Service/BaseControlHandler.cs | 2 +- Emby.Drawing/ImageProcessor.cs | 4 +-- .../Activity/ActivityLogEntryPoint.cs | 2 +- .../Activity/ActivityRepository.cs | 8 ++--- .../ApplicationHost.cs | 2 +- .../Channels/ChannelManager.cs | 8 ++--- .../Collections/CollectionManager.cs | 2 +- .../Data/SqliteItemRepository.cs | 32 ++++++++--------- .../Devices/DeviceManager.cs | 4 +-- Emby.Server.Implementations/Dto/DtoService.cs | 2 +- .../EntryPoints/ExternalPortForwarding.cs | 5 ++- .../EntryPoints/UsageEntryPoint.cs | 2 +- .../HttpServer/HttpListenerHost.cs | 4 +-- .../IO/SharpCifs/Util/Sharpen/Collections.cs | 1 + .../Library/LibraryManager.cs | 2 +- .../Library/SearchEngine.cs | 4 +-- .../Library/UserViewManager.cs | 2 +- .../LiveTv/LiveTvDtoService.cs | 2 +- .../LiveTv/LiveTvManager.cs | 22 ++++++------ .../LiveTv/LiveTvMediaSourceProvider.cs | 2 +- .../Networking/NetworkManager.cs | 2 +- .../Playlists/PlaylistManager.cs | 4 +-- .../ScheduledTasks/ChapterImagesTask.cs | 2 +- .../ScheduledTasks/ScheduledTaskWorker.cs | 5 ++- .../Security/AuthenticationRepository.cs | 4 +-- .../Services/ServiceExec.cs | 4 +-- .../Services/ServicePath.cs | 10 +++--- .../Session/SessionManager.cs | 10 +++--- MediaBrowser.Api/BaseApiService.cs | 4 +-- MediaBrowser.Api/LiveTv/LiveTvService.cs | 4 +-- MediaBrowser.Api/Movies/MoviesService.cs | 12 +++---- MediaBrowser.Api/SimilarItemsHelper.cs | 3 +- .../UserLibrary/BaseItemsByNameService.cs | 2 +- .../UserLibrary/UserViewsService.cs | 2 +- MediaBrowser.Controller/Entities/BaseItem.cs | 35 ++++++------------- .../Entities/CollectionFolder.cs | 2 +- .../Entities/Extensions.cs | 5 +-- MediaBrowser.Controller/Entities/Folder.cs | 4 +-- .../Entities/TagExtensions.cs | 7 +--- .../Parsers/BoxSetXmlParser.cs | 3 +- .../Parsers/PlaylistXmlParser.cs | 2 +- .../Dlna/MediaFormatProfileResolver.cs | 2 +- MediaBrowser.Model/Dlna/StreamInfo.cs | 2 +- MediaBrowser.Model/Entities/MediaStream.cs | 7 ++-- .../Extensions/LinqExtensions.cs | 14 +------- MediaBrowser.Model/Services/HttpUtility.cs | 4 +-- .../Services/QueryParamCollection.cs | 3 +- MediaBrowser.Providers/Manager/ImageSaver.cs | 2 +- .../Manager/ProviderManager.cs | 4 +-- .../Movies/GenericMovieDbInfo.cs | 2 +- .../Movies/MovieDbProvider.cs | 2 +- .../Music/MusicBrainzAlbumProvider.cs | 3 +- .../TV/TheMovieDb/MovieDbSeriesProvider.cs | 2 +- Mono.Nat/Pmp/PmpNatDevice.cs | 2 +- 59 files changed, 137 insertions(+), 178 deletions(-) diff --git a/Emby.Dlna/ContentDirectory/ControlHandler.cs b/Emby.Dlna/ContentDirectory/ControlHandler.cs index 91ec54b55..bf9c48ac7 100644 --- a/Emby.Dlna/ContentDirectory/ControlHandler.cs +++ b/Emby.Dlna/ContentDirectory/ControlHandler.cs @@ -467,7 +467,7 @@ namespace Emby.Dlna.ContentDirectory IsMissing = false, ExcludeItemTypes = new[] { typeof(Game).Name, typeof(Book).Name }, IsFolder = isFolder, - MediaTypes = mediaTypes.ToArray(mediaTypes.Count), + MediaTypes = mediaTypes.ToArray(), DtoOptions = GetDtoOptions() }); } @@ -676,7 +676,7 @@ namespace Emby.Dlna.ContentDirectory return new QueryResult { - Items = list.ToArray(list.Count), + Items = list.ToArray(), TotalRecordCount = list.Count }; } @@ -754,7 +754,7 @@ namespace Emby.Dlna.ContentDirectory return new QueryResult { - Items = list.ToArray(list.Count), + Items = list.ToArray(), TotalRecordCount = list.Count }; } @@ -859,7 +859,7 @@ namespace Emby.Dlna.ContentDirectory return new QueryResult { - Items = list.ToArray(list.Count), + Items = list.ToArray(), TotalRecordCount = list.Count }; } @@ -1026,7 +1026,7 @@ namespace Emby.Dlna.ContentDirectory var result = new QueryResult { TotalRecordCount = genresResult.TotalRecordCount, - Items = genresResult.Items.Select(i => i.Item1).ToArray(genresResult.Items.Length) + Items = genresResult.Items.Select(i => i.Item1).ToArray() }; return ToResult(result); @@ -1044,7 +1044,7 @@ namespace Emby.Dlna.ContentDirectory var result = new QueryResult { TotalRecordCount = genresResult.TotalRecordCount, - Items = genresResult.Items.Select(i => i.Item1).ToArray(genresResult.Items.Length) + Items = genresResult.Items.Select(i => i.Item1).ToArray() }; return ToResult(result); @@ -1062,7 +1062,7 @@ namespace Emby.Dlna.ContentDirectory var result = new QueryResult { TotalRecordCount = artists.TotalRecordCount, - Items = artists.Items.Select(i => i.Item1).ToArray(artists.Items.Length) + Items = artists.Items.Select(i => i.Item1).ToArray() }; return ToResult(result); @@ -1080,7 +1080,7 @@ namespace Emby.Dlna.ContentDirectory var result = new QueryResult { TotalRecordCount = artists.TotalRecordCount, - Items = artists.Items.Select(i => i.Item1).ToArray(artists.Items.Length) + Items = artists.Items.Select(i => i.Item1).ToArray() }; return ToResult(result); @@ -1099,7 +1099,7 @@ namespace Emby.Dlna.ContentDirectory var result = new QueryResult { TotalRecordCount = artists.TotalRecordCount, - Items = artists.Items.Select(i => i.Item1).ToArray(artists.Items.Length) + Items = artists.Items.Select(i => i.Item1).ToArray() }; return ToResult(result); @@ -1247,7 +1247,7 @@ namespace Emby.Dlna.ContentDirectory { var serverItems = result .Select(i => new ServerItem(i)) - .ToArray(result.Length); + .ToArray(); return new QueryResult { diff --git a/Emby.Dlna/Didl/DidlBuilder.cs b/Emby.Dlna/Didl/DidlBuilder.cs index 42727bb92..8d59ea3ff 100644 --- a/Emby.Dlna/Didl/DidlBuilder.cs +++ b/Emby.Dlna/Didl/DidlBuilder.cs @@ -512,7 +512,7 @@ namespace Emby.Dlna.Didl streamInfo = new StreamBuilder(_mediaEncoder, GetStreamBuilderLogger(options)).BuildAudioItem(new AudioOptions { ItemId = audio.Id, - MediaSources = sources.ToArray(sources.Count), + MediaSources = sources.ToArray(), Profile = _profile, DeviceId = deviceId }); diff --git a/Emby.Dlna/PlayTo/Device.cs b/Emby.Dlna/PlayTo/Device.cs index 9a861b8c7..47e3196e1 100644 --- a/Emby.Dlna/PlayTo/Device.cs +++ b/Emby.Dlna/PlayTo/Device.cs @@ -941,7 +941,7 @@ namespace Emby.Dlna.PlayTo if (room != null && !string.IsNullOrWhiteSpace(room.Value)) friendlyNames.Add(room.Value); - deviceProperties.Name = string.Join(" ", friendlyNames.ToArray(friendlyNames.Count)); + deviceProperties.Name = string.Join(" ", friendlyNames.ToArray()); var model = document.Descendants(uPnpNamespaces.ud.GetName("modelName")).FirstOrDefault(); if (model != null) diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.cs index ce22a0af2..2d0d7c99c 100644 --- a/Emby.Dlna/PlayTo/PlayToController.cs +++ b/Emby.Dlna/PlayTo/PlayToController.cs @@ -571,7 +571,7 @@ namespace Emby.Dlna.PlayTo StreamInfo = new StreamBuilder(_mediaEncoder, GetStreamBuilderLogger()).BuildAudioItem(new AudioOptions { ItemId = item.Id, - MediaSources = mediaSources.ToArray(mediaSources.Count), + MediaSources = mediaSources.ToArray(), Profile = profile, DeviceId = deviceId, MaxBitrate = profile.MaxStreamingBitrate, diff --git a/Emby.Dlna/Profiles/DefaultProfile.cs b/Emby.Dlna/Profiles/DefaultProfile.cs index b60a664ba..1295c2f9a 100644 --- a/Emby.Dlna/Profiles/DefaultProfile.cs +++ b/Emby.Dlna/Profiles/DefaultProfile.cs @@ -173,7 +173,7 @@ namespace Emby.Dlna.Profiles Value = value }); - XmlRootAttributes = list.ToArray(list.Count); + XmlRootAttributes = list.ToArray(); } } } diff --git a/Emby.Dlna/Service/BaseControlHandler.cs b/Emby.Dlna/Service/BaseControlHandler.cs index b2b742b10..450941489 100644 --- a/Emby.Dlna/Service/BaseControlHandler.cs +++ b/Emby.Dlna/Service/BaseControlHandler.cs @@ -242,7 +242,7 @@ namespace Emby.Dlna.Service } var originalHeaders = request.Headers; - var headers = string.Join(", ", originalHeaders.Select(i => string.Format("{0}={1}", i.Key, i.Value)).ToArray(originalHeaders.Count)); + var headers = string.Join(", ", originalHeaders.Select(i => string.Format("{0}={1}", i.Key, i.Value)).ToArray()); Logger.Debug("Control request. Headers: {0}", headers); } diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs index eeb5b8f9f..495ba99a6 100644 --- a/Emby.Drawing/ImageProcessor.cs +++ b/Emby.Drawing/ImageProcessor.cs @@ -564,7 +564,7 @@ namespace Emby.Drawing var cacheKeys = imageEnhancers.Select(i => i.GetConfigurationCacheKey(item, imageType)).ToList(); cacheKeys.Add(originalImagePath + dateModified.Ticks); - return string.Join("|", cacheKeys.ToArray(cacheKeys.Count)).GetMD5().ToString("N"); + return string.Join("|", cacheKeys.ToArray()).GetMD5().ToString("N"); } private async Task> GetSupportedImage(string originalImagePath, DateTime dateModified) @@ -919,4 +919,4 @@ namespace Emby.Drawing } } } -} \ No newline at end of file +} diff --git a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs index 079d0af0a..e4b65b58d 100644 --- a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs +++ b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs @@ -466,7 +466,7 @@ namespace Emby.Server.Implementations.Activity { Name = string.Format(_localization.GetLocalizedString("ScheduledTaskFailedWithName"), task.Name), Type = NotificationType.TaskFailed.ToString(), - Overview = string.Join(Environment.NewLine, vals.ToArray(vals.Count)), + Overview = string.Join(Environment.NewLine, vals.ToArray()), ShortOverview = runningTime, Severity = LogSeverity.Error }); diff --git a/Emby.Server.Implementations/Activity/ActivityRepository.cs b/Emby.Server.Implementations/Activity/ActivityRepository.cs index ce9f460ff..7f76d724b 100644 --- a/Emby.Server.Implementations/Activity/ActivityRepository.cs +++ b/Emby.Server.Implementations/Activity/ActivityRepository.cs @@ -189,13 +189,13 @@ namespace Emby.Server.Implementations.Activity var whereTextWithoutPaging = whereClauses.Count == 0 ? string.Empty : - " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count)); + " where " + string.Join(" AND ", whereClauses.ToArray()); if (startIndex.HasValue && startIndex.Value > 0) { var pagingWhereText = whereClauses.Count == 0 ? string.Empty : - " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count)); + " where " + string.Join(" AND ", whereClauses.ToArray()); whereClauses.Add(string.Format("Id NOT IN (SELECT Id FROM ActivityLog {0} ORDER BY DateCreated DESC LIMIT {1})", pagingWhereText, @@ -204,7 +204,7 @@ namespace Emby.Server.Implementations.Activity var whereText = whereClauses.Count == 0 ? string.Empty : - " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count)); + " where " + string.Join(" AND ", whereClauses.ToArray()); commandText += whereText; @@ -249,7 +249,7 @@ namespace Emby.Server.Implementations.Activity result.TotalRecordCount = statement.ExecuteQuery().SelectScalarInt().First(); } - result.Items = list.ToArray(list.Count); + result.Items = list.ToArray(); return result; }, ReadTransactionMode); diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index c6cfe7214..f8dd65bbc 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -728,7 +728,7 @@ namespace Emby.Server.Implementations Logger.Info("ServerId: {0}", SystemId); - var entryPoints = GetExports().ToList(); + var entryPoints = GetExports(); RunEntryPoints(entryPoints, true); Logger.Info("Core startup complete"); diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.cs index e61c5e283..dfc9c3474 100644 --- a/Emby.Server.Implementations/Channels/ChannelManager.cs +++ b/Emby.Server.Implementations/Channels/ChannelManager.cs @@ -239,7 +239,7 @@ namespace Emby.Server.Implementations.Channels all = all.Take(query.Limit.Value).ToList(); } - var returnItems = all.ToArray(all.Count); + var returnItems = all.ToArray(); if (query.RefreshLatestChannelItems) { @@ -1011,7 +1011,7 @@ namespace Emby.Server.Implementations.Channels { item.Name = info.Name; item.Genres = info.Genres.ToArray(); - item.Studios = info.Studios.ToArray(info.Studios.Count); + item.Studios = info.Studios.ToArray(); item.CommunityRating = info.CommunityRating; item.Overview = info.Overview; item.IndexNumber = info.IndexNumber; @@ -1021,7 +1021,7 @@ namespace Emby.Server.Implementations.Channels item.ProviderIds = info.ProviderIds; item.OfficialRating = info.OfficialRating; item.DateCreated = info.DateCreated ?? DateTime.UtcNow; - item.Tags = info.Tags.ToArray(info.Tags.Count); + item.Tags = info.Tags.ToArray(); item.OriginalTitle = info.OriginalTitle; } else if (info.Type == ChannelItemType.Folder && info.FolderType == ChannelFolderType.Container) @@ -1043,7 +1043,7 @@ namespace Emby.Server.Implementations.Channels var hasAlbumArtists = item as IHasAlbumArtist; if (hasAlbumArtists != null) { - hasAlbumArtists.AlbumArtists = info.AlbumArtists.ToArray(info.AlbumArtists.Count); + hasAlbumArtists.AlbumArtists = info.AlbumArtists.ToArray(); } var trailer = item as Trailer; diff --git a/Emby.Server.Implementations/Collections/CollectionManager.cs b/Emby.Server.Implementations/Collections/CollectionManager.cs index 675a726e5..bcfc58ca1 100644 --- a/Emby.Server.Implementations/Collections/CollectionManager.cs +++ b/Emby.Server.Implementations/Collections/CollectionManager.cs @@ -219,7 +219,7 @@ namespace Emby.Server.Implementations.Collections { var newList = collection.LinkedChildren.ToList(); newList.AddRange(list); - collection.LinkedChildren = newList.ToArray(newList.Count); + collection.LinkedChildren = newList.ToArray(); collection.UpdateRatingToItems(linkedChildrenList); diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index c9495c574..50cd69304 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -1148,7 +1148,7 @@ namespace Emby.Server.Implementations.Data } } - item.ImageInfos = list.ToArray(list.Count); + item.ImageInfos = list.ToArray(); } public string ToValueString(ItemImageInfo image) @@ -2566,7 +2566,7 @@ namespace Emby.Server.Implementations.Data excludeIds.Add(item.Id); excludeIds.AddRange(item.ExtraIds); - query.ExcludeItemIds = excludeIds.ToArray(excludeIds.Count); + query.ExcludeItemIds = excludeIds.ToArray(); query.ExcludeProviderIds = item.ProviderIds; } @@ -2587,7 +2587,7 @@ namespace Emby.Server.Implementations.Data list.Add(builder.ToString()); } - return list.ToArray(list.Count); + return list.ToArray(); } private void BindSearchParams(InternalItemsQuery query, IStatement statement) @@ -2666,7 +2666,7 @@ namespace Emby.Server.Implementations.Data if (groups.Count > 0) { - return " Group by " + string.Join(",", groups.ToArray(groups.Count)); + return " Group by " + string.Join(",", groups.ToArray()); } return string.Empty; @@ -2703,7 +2703,7 @@ namespace Emby.Server.Implementations.Data var whereText = whereClauses.Count == 0 ? string.Empty : - " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count)); + " where " + string.Join(" AND ", whereClauses.ToArray()); commandText += whereText; @@ -2761,7 +2761,7 @@ namespace Emby.Server.Implementations.Data var whereText = whereClauses.Count == 0 ? string.Empty : - " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count)); + " where " + string.Join(" AND ", whereClauses.ToArray()); commandText += whereText; @@ -2938,7 +2938,7 @@ namespace Emby.Server.Implementations.Data var returnList = GetItemList(query); return new QueryResult { - Items = returnList.ToArray(returnList.Count), + Items = returnList.ToArray(), TotalRecordCount = returnList.Count }; } @@ -2961,7 +2961,7 @@ namespace Emby.Server.Implementations.Data var whereText = whereClauses.Count == 0 ? string.Empty : - " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count)); + " where " + string.Join(" AND ", whereClauses.ToArray()); var whereTextWithoutPaging = whereText; @@ -3079,7 +3079,7 @@ namespace Emby.Server.Implementations.Data LogQueryTime("GetItems", commandText, now); - result.Items = list.ToArray(list.Count); + result.Items = list.ToArray(); return result; }, ReadTransactionMode); @@ -3227,7 +3227,7 @@ namespace Emby.Server.Implementations.Data var whereText = whereClauses.Count == 0 ? string.Empty : - " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count)); + " where " + string.Join(" AND ", whereClauses.ToArray()); commandText += whereText; @@ -3299,7 +3299,7 @@ namespace Emby.Server.Implementations.Data var whereText = whereClauses.Count == 0 ? string.Empty : - " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count)); + " where " + string.Join(" AND ", whereClauses.ToArray()); commandText += whereText; @@ -3372,7 +3372,7 @@ namespace Emby.Server.Implementations.Data var returnList = GetItemIdsList(query); return new QueryResult { - Items = returnList.ToArray(returnList.Count), + Items = returnList.ToArray(), TotalRecordCount = returnList.Count }; } @@ -3387,7 +3387,7 @@ namespace Emby.Server.Implementations.Data var whereText = whereClauses.Count == 0 ? string.Empty : - " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count)); + " where " + string.Join(" AND ", whereClauses.ToArray()); var whereTextWithoutPaging = whereText; @@ -3495,7 +3495,7 @@ namespace Emby.Server.Implementations.Data LogQueryTime("GetItemIds", commandText, now); - result.Items = list.ToArray(list.Count); + result.Items = list.ToArray(); return result; }, ReadTransactionMode); @@ -3690,7 +3690,7 @@ namespace Emby.Server.Implementations.Data statement.TryBind("@IsMovie", true); } - whereClauses.Add("(" + string.Join(" OR ", programAttribtues.ToArray(programAttribtues.Count)) + ")"); + whereClauses.Add("(" + string.Join(" OR ", programAttribtues.ToArray()) + ")"); } else if (query.IsMovie.HasValue) { @@ -5813,7 +5813,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type { result.TotalRecordCount = list.Count; } - result.Items = list.ToArray(list.Count); + result.Items = list.ToArray(); return result; diff --git a/Emby.Server.Implementations/Devices/DeviceManager.cs b/Emby.Server.Implementations/Devices/DeviceManager.cs index 0fac886ef..5c84590ae 100644 --- a/Emby.Server.Implementations/Devices/DeviceManager.cs +++ b/Emby.Server.Implementations/Devices/DeviceManager.cs @@ -289,7 +289,7 @@ namespace Emby.Server.Implementations.Devices var list = history.FilesUploaded.ToList(); list.Add(file); - history.FilesUploaded = list.ToArray(list.Count); + history.FilesUploaded = list.ToArray(); _json.SerializeToFile(history, path); } @@ -501,4 +501,4 @@ namespace Emby.Server.Implementations.Devices return config.GetConfiguration("devices"); } } -} \ No newline at end of file +} diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs index 437917c45..0831b1075 100644 --- a/Emby.Server.Implementations/Dto/DtoService.cs +++ b/Emby.Server.Implementations/Dto/DtoService.cs @@ -648,7 +648,7 @@ namespace Emby.Server.Implementations.Dto } } - dto.People = list.ToArray(list.Count); + dto.People = list.ToArray(); } /// diff --git a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs index 6801b2823..aa672a1b7 100644 --- a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs +++ b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs @@ -12,7 +12,6 @@ using MediaBrowser.Model.Events; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Threading; using Mono.Nat; -using MediaBrowser.Model.Extensions; using System.Threading; namespace Emby.Server.Implementations.EntryPoints @@ -59,7 +58,7 @@ namespace Emby.Server.Implementations.EntryPoints values.Add(_appHost.EnableHttps.ToString()); values.Add((config.EnableRemoteAccess).ToString()); - return string.Join("|", values.ToArray(values.Count)); + return string.Join("|", values.ToArray()); } void _config_ConfigurationUpdated(object sender, EventArgs e) @@ -316,4 +315,4 @@ namespace Emby.Server.Implementations.EntryPoints } } } -} \ No newline at end of file +} diff --git a/Emby.Server.Implementations/EntryPoints/UsageEntryPoint.cs b/Emby.Server.Implementations/EntryPoints/UsageEntryPoint.cs index 97feb32c0..450764040 100644 --- a/Emby.Server.Implementations/EntryPoints/UsageEntryPoint.cs +++ b/Emby.Server.Implementations/EntryPoints/UsageEntryPoint.cs @@ -58,7 +58,7 @@ namespace Emby.Server.Implementations.EntryPoints session.ApplicationVersion }; - var key = string.Join("_", keys.ToArray(keys.Count)).GetMD5(); + var key = string.Join("_", keys.ToArray()).GetMD5(); ClientInfo info; if (!_apps.TryGetValue(key, out info)) diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs index 0093258e3..70a233c6f 100644 --- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -825,7 +825,7 @@ namespace Emby.Server.Implementations.HttpServer }); } - return routes.ToArray(routes.Count); + return routes.ToArray(); } public Func GetParseFn(Type propertyType) @@ -954,4 +954,4 @@ namespace Emby.Server.Implementations.HttpServer _listener.Start(UrlPrefixes); } } -} \ No newline at end of file +} diff --git a/Emby.Server.Implementations/IO/SharpCifs/Util/Sharpen/Collections.cs b/Emby.Server.Implementations/IO/SharpCifs/Util/Sharpen/Collections.cs index 4432e62fb..8560a2dc2 100644 --- a/Emby.Server.Implementations/IO/SharpCifs/Util/Sharpen/Collections.cs +++ b/Emby.Server.Implementations/IO/SharpCifs/Util/Sharpen/Collections.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; +// TODO: @bond Remove namespace SharpCifs.Util.Sharpen { internal static class Collections diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 17516d6b9..91e58bfcd 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -1493,7 +1493,7 @@ namespace Emby.Server.Implementations.Library return new QueryResult { - Items = list.ToArray(list.Count) + Items = list.ToArray() }; } diff --git a/Emby.Server.Implementations/Library/SearchEngine.cs b/Emby.Server.Implementations/Library/SearchEngine.cs index 7f04ac5bc..a7db46ef2 100644 --- a/Emby.Server.Implementations/Library/SearchEngine.cs +++ b/Emby.Server.Implementations/Library/SearchEngine.cs @@ -161,8 +161,8 @@ namespace Emby.Server.Implementations.Library var searchQuery = new InternalItemsQuery(user) { SearchTerm = searchTerm, - ExcludeItemTypes = excludeItemTypes.ToArray(excludeItemTypes.Count), - IncludeItemTypes = includeItemTypes.ToArray(includeItemTypes.Count), + ExcludeItemTypes = excludeItemTypes.ToArray(), + IncludeItemTypes = includeItemTypes.ToArray(), Limit = query.Limit, IncludeItemsByName = string.IsNullOrEmpty(query.ParentId), ParentId = string.IsNullOrEmpty(query.ParentId) ? Guid.Empty : new Guid(query.ParentId), diff --git a/Emby.Server.Implementations/Library/UserViewManager.cs b/Emby.Server.Implementations/Library/UserViewManager.cs index 42f922710..aae5751de 100644 --- a/Emby.Server.Implementations/Library/UserViewManager.cs +++ b/Emby.Server.Implementations/Library/UserViewManager.cs @@ -354,7 +354,7 @@ namespace Emby.Server.Implementations.Library Limit = limit * 5, IsPlayed = isPlayed, DtoOptions = options, - MediaTypes = mediaTypes.ToArray(mediaTypes.Count) + MediaTypes = mediaTypes.ToArray() }; if (parents.Count == 0) diff --git a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs index 56b3b5e4b..b0ffd057d 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs @@ -139,7 +139,7 @@ namespace Emby.Server.Implementations.LiveTv dto.ProgramId = GetInternalProgramId(info.ProgramId).ToString("N"); } - dto.DayPattern = info.Days == null ? null : GetDayPattern(info.Days.ToArray(info.Days.Count)); + dto.DayPattern = info.Days == null ? null : GetDayPattern(info.Days.ToArray()); FillImages(dto, info.Name, info.SeriesId); diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index 9cdf105d7..2e9679678 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -1140,7 +1140,7 @@ namespace Emby.Server.Implementations.LiveTv var dtoOptions = new DtoOptions(); var fields = dtoOptions.Fields.ToList(); fields.Remove(ItemFields.BasicSyncInfo); - dtoOptions.Fields = fields.ToArray(fields.Count); + dtoOptions.Fields = fields.ToArray(); progress.Report(100); } @@ -1458,16 +1458,16 @@ namespace Emby.Server.Implementations.LiveTv { MediaTypes = new[] { MediaType.Video }, Recursive = true, - AncestorIds = folderIds.ToArray(folderIds.Count), + AncestorIds = folderIds.ToArray(), IsFolder = false, IsVirtualItem = false, Limit = limit, StartIndex = query.StartIndex, OrderBy = new[] { new ValueTuple(ItemSortBy.DateCreated, SortOrder.Descending) }, EnableTotalRecordCount = query.EnableTotalRecordCount, - IncludeItemTypes = includeItemTypes.ToArray(includeItemTypes.Count), - ExcludeItemTypes = excludeItemTypes.ToArray(excludeItemTypes.Count), - Genres = genres.ToArray(genres.Count), + IncludeItemTypes = includeItemTypes.ToArray(), + ExcludeItemTypes = excludeItemTypes.ToArray(), + Genres = genres.ToArray(), DtoOptions = dtoOptions }); @@ -1791,7 +1791,7 @@ namespace Emby.Server.Implementations.LiveTv var returnArray = returnList .OrderBy(i => i.StartDate) - .ToArray(returnList.Count); + .ToArray(); return new QueryResult { @@ -2338,7 +2338,7 @@ namespace Emby.Server.Implementations.LiveTv fields.Remove(ItemFields.CanDownload); fields.Remove(ItemFields.DisplayPreferencesId); fields.Remove(ItemFields.Etag); - options.Fields = fields.ToArray(fields.Count); + options.Fields = fields.ToArray(); } public Folder GetInternalLiveTvFolder(CancellationToken cancellationToken) @@ -2373,7 +2373,7 @@ namespace Emby.Server.Implementations.LiveTv { info.Id = Guid.NewGuid().ToString("N"); list.Add(info); - config.TunerHosts = list.ToArray(list.Count); + config.TunerHosts = list.ToArray(); } else { @@ -2412,7 +2412,7 @@ namespace Emby.Server.Implementations.LiveTv { info.Id = Guid.NewGuid().ToString("N"); list.Add(info); - config.ListingProviders = list.ToArray(list.Count); + config.ListingProviders = list.ToArray(); } else { @@ -2451,7 +2451,7 @@ namespace Emby.Server.Implementations.LiveTv Name = tunerChannelId, Value = providerChannelId }); - listingsProviderInfo.ChannelMappings = list.ToArray(list.Count); + listingsProviderInfo.ChannelMappings = list.ToArray(); } _config.SaveConfiguration("livetv", config); @@ -2602,4 +2602,4 @@ namespace Emby.Server.Implementations.LiveTv return folders.Cast().ToList(); } } -} \ No newline at end of file +} diff --git a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs index 808672d46..26a84a275 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs @@ -106,7 +106,7 @@ namespace Emby.Server.Implementations.LiveTv openKeys.Add(item.GetType().Name); openKeys.Add(item.Id.ToString("N")); openKeys.Add(source.Id ?? string.Empty); - source.OpenToken = string.Join(StreamIdDelimeterString, openKeys.ToArray(openKeys.Count)); + source.OpenToken = string.Join(StreamIdDelimeterString, openKeys.ToArray()); } // Dummy this up so that direct play checks can still run diff --git a/Emby.Server.Implementations/Networking/NetworkManager.cs b/Emby.Server.Implementations/Networking/NetworkManager.cs index 20abaf27c..4699b5bd4 100644 --- a/Emby.Server.Implementations/Networking/NetworkManager.cs +++ b/Emby.Server.Implementations/Networking/NetworkManager.cs @@ -706,7 +706,7 @@ namespace Emby.Server.Implementations.Networking public async Task GetHostAddressesAsync(string host) { var addresses = await Dns.GetHostAddressesAsync(host).ConfigureAwait(false); - return addresses.Select(ToIpAddressInfo).ToArray(addresses.Length); + return addresses.Select(ToIpAddressInfo).ToArray(); } /// diff --git a/Emby.Server.Implementations/Playlists/PlaylistManager.cs b/Emby.Server.Implementations/Playlists/PlaylistManager.cs index e0a6f56ec..1e8d30ab9 100644 --- a/Emby.Server.Implementations/Playlists/PlaylistManager.cs +++ b/Emby.Server.Implementations/Playlists/PlaylistManager.cs @@ -208,7 +208,7 @@ namespace Emby.Server.Implementations.Playlists var newList = playlist.LinkedChildren.ToList(); newList.AddRange(list); - playlist.LinkedChildren = newList.ToArray(newList.Count); + playlist.LinkedChildren = newList.ToArray(); playlist.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None); @@ -290,7 +290,7 @@ namespace Emby.Server.Implementations.Playlists newList.Insert(newIndex, item); } - playlist.LinkedChildren = newList.ToArray(newList.Count); + playlist.LinkedChildren = newList.ToArray(); playlist.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None); diff --git a/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs b/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs index 7a5efded3..8ed2dbaed 100644 --- a/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs +++ b/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs @@ -145,7 +145,7 @@ namespace Emby.Server.Implementations.ScheduledTasks _fileSystem.CreateDirectory(parentPath); - _fileSystem.WriteAllText(failHistoryPath, string.Join("|", previouslyFailedImages.ToArray(previouslyFailedImages.Count))); + _fileSystem.WriteAllText(failHistoryPath, string.Join("|", previouslyFailedImages.ToArray())); } numComplete++; diff --git a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs index f6397b670..eeb38bf54 100644 --- a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs +++ b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs @@ -9,7 +9,6 @@ using MediaBrowser.Common.Events; using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Progress; using MediaBrowser.Model.Events; -using MediaBrowser.Model.Extensions; using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Serialization; @@ -276,7 +275,7 @@ namespace Emby.Server.Implementations.ScheduledTasks get { var triggers = InternalTriggers; - return triggers.Select(i => i.Item1).ToArray(triggers.Length); + return triggers.Select(i => i.Item1).ToArray(); } set { @@ -290,7 +289,7 @@ namespace Emby.Server.Implementations.ScheduledTasks SaveTriggers(triggerList); - InternalTriggers = triggerList.Select(i => new Tuple(i, GetTrigger(i))).ToArray(triggerList.Length); + InternalTriggers = triggerList.Select(i => new Tuple(i, GetTrigger(i))).ToArray(); } } diff --git a/Emby.Server.Implementations/Security/AuthenticationRepository.cs b/Emby.Server.Implementations/Security/AuthenticationRepository.cs index 45f7f1e95..f75eb6364 100644 --- a/Emby.Server.Implementations/Security/AuthenticationRepository.cs +++ b/Emby.Server.Implementations/Security/AuthenticationRepository.cs @@ -241,7 +241,7 @@ namespace Emby.Server.Implementations.Security var whereTextWithoutPaging = whereClauses.Count == 0 ? string.Empty : - " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count)); + " where " + string.Join(" AND ", whereClauses.ToArray()); commandText += whereTextWithoutPaging; @@ -298,7 +298,7 @@ namespace Emby.Server.Implementations.Security } } - result.Items = list.ToArray(list.Count); + result.Items = list.ToArray(); return result; }, ReadTransactionMode); diff --git a/Emby.Server.Implementations/Services/ServiceExec.cs b/Emby.Server.Implementations/Services/ServiceExec.cs index 79b57438c..9516c1e38 100644 --- a/Emby.Server.Implementations/Services/ServiceExec.cs +++ b/Emby.Server.Implementations/Services/ServiceExec.cs @@ -181,7 +181,7 @@ namespace Emby.Server.Implementations.Services } if (reqFilters.Count > 0) - actionCtx.RequestFilters = reqFilters.OrderBy(i => i.Priority).ToArray(reqFilters.Count); + actionCtx.RequestFilters = reqFilters.OrderBy(i => i.Priority).ToArray(); actions.Add(actionCtx); } @@ -220,4 +220,4 @@ namespace Emby.Server.Implementations.Services } } } -} \ No newline at end of file +} diff --git a/Emby.Server.Implementations/Services/ServicePath.cs b/Emby.Server.Implementations/Services/ServicePath.cs index 282269e7b..f0e80c216 100644 --- a/Emby.Server.Implementations/Services/ServicePath.cs +++ b/Emby.Server.Implementations/Services/ServicePath.cs @@ -132,13 +132,13 @@ namespace Emby.Server.Implementations.Services } } - var components = componentsList.ToArray(componentsList.Count); + var components = componentsList.ToArray(); this.TotalComponentsCount = components.Length; this.literalsToMatch = new string[this.TotalComponentsCount]; this.variablesNames = new string[this.TotalComponentsCount]; this.isWildcard = new bool[this.TotalComponentsCount]; - this.componentsWithSeparators = hasSeparators.ToArray(hasSeparators.Count); + this.componentsWithSeparators = hasSeparators.ToArray(); this.PathComponentsCount = this.componentsWithSeparators.Length; string firstLiteralMatch = null; @@ -297,7 +297,7 @@ namespace Emby.Server.Implementations.Services if (mi != null && mi.IsStatic) continue; pis.Add(pi); } - return pis.ToArray(pis.Count); + return pis.ToArray(); } /// @@ -463,7 +463,7 @@ namespace Emby.Server.Implementations.Services } } - withPathInfoParts = totalComponents.ToArray(totalComponents.Count); + withPathInfoParts = totalComponents.ToArray(); return true; } @@ -574,4 +574,4 @@ namespace Emby.Server.Implementations.Services } } } -} \ No newline at end of file +} diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index df7f231c7..a2102dc45 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -1042,7 +1042,7 @@ namespace Emby.Server.Implementations.Session command.PlayCommand = PlayCommand.PlayNow; } - command.ItemIds = items.Select(i => i.Id).ToArray(items.Count); + command.ItemIds = items.Select(i => i.Id).ToArray(); if (user != null) { @@ -1070,7 +1070,7 @@ namespace Emby.Server.Implementations.Session if (episodes.Count > 0) { - command.ItemIds = episodes.Select(i => i.Id).ToArray(episodes.Count); + command.ItemIds = episodes.Select(i => i.Id).ToArray(); } } } @@ -1316,7 +1316,7 @@ namespace Emby.Server.Implementations.Session UserName = user.Name }); - session.AdditionalUsers = list.ToArray(list.Count); + session.AdditionalUsers = list.ToArray(); } } @@ -1345,7 +1345,7 @@ namespace Emby.Server.Implementations.Session var list = session.AdditionalUsers.ToList(); list.Remove(user); - session.AdditionalUsers = list.ToArray(list.Count); + session.AdditionalUsers = list.ToArray(); } } @@ -1669,7 +1669,7 @@ namespace Emby.Server.Implementations.Session fields.Remove(ItemFields.Tags); fields.Remove(ItemFields.ExtraIds); - dtoOptions.Fields = fields.ToArray(fields.Count); + dtoOptions.Fields = fields.ToArray(); _itemInfoDtoOptions = dtoOptions; } diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs index db6af0c4b..e243927a0 100644 --- a/MediaBrowser.Api/BaseApiService.cs +++ b/MediaBrowser.Api/BaseApiService.cs @@ -143,7 +143,7 @@ namespace MediaBrowser.Api { var list = options.Fields.ToList(); list.Add(Model.Querying.ItemFields.RecursiveItemCount); - options.Fields = list.ToArray(list.Count); + options.Fields = list.ToArray(); } if (client.IndexOf("kodi", StringComparison.OrdinalIgnoreCase) != -1 || @@ -156,7 +156,7 @@ namespace MediaBrowser.Api { var list = options.Fields.ToList(); list.Add(Model.Querying.ItemFields.ChildCount); - options.Fields = list.ToArray(list.Count); + options.Fields = list.ToArray(); } } diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs index 510c5f135..06c0c6862 100644 --- a/MediaBrowser.Api/LiveTv/LiveTvService.cs +++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs @@ -974,7 +974,7 @@ namespace MediaBrowser.Api.LiveTv fields.Remove(ItemFields.CanDownload); fields.Remove(ItemFields.DisplayPreferencesId); fields.Remove(ItemFields.Etag); - options.Fields = fields.ToArray(fields.Count); + options.Fields = fields.ToArray(); } public object Get(GetChannel request) @@ -1265,4 +1265,4 @@ namespace MediaBrowser.Api.LiveTv return _liveTvManager.ResetTuner(request.Id, CancellationToken.None); } } -} \ No newline at end of file +} diff --git a/MediaBrowser.Api/Movies/MoviesService.cs b/MediaBrowser.Api/Movies/MoviesService.cs index 711280601..e8d9712de 100644 --- a/MediaBrowser.Api/Movies/MoviesService.cs +++ b/MediaBrowser.Api/Movies/MoviesService.cs @@ -123,7 +123,7 @@ namespace MediaBrowser.Api.Movies var itemsResult = _libraryManager.GetItemList(new InternalItemsQuery(user) { Limit = request.Limit, - IncludeItemTypes = itemTypes.ToArray(itemTypes.Count), + IncludeItemTypes = itemTypes.ToArray(), IsMovie = true, SimilarTo = item, EnableGroupByMetadataKey = true, @@ -177,12 +177,12 @@ namespace MediaBrowser.Api.Movies var likedMovies = _libraryManager.GetItemList(new InternalItemsQuery(user) { - IncludeItemTypes = itemTypes.ToArray(itemTypes.Count), + IncludeItemTypes = itemTypes.ToArray(), IsMovie = true, OrderBy = new[] { ItemSortBy.Random }.Select(i => new ValueTuple(i, SortOrder.Descending)).ToArray(), Limit = 10, IsFavoriteOrLiked = true, - ExcludeItemIds = recentlyPlayedMovies.Select(i => i.Id).ToArray(recentlyPlayedMovies.Count), + ExcludeItemIds = recentlyPlayedMovies.Select(i => i.Id).ToArray(), EnableGroupByMetadataKey = true, ParentId = parentIdGuid, Recursive = true, @@ -265,7 +265,7 @@ namespace MediaBrowser.Api.Movies // Account for duplicates by imdb id, since the database doesn't support this yet Limit = itemLimit + 2, PersonTypes = new[] { PersonType.Director }, - IncludeItemTypes = itemTypes.ToArray(itemTypes.Count), + IncludeItemTypes = itemTypes.ToArray(), IsMovie = true, EnableGroupByMetadataKey = true, DtoOptions = dtoOptions @@ -305,7 +305,7 @@ namespace MediaBrowser.Api.Movies Person = name, // Account for duplicates by imdb id, since the database doesn't support this yet Limit = itemLimit + 2, - IncludeItemTypes = itemTypes.ToArray(itemTypes.Count), + IncludeItemTypes = itemTypes.ToArray(), IsMovie = true, EnableGroupByMetadataKey = true, DtoOptions = dtoOptions @@ -343,7 +343,7 @@ namespace MediaBrowser.Api.Movies var similar = _libraryManager.GetItemList(new InternalItemsQuery(user) { Limit = itemLimit, - IncludeItemTypes = itemTypes.ToArray(itemTypes.Count), + IncludeItemTypes = itemTypes.ToArray(), IsMovie = true, SimilarTo = item, EnableGroupByMetadataKey = true, diff --git a/MediaBrowser.Api/SimilarItemsHelper.cs b/MediaBrowser.Api/SimilarItemsHelper.cs index be9c1a4c5..db5908f76 100644 --- a/MediaBrowser.Api/SimilarItemsHelper.cs +++ b/MediaBrowser.Api/SimilarItemsHelper.cs @@ -11,7 +11,6 @@ using System.Linq; using System.Threading.Tasks; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Services; -using MediaBrowser.Model.Extensions; namespace MediaBrowser.Api { @@ -81,7 +80,7 @@ namespace MediaBrowser.Api var query = new InternalItemsQuery(user) { - IncludeItemTypes = includeTypes.Select(i => i.Name).ToArray(includeTypes.Length), + IncludeItemTypes = includeTypes.Select(i => i.Name).ToArray(), Recursive = true, DtoOptions = dtoOptions }; diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs index fe8b446a1..eee27ac8e 100644 --- a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs +++ b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs @@ -206,7 +206,7 @@ namespace MediaBrowser.Api.UserLibrary return new QueryResult { - Items = dtos.ToArray(result.Items.Length), + Items = dtos.ToArray(), TotalRecordCount = result.TotalRecordCount }; } diff --git a/MediaBrowser.Api/UserLibrary/UserViewsService.cs b/MediaBrowser.Api/UserLibrary/UserViewsService.cs index 5e9270e0b..a65cc18eb 100644 --- a/MediaBrowser.Api/UserLibrary/UserViewsService.cs +++ b/MediaBrowser.Api/UserLibrary/UserViewsService.cs @@ -93,7 +93,7 @@ namespace MediaBrowser.Api.UserLibrary fields.Add(ItemFields.PrimaryImageAspectRatio); fields.Add(ItemFields.DisplayPreferencesId); fields.Remove(ItemFields.BasicSyncInfo); - dtoOptions.Fields = fields.ToArray(fields.Count); + dtoOptions.Fields = fields.ToArray(); var user = _userManager.GetUserById(request.UserId); diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 053ee1b96..e3b5b5117 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1295,7 +1295,7 @@ namespace MediaBrowser.Controller.Entities } } - return string.Join("/", terms.ToArray(terms.Count)); + return string.Join("/", terms.ToArray()); } /// @@ -1536,7 +1536,7 @@ namespace MediaBrowser.Controller.Entities { var newThemeVideos = LoadThemeVideos(fileSystemChildren, options.DirectoryService); - var newThemeVideoIds = newThemeVideos.Select(i => i.Id).ToArray(newThemeVideos.Length); + var newThemeVideoIds = newThemeVideos.Select(i => i.Id).ToArray(); var themeVideosChanged = !item.ThemeVideoIds.SequenceEqual(newThemeVideoIds); @@ -1573,7 +1573,7 @@ namespace MediaBrowser.Controller.Entities private async Task RefreshThemeSongs(BaseItem item, MetadataRefreshOptions options, List fileSystemChildren, CancellationToken cancellationToken) { var newThemeSongs = LoadThemeSongs(fileSystemChildren, options.DirectoryService); - var newThemeSongIds = newThemeSongs.Select(i => i.Id).ToArray(newThemeSongs.Length); + var newThemeSongIds = newThemeSongs.Select(i => i.Id).ToArray(); var themeSongsChanged = !item.ThemeSongIds.SequenceEqual(newThemeSongIds); @@ -2110,9 +2110,8 @@ namespace MediaBrowser.Controller.Entities } else { - var list = current.ToArray(current.Length + 1); - list[list.Length - 1] = name; - Studios = list; + var list = + Studios = current.Concat(new [] { name }).ToArray(); } } } @@ -2252,9 +2251,7 @@ namespace MediaBrowser.Controller.Entities else { var currentCount = ImageInfos.Length; - var newList = ImageInfos.ToArray(currentCount + 1); - newList[currentCount] = image; - ImageInfos = newList; + ImageInfos = ImageInfos.Concat(new [] { image }) .ToArray(); } } @@ -2269,10 +2266,7 @@ namespace MediaBrowser.Controller.Entities if (image == null) { - var currentCount = ImageInfos.Length; - var newList = ImageInfos.ToArray(currentCount + 1); - newList[currentCount] = GetImageInfo(file, type); - ImageInfos = newList; + ImageInfos = ImageInfos.Concat(new [] { GetImageInfo(file, type) }) .ToArray(); } else { @@ -2486,16 +2480,7 @@ namespace MediaBrowser.Controller.Entities if (newImageList.Count > 0) { - var currentCount = ImageInfos.Length; - var newList = ImageInfos.ToArray(currentCount + newImageList.Count); - - foreach (var image in newImageList) - { - newList[currentCount] = GetImageInfo(image, imageType); - currentCount++; - } - - ImageInfos = newList; + ImageInfos = ImageInfos.Concat(newImageList.Select(i => GetImageInfo(i, imageType))).ToArray(); } return imageUpdated || newImageList.Count > 0; @@ -2537,7 +2522,7 @@ namespace MediaBrowser.Controller.Entities var extensions = new List { ".nfo", ".xml", ".srt", ".vtt", ".sub", ".idx", ".txt", ".edl", ".bif", ".smi", ".ttml" }; extensions.AddRange(SupportedImageExtensions); - return FileSystem.GetFiles(FileSystem.GetDirectoryName(Path), extensions.ToArray(extensions.Count), false, false) + return FileSystem.GetFiles(FileSystem.GetDirectoryName(Path), extensions.ToArray(), false, false) .Where(i => System.IO.Path.GetFileNameWithoutExtension(i.FullName).StartsWith(filename, StringComparison.OrdinalIgnoreCase)) .ToList(); } @@ -2776,7 +2761,7 @@ namespace MediaBrowser.Controller.Entities { var list = GetEtagValues(user); - return string.Join("|", list.ToArray(list.Count)).GetMD5().ToString("N"); + return string.Join("|", list.ToArray()).GetMD5().ToString("N"); } protected virtual List GetEtagValues(User user) diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index 8240a68ff..19a8c24b8 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -275,7 +275,7 @@ namespace MediaBrowser.Controller.Entities var changed = !linkedChildren.SequenceEqual(LinkedChildren, new LinkedChildComparer(FileSystem)); - LinkedChildren = linkedChildren.ToArray(linkedChildren.Count); + LinkedChildren = linkedChildren.ToArray(); var folderIds = PhysicalFolderIds; var newFolderIds = physicalFolders.Select(i => i.Id).ToArray(); diff --git a/MediaBrowser.Controller/Entities/Extensions.cs b/MediaBrowser.Controller/Entities/Extensions.cs index c706cf36c..ee135a14e 100644 --- a/MediaBrowser.Controller/Entities/Extensions.cs +++ b/MediaBrowser.Controller/Entities/Extensions.cs @@ -35,10 +35,7 @@ namespace MediaBrowser.Controller.Entities } else { - var list = item.RemoteTrailers.ToArray(item.RemoteTrailers.Length + 1); - list[list.Length - 1] = mediaUrl; - - item.RemoteTrailers = list; + item.RemoteTrailers = item.RemoteTrailers.Concat(new [] { mediaUrl }).ToArray(); } } } diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 8b9aa5fc3..81072b6e7 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -914,7 +914,7 @@ namespace MediaBrowser.Controller.Entities // Try to preserve order return result.OrderBy(i => ids.IndexOf(i.Id)).ToArray(); } - return result.ToArray(result.Count); + return result.ToArray(); } return GetItemsInternal(query).Items; @@ -1608,7 +1608,7 @@ namespace MediaBrowser.Controller.Entities Logger.Info("Shortcut links have changed for {0}", Path); newShortcutLinks.AddRange(LinkedChildren.Where(i => i.Type == LinkedChildType.Manual)); - LinkedChildren = newShortcutLinks.ToArray(newShortcutLinks.Count); + LinkedChildren = newShortcutLinks.ToArray(); return true; } } diff --git a/MediaBrowser.Controller/Entities/TagExtensions.cs b/MediaBrowser.Controller/Entities/TagExtensions.cs index e5d8f35d9..84e61be4f 100644 --- a/MediaBrowser.Controller/Entities/TagExtensions.cs +++ b/MediaBrowser.Controller/Entities/TagExtensions.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.Linq; -using MediaBrowser.Model.Extensions; namespace MediaBrowser.Controller.Entities { @@ -24,10 +22,7 @@ namespace MediaBrowser.Controller.Entities } else { - var list = current.ToArray(current.Length + 1); - list[list.Length - 1] = name; - - item.Tags = list; + item.Tags = current.Concat(new [] { name }).ToArray(); } } } diff --git a/MediaBrowser.LocalMetadata/Parsers/BoxSetXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/BoxSetXmlParser.cs index 33eb75edb..891a3ad3f 100644 --- a/MediaBrowser.LocalMetadata/Parsers/BoxSetXmlParser.cs +++ b/MediaBrowser.LocalMetadata/Parsers/BoxSetXmlParser.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Xml; using MediaBrowser.Model.IO; using MediaBrowser.Model.Xml; -using MediaBrowser.Model.Extensions; namespace MediaBrowser.LocalMetadata.Parsers { @@ -85,7 +84,7 @@ namespace MediaBrowser.LocalMetadata.Parsers } } - item.Item.LinkedChildren = list.ToArray(list.Count); + item.Item.LinkedChildren = list.ToArray(); } public BoxSetXmlParser(ILogger logger, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory, IFileSystem fileSystem) : base(logger, providerManager, xmlReaderSettingsFactory, fileSystem) diff --git a/MediaBrowser.LocalMetadata/Parsers/PlaylistXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/PlaylistXmlParser.cs index 10f46e5a4..8b25dd3bd 100644 --- a/MediaBrowser.LocalMetadata/Parsers/PlaylistXmlParser.cs +++ b/MediaBrowser.LocalMetadata/Parsers/PlaylistXmlParser.cs @@ -95,7 +95,7 @@ namespace MediaBrowser.LocalMetadata.Parsers } } - item.LinkedChildren = list.ToArray(list.Count); + item.LinkedChildren = list.ToArray(); } public PlaylistXmlParser(ILogger logger, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory, IFileSystem fileSystem) : base(logger, providerManager, xmlReaderSettingsFactory, fileSystem) diff --git a/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs b/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs index b6f329387..81d58336b 100644 --- a/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs +++ b/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs @@ -101,7 +101,7 @@ namespace MediaBrowser.Model.Dlna { list.Add(MediaFormatProfile.MPEG_TS_JP_T); } - return list.ToArray(list.Count); + return list.ToArray(); } if (StringHelper.EqualsIgnoreCase(videoCodec, "h264")) { diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs index 46a1cd68b..c927cd31c 100644 --- a/MediaBrowser.Model/Dlna/StreamInfo.cs +++ b/MediaBrowser.Model/Dlna/StreamInfo.cs @@ -186,7 +186,7 @@ namespace MediaBrowser.Model.Dlna list.Add(string.Format("{0}={1}", pair.Name, encodedValue)); } - string queryString = string.Join("&", list.ToArray(list.Count)); + string queryString = string.Join("&", list.ToArray()); return GetUrl(baseUrl, queryString); } diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index fc208459d..35369fbbb 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using System.Collections.Generic; using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Extensions; @@ -104,7 +105,7 @@ namespace MediaBrowser.Model.Entities attributes.Add("Default"); } - return string.Join(" ", attributes.ToArray(attributes.Count)); + return string.Join(" ", attributes.ToArray()); } if (Type == MediaStreamType.Video) @@ -123,7 +124,7 @@ namespace MediaBrowser.Model.Entities attributes.Add(Codec.ToUpper()); } - return string.Join(" ", attributes.ToArray(attributes.Count)); + return string.Join(" ", attributes.ToArray()); } if (Type == MediaStreamType.Subtitle) @@ -154,7 +155,7 @@ namespace MediaBrowser.Model.Entities attributes.Add("Forced"); } - string name = string.Join(" ", attributes.ToArray(attributes.Count)); + string name = string.Join(" ", attributes.ToArray()); return name; } diff --git a/MediaBrowser.Model/Extensions/LinqExtensions.cs b/MediaBrowser.Model/Extensions/LinqExtensions.cs index 09ace42e8..1223e689e 100644 --- a/MediaBrowser.Model/Extensions/LinqExtensions.cs +++ b/MediaBrowser.Model/Extensions/LinqExtensions.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; +// TODO: @bond Remove namespace MediaBrowser.Model.Extensions { // MoreLINQ - Extensions to LINQ to Objects @@ -42,19 +43,6 @@ namespace MediaBrowser.Model.Extensions return source.DistinctBy(keySelector, null); } - public static TSource[] ToArray(this IEnumerable source, int count) - { - if (source == null) throw new ArgumentNullException("source"); - if (count < 0) throw new ArgumentOutOfRangeException("count"); - var array = new TSource[count]; - int i = 0; - foreach (var item in source) - { - array[i++] = item; - } - return array; - } - /// /// Returns all distinct elements of the given source, where "distinctness" /// is determined via a projection and the specified comparer for the projected type. diff --git a/MediaBrowser.Model/Services/HttpUtility.cs b/MediaBrowser.Model/Services/HttpUtility.cs index 5cc0cc37d..f8fd96801 100644 --- a/MediaBrowser.Model/Services/HttpUtility.cs +++ b/MediaBrowser.Model/Services/HttpUtility.cs @@ -2,8 +2,6 @@ using System.Collections; using System.Collections.Generic; using System.Text; -using MediaBrowser.Model.Services; -using MediaBrowser.Model.Extensions; namespace MediaBrowser.Model.Services { @@ -586,7 +584,7 @@ namespace MediaBrowser.Model.Services WriteCharBytes(bytes, ch, e); } - byte[] buf = bytes.ToArray(bytes.Count); + byte[] buf = bytes.ToArray(); bytes = null; return e.GetString(buf, 0, buf.Length); diff --git a/MediaBrowser.Model/Services/QueryParamCollection.cs b/MediaBrowser.Model/Services/QueryParamCollection.cs index 6f8a76598..4dd4303a8 100644 --- a/MediaBrowser.Model/Services/QueryParamCollection.cs +++ b/MediaBrowser.Model/Services/QueryParamCollection.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Extensions; namespace MediaBrowser.Model.Services { @@ -221,7 +220,7 @@ namespace MediaBrowser.Model.Services public override String ToString() { - var vals = this.Select(GetQueryStringValue).ToArray(this.Count); + var vals = this.Select(GetQueryStringValue).ToArray(); return string.Join("&", vals); } diff --git a/MediaBrowser.Providers/Manager/ImageSaver.cs b/MediaBrowser.Providers/Manager/ImageSaver.cs index c4d0c4929..f50dcf1c5 100644 --- a/MediaBrowser.Providers/Manager/ImageSaver.cs +++ b/MediaBrowser.Providers/Manager/ImageSaver.cs @@ -551,7 +551,7 @@ namespace MediaBrowser.Providers.Manager { list.Add(Path.Combine(item.ContainingFolderPath, "extrathumbs", "thumb" + outputIndex.ToString(UsCulture) + extension)); } - return list.ToArray(list.Count); + return list.ToArray(); } if (type == ImageType.Primary) diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.cs index 4c9312b83..8697c7c57 100644 --- a/MediaBrowser.Providers/Manager/ProviderManager.cs +++ b/MediaBrowser.Providers/Manager/ProviderManager.cs @@ -522,7 +522,7 @@ namespace MediaBrowser.Providers.Manager Type = MetadataPluginType.SubtitleFetcher })); - summary.Plugins = pluginList.ToArray(pluginList.Count); + summary.Plugins = pluginList.ToArray(); var supportedImageTypes = imageProviders.OfType() .SelectMany(i => i.GetSupportedImages(dummy)) @@ -1160,4 +1160,4 @@ namespace MediaBrowser.Providers.Manager } } } -} \ No newline at end of file +} diff --git a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs index 8a409f9cf..12f78a950 100644 --- a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs +++ b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs @@ -145,7 +145,7 @@ namespace MediaBrowser.Providers.Movies movie.ProductionLocations = movieData .production_countries .Select(i => i.name) - .ToArray(movieData.production_countries.Count); + .ToArray(); } movie.SetProviderId(MetadataProviders.Tmdb, movieData.id.ToString(_usCulture)); diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs index e68ce19de..e16e6aa8c 100644 --- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs @@ -279,7 +279,7 @@ namespace MediaBrowser.Providers.Movies languages.Add("en"); } - return string.Join(",", languages.ToArray(languages.Count)); + return string.Join(",", languages.ToArray()); } public static string NormalizeLanguage(string language) diff --git a/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs b/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs index c676f9198..d16376426 100644 --- a/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs +++ b/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs @@ -17,7 +17,6 @@ using System.Threading.Tasks; using System.Xml; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Xml; -using MediaBrowser.Model.Extensions; namespace MediaBrowser.Providers.Music { @@ -846,4 +845,4 @@ namespace MediaBrowser.Providers.Music public int throttleMs { get; set; } } } -} \ No newline at end of file +} diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs index 6e9b9b239..7f9465f1c 100644 --- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs +++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs @@ -236,7 +236,7 @@ namespace MediaBrowser.Providers.TV if (seriesInfo.networks != null) { - series.Studios = seriesInfo.networks.Select(i => i.name).ToArray(seriesInfo.networks.Count); + series.Studios = seriesInfo.networks.Select(i => i.name).ToArray(); } if (seriesInfo.genres != null) diff --git a/Mono.Nat/Pmp/PmpNatDevice.cs b/Mono.Nat/Pmp/PmpNatDevice.cs index bf27bfebc..dc0e2c89b 100644 --- a/Mono.Nat/Pmp/PmpNatDevice.cs +++ b/Mono.Nat/Pmp/PmpNatDevice.cs @@ -95,7 +95,7 @@ namespace Mono.Nat.Pmp try { - byte[] buffer = package.ToArray(package.Count); + byte[] buffer = package.ToArray(); int attempt = 0; int delay = PmpConstants.RetryDelay;