mirror of
https://github.com/Radarr/Radarr.git
synced 2024-10-05 15:47:20 +02:00
Fixed: Use Length/Count property instead of Enumerable.Count method
This commit is contained in:
parent
088ffc34df
commit
0198c7a3b1
@ -194,7 +194,6 @@ dotnet_diagnostic.CA1825.severity = suggestion
|
||||
dotnet_diagnostic.CA1826.severity = suggestion
|
||||
dotnet_diagnostic.CA1827.severity = suggestion
|
||||
dotnet_diagnostic.CA1828.severity = suggestion
|
||||
dotnet_diagnostic.CA1829.severity = suggestion
|
||||
dotnet_diagnostic.CA2000.severity = suggestion
|
||||
dotnet_diagnostic.CA2002.severity = suggestion
|
||||
dotnet_diagnostic.CA2007.severity = suggestion
|
||||
|
@ -147,7 +147,7 @@ private object GetTemplates()
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ public void FixtureSetUp()
|
||||
|
||||
TestLogger.Info($"{candidates.Length} TestSites available.");
|
||||
|
||||
_httpBinSleep = _httpBinHosts.Count() < 2 ? 100 : 10;
|
||||
_httpBinSleep = _httpBinHosts.Length < 2 ? 100 : 10;
|
||||
}
|
||||
|
||||
private bool IsTestSiteAvailable(string site)
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===============================================================================
|
||||
//===============================================================================
|
||||
// TinyIoC
|
||||
//
|
||||
// An easy to use, hassle free, Inversion of Control Container for small projects
|
||||
@ -3488,7 +3488,7 @@ private IEnumerable<ConstructorInfo> GetTypeConstructors(Type type)
|
||||
//#if NETFX_CORE
|
||||
// return type.GetTypeInfo().DeclaredConstructors.OrderByDescending(ctor => ctor.GetParameters().Count());
|
||||
//#else
|
||||
return type.GetConstructors().OrderByDescending(ctor => ctor.GetParameters().Count());
|
||||
return type.GetConstructors().OrderByDescending(ctor => ctor.GetParameters().Length);
|
||||
|
||||
//#endif
|
||||
}
|
||||
@ -3534,9 +3534,9 @@ private object ConstructType(Type requestedType, Type implementationType, Constr
|
||||
throw new TinyIoCResolutionException(typeToConstruct);
|
||||
|
||||
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];
|
||||
|
||||
|
@ -170,7 +170,7 @@ public void should_parse_edition(string postTitle, string edition)
|
||||
public void should_not_parse_wrong_language_in_title(string postTitle)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ public void should_not_parse_wrong_language_in_title(string postTitle)
|
||||
public void should_not_parse_multi_language_in_releasegroup(string postTitle)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ public void should_not_parse_multi_language_in_releasegroup(string postTitle)
|
||||
public void should_parse_multi_language(string postTitle)
|
||||
{
|
||||
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.English, "Added by the multi tag in the release name");
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ public string GetValue(string key, object defaultValue, bool persist = true)
|
||||
|
||||
var valueHolder = parentContainer.Descendants(key).ToList();
|
||||
|
||||
if (valueHolder.Count() == 1)
|
||||
if (valueHolder.Count == 1)
|
||||
{
|
||||
return valueHolder.First().Value.Trim();
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
|
||||
{
|
||||
var split = reader.Value.ToString().Split(':').Select(int.Parse).ToArray();
|
||||
|
||||
switch (split.Count())
|
||||
switch (split.Length)
|
||||
{
|
||||
case 4:
|
||||
return new TimeSpan((split[0] * 24) + split[1], split[2], split[3]);
|
||||
|
@ -107,9 +107,9 @@ public void AddMany(List<Tuple<DownloadDecision, PendingReleaseReason>> decision
|
||||
_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))
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
@ -168,7 +168,7 @@ private TorrentRssIndexerParserSettings GetGenericTorrentRssParserSettings(Index
|
||||
releases = ParseResponse(parser, response);
|
||||
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))
|
||||
{
|
||||
|
@ -106,7 +106,7 @@ public void Handle(ApplicationStartedEvent message)
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace NzbDrone.Core.Languages
|
||||
@ -22,27 +22,27 @@ public int Compare(List<Language> x, List<Language> y)
|
||||
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;
|
||||
}
|
||||
|
||||
if (x.Count() > 1 && y.Count() > 1 && x.Count() < y.Count())
|
||||
if (x.Count > 1 && y.Count > 1 && x.Count < y.Count)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (x.Count() > 1 && y.Count() == 1)
|
||||
if (x.Count > 1 && y.Count == 1)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (x.Count() == 1 && y.Count() > 1)
|
||||
if (x.Count == 1 && y.Count > 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);
|
||||
}
|
||||
|
@ -492,7 +492,7 @@ public static string FormatVideoCodecLegacy(MediaInfoModel mediaInfo, string sce
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public List<ImportDecision> GetImportDecisions(List<string> videoFiles, Movie mo
|
||||
{
|
||||
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;
|
||||
|
||||
|
@ -68,7 +68,7 @@ private UpdateStartupContext ParseArgs(string[] args)
|
||||
|
||||
if (OsInfo.IsNotWindows)
|
||||
{
|
||||
switch (args.Count())
|
||||
switch (args.Length)
|
||||
{
|
||||
case 1:
|
||||
return startupContext;
|
||||
|
@ -116,7 +116,7 @@ private object GetTemplates()
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user