mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: Use Length/Count property instead of Enumerable.Count method
This commit is contained in:
@@ -194,7 +194,6 @@ dotnet_diagnostic.CA1825.severity = suggestion
|
|||||||
dotnet_diagnostic.CA1826.severity = suggestion
|
dotnet_diagnostic.CA1826.severity = suggestion
|
||||||
dotnet_diagnostic.CA1827.severity = suggestion
|
dotnet_diagnostic.CA1827.severity = suggestion
|
||||||
dotnet_diagnostic.CA1828.severity = suggestion
|
dotnet_diagnostic.CA1828.severity = suggestion
|
||||||
dotnet_diagnostic.CA1829.severity = suggestion
|
|
||||||
dotnet_diagnostic.CA2000.severity = suggestion
|
dotnet_diagnostic.CA2000.severity = suggestion
|
||||||
dotnet_diagnostic.CA2002.severity = suggestion
|
dotnet_diagnostic.CA2002.severity = suggestion
|
||||||
dotnet_diagnostic.CA2007.severity = suggestion
|
dotnet_diagnostic.CA2007.severity = suggestion
|
||||||
|
@@ -147,7 +147,7 @@ namespace NzbDrone.Api
|
|||||||
{
|
{
|
||||||
var defaultDefinitions = _providerFactory.GetDefaultDefinitions().OrderBy(p => p.ImplementationName).ToList();
|
var defaultDefinitions = _providerFactory.GetDefaultDefinitions().OrderBy(p => p.ImplementationName).ToList();
|
||||||
|
|
||||||
var result = new List<TProviderResource>(defaultDefinitions.Count());
|
var result = new List<TProviderResource>(defaultDefinitions.Count);
|
||||||
|
|
||||||
foreach (var providerDefinition in defaultDefinitions)
|
foreach (var providerDefinition in defaultDefinitions)
|
||||||
{
|
{
|
||||||
|
@@ -46,7 +46,7 @@ namespace NzbDrone.Common.Test.Http
|
|||||||
|
|
||||||
TestLogger.Info($"{candidates.Length} TestSites available.");
|
TestLogger.Info($"{candidates.Length} TestSites available.");
|
||||||
|
|
||||||
_httpBinSleep = _httpBinHosts.Count() < 2 ? 100 : 10;
|
_httpBinSleep = _httpBinHosts.Length < 2 ? 100 : 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsTestSiteAvailable(string site)
|
private bool IsTestSiteAvailable(string site)
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
//===============================================================================
|
//===============================================================================
|
||||||
// TinyIoC
|
// TinyIoC
|
||||||
//
|
//
|
||||||
// An easy to use, hassle free, Inversion of Control Container for small projects
|
// An easy to use, hassle free, Inversion of Control Container for small projects
|
||||||
@@ -3488,7 +3488,7 @@ namespace TinyIoC
|
|||||||
//#if NETFX_CORE
|
//#if NETFX_CORE
|
||||||
// return type.GetTypeInfo().DeclaredConstructors.OrderByDescending(ctor => ctor.GetParameters().Count());
|
// return type.GetTypeInfo().DeclaredConstructors.OrderByDescending(ctor => ctor.GetParameters().Count());
|
||||||
//#else
|
//#else
|
||||||
return type.GetConstructors().OrderByDescending(ctor => ctor.GetParameters().Count());
|
return type.GetConstructors().OrderByDescending(ctor => ctor.GetParameters().Length);
|
||||||
|
|
||||||
//#endif
|
//#endif
|
||||||
}
|
}
|
||||||
@@ -3534,9 +3534,9 @@ namespace TinyIoC
|
|||||||
throw new TinyIoCResolutionException(typeToConstruct);
|
throw new TinyIoCResolutionException(typeToConstruct);
|
||||||
|
|
||||||
var ctorParams = constructor.GetParameters();
|
var ctorParams = constructor.GetParameters();
|
||||||
object[] args = new object[ctorParams.Count()];
|
object[] args = new object[ctorParams.Length];
|
||||||
|
|
||||||
for (int parameterIndex = 0; parameterIndex < ctorParams.Count(); parameterIndex++)
|
for (int parameterIndex = 0; parameterIndex < ctorParams.Length; parameterIndex++)
|
||||||
{
|
{
|
||||||
var currentParam = ctorParams[parameterIndex];
|
var currentParam = ctorParams[parameterIndex];
|
||||||
|
|
||||||
|
@@ -170,7 +170,7 @@ namespace NzbDrone.Core.Test.ParserTests
|
|||||||
public void should_not_parse_wrong_language_in_title(string postTitle)
|
public void should_not_parse_wrong_language_in_title(string postTitle)
|
||||||
{
|
{
|
||||||
var parsed = Parser.Parser.ParseMovieTitle(postTitle, true);
|
var parsed = Parser.Parser.ParseMovieTitle(postTitle, true);
|
||||||
parsed.Languages.Count().Should().Be(1);
|
parsed.Languages.Count.Should().Be(1);
|
||||||
parsed.Languages.First().Should().Be(Language.Unknown);
|
parsed.Languages.First().Should().Be(Language.Unknown);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,7 +178,7 @@ namespace NzbDrone.Core.Test.ParserTests
|
|||||||
public void should_not_parse_multi_language_in_releasegroup(string postTitle)
|
public void should_not_parse_multi_language_in_releasegroup(string postTitle)
|
||||||
{
|
{
|
||||||
var parsed = Parser.Parser.ParseMovieTitle(postTitle, true);
|
var parsed = Parser.Parser.ParseMovieTitle(postTitle, true);
|
||||||
parsed.Languages.Count().Should().Be(1);
|
parsed.Languages.Count.Should().Be(1);
|
||||||
parsed.Languages.First().Should().Be(Language.German);
|
parsed.Languages.First().Should().Be(Language.German);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ namespace NzbDrone.Core.Test.ParserTests
|
|||||||
public void should_parse_multi_language(string postTitle)
|
public void should_parse_multi_language(string postTitle)
|
||||||
{
|
{
|
||||||
var parsed = Parser.Parser.ParseMovieTitle(postTitle, true);
|
var parsed = Parser.Parser.ParseMovieTitle(postTitle, true);
|
||||||
parsed.Languages.Count().Should().Be(2);
|
parsed.Languages.Count.Should().Be(2);
|
||||||
parsed.Languages.Should().Contain(Language.German);
|
parsed.Languages.Should().Contain(Language.German);
|
||||||
parsed.Languages.Should().Contain(Language.English, "Added by the multi tag in the release name");
|
parsed.Languages.Should().Contain(Language.English, "Added by the multi tag in the release name");
|
||||||
}
|
}
|
||||||
|
@@ -237,7 +237,7 @@ namespace NzbDrone.Core.Configuration
|
|||||||
|
|
||||||
var valueHolder = parentContainer.Descendants(key).ToList();
|
var valueHolder = parentContainer.Descendants(key).ToList();
|
||||||
|
|
||||||
if (valueHolder.Count() == 1)
|
if (valueHolder.Count == 1)
|
||||||
{
|
{
|
||||||
return valueHolder.First().Value.Trim();
|
return valueHolder.First().Value.Trim();
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd.JsonConverters
|
|||||||
{
|
{
|
||||||
var split = reader.Value.ToString().Split(':').Select(int.Parse).ToArray();
|
var split = reader.Value.ToString().Split(':').Select(int.Parse).ToArray();
|
||||||
|
|
||||||
switch (split.Count())
|
switch (split.Length)
|
||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
return new TimeSpan((split[0] * 24) + split[1], split[2], split[3]);
|
return new TimeSpan((split[0] * 24) + split[1], split[2], split[3]);
|
||||||
|
@@ -107,9 +107,9 @@ namespace NzbDrone.Core.Download.Pending
|
|||||||
_logger.Debug("The release {0} is already pending with reason {1}, not adding again", decision.RemoteMovie, reason);
|
_logger.Debug("The release {0} is already pending with reason {1}, not adding again", decision.RemoteMovie, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matchingReports.Count() > 1)
|
if (matchingReports.Count > 1)
|
||||||
{
|
{
|
||||||
_logger.Debug("The release {0} had {1} duplicate pending, removing duplicates.", decision.RemoteMovie, matchingReports.Count() - 1);
|
_logger.Debug("The release {0} had {1} duplicate pending, removing duplicates.", decision.RemoteMovie, matchingReports.Count - 1);
|
||||||
|
|
||||||
foreach (var duplicate in matchingReports.Skip(1))
|
foreach (var duplicate in matchingReports.Skip(1))
|
||||||
{
|
{
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
@@ -168,7 +168,7 @@ namespace NzbDrone.Core.Indexers.TorrentRss
|
|||||||
releases = ParseResponse(parser, response);
|
releases = ParseResponse(parser, response);
|
||||||
ValidateReleases(releases, indexerSettings);
|
ValidateReleases(releases, indexerSettings);
|
||||||
|
|
||||||
if (releases.Count(r => r.Size >= ValidSizeThreshold) > releases.Count() / 2)
|
if (releases.Count(r => r.Size >= ValidSizeThreshold) > releases.Length / 2)
|
||||||
{
|
{
|
||||||
if (releases.Any(r => r.Size < ValidSizeThreshold))
|
if (releases.Any(r => r.Size < ValidSizeThreshold))
|
||||||
{
|
{
|
||||||
|
@@ -106,7 +106,7 @@ namespace NzbDrone.Core.Jobs
|
|||||||
|
|
||||||
var currentTasks = _scheduledTaskRepository.All().ToList();
|
var currentTasks = _scheduledTaskRepository.All().ToList();
|
||||||
|
|
||||||
_logger.Trace("Initializing jobs. Available: {0} Existing: {1}", defaultTasks.Count(), currentTasks.Count());
|
_logger.Trace("Initializing jobs. Available: {0} Existing: {1}", defaultTasks.Length, currentTasks.Count);
|
||||||
|
|
||||||
foreach (var job in currentTasks)
|
foreach (var job in currentTasks)
|
||||||
{
|
{
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Languages
|
namespace NzbDrone.Core.Languages
|
||||||
@@ -22,27 +22,27 @@ namespace NzbDrone.Core.Languages
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x.Count() > 1 && y.Count() > 1 && x.Count() > y.Count())
|
if (x.Count > 1 && y.Count > 1 && x.Count > y.Count)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x.Count() > 1 && y.Count() > 1 && x.Count() < y.Count())
|
if (x.Count > 1 && y.Count > 1 && x.Count < y.Count)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x.Count() > 1 && y.Count() == 1)
|
if (x.Count > 1 && y.Count == 1)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x.Count() == 1 && y.Count() > 1)
|
if (x.Count == 1 && y.Count > 1)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x.Count() == 1 && y.Count() == 1)
|
if (x.Count == 1 && y.Count == 1)
|
||||||
{
|
{
|
||||||
return x.First().Name.CompareTo(y.First().Name);
|
return x.First().Name.CompareTo(y.First().Name);
|
||||||
}
|
}
|
||||||
|
@@ -492,7 +492,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
|
|||||||
{
|
{
|
||||||
var channelSplit = channel.Split(new string[] { "." }, StringSplitOptions.None);
|
var channelSplit = channel.Split(new string[] { "." }, StringSplitOptions.None);
|
||||||
|
|
||||||
if (channelSplit.Count() == 3)
|
if (channelSplit.Length == 3)
|
||||||
{
|
{
|
||||||
positions += decimal.Parse(string.Format("{0}.{1}", channelSplit[1], channelSplit[2]), CultureInfo.InvariantCulture);
|
positions += decimal.Parse(string.Format("{0}.{1}", channelSplit[1], channelSplit[2]), CultureInfo.InvariantCulture);
|
||||||
}
|
}
|
||||||
|
@@ -61,7 +61,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport
|
|||||||
{
|
{
|
||||||
var newFiles = filterExistingFiles ? _mediaFileService.FilterExistingFiles(videoFiles.ToList(), movie) : videoFiles.ToList();
|
var newFiles = filterExistingFiles ? _mediaFileService.FilterExistingFiles(videoFiles.ToList(), movie) : videoFiles.ToList();
|
||||||
|
|
||||||
_logger.Debug("Analyzing {0}/{1} files.", newFiles.Count, videoFiles.Count());
|
_logger.Debug("Analyzing {0}/{1} files.", newFiles.Count, videoFiles.Count);
|
||||||
|
|
||||||
ParsedMovieInfo downloadClientItemInfo = null;
|
ParsedMovieInfo downloadClientItemInfo = null;
|
||||||
|
|
||||||
|
@@ -68,7 +68,7 @@ namespace NzbDrone.Update
|
|||||||
|
|
||||||
if (OsInfo.IsNotWindows)
|
if (OsInfo.IsNotWindows)
|
||||||
{
|
{
|
||||||
switch (args.Count())
|
switch (args.Length)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
return startupContext;
|
return startupContext;
|
||||||
|
@@ -116,7 +116,7 @@ namespace Radarr.Api.V3
|
|||||||
{
|
{
|
||||||
var defaultDefinitions = _providerFactory.GetDefaultDefinitions().OrderBy(p => p.ImplementationName).ToList();
|
var defaultDefinitions = _providerFactory.GetDefaultDefinitions().OrderBy(p => p.ImplementationName).ToList();
|
||||||
|
|
||||||
var result = new List<TProviderResource>(defaultDefinitions.Count());
|
var result = new List<TProviderResource>(defaultDefinitions.Count);
|
||||||
|
|
||||||
foreach (var providerDefinition in defaultDefinitions)
|
foreach (var providerDefinition in defaultDefinitions)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user