Avoid unnecessary zero-length array allocations

pull/5493/head
Qstick 1 year ago
parent b2c2c79a96
commit 0ed8ba828d

@ -194,7 +194,6 @@ dotnet_diagnostic.CA1819.severity = suggestion
dotnet_diagnostic.CA1822.severity = suggestion
dotnet_diagnostic.CA1823.severity = suggestion
dotnet_diagnostic.CA1824.severity = suggestion
dotnet_diagnostic.CA1825.severity = suggestion
dotnet_diagnostic.CA1826.severity = suggestion
dotnet_diagnostic.CA1827.severity = suggestion
dotnet_diagnostic.CA1829.severity = suggestion

@ -1,3 +1,4 @@
using System;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Common.EnvironmentInfo;
@ -11,7 +12,7 @@ namespace NzbDrone.Common.Test.EnvironmentTests
[Test]
public void empty_array_should_return_empty_flags()
{
var args = new StartupContext(new string[0]);
var args = new StartupContext(Array.Empty<string>());
args.Flags.Should().BeEmpty();
}

@ -102,7 +102,7 @@ namespace NzbDrone.Common.Test.Http
Mocker.SetConstant<ICertificateValidationService>(new X509CertificateValidationService(Mocker.GetMock<IConfigService>().Object, TestLogger));
Mocker.SetConstant<IRateLimitService>(Mocker.Resolve<RateLimitService>());
Mocker.SetConstant<IEnumerable<IHttpRequestInterceptor>>(new IHttpRequestInterceptor[0]);
Mocker.SetConstant<IEnumerable<IHttpRequestInterceptor>>(Array.Empty<IHttpRequestInterceptor>());
Mocker.SetConstant<IHttpDispatcher>(Mocker.Resolve<TDispatcher>());
// Used for manual testing of socks proxies.
@ -459,7 +459,7 @@ namespace NzbDrone.Common.Test.Http
var oldRequest = new HttpRequest($"https://{_httpBinHost2}/get");
oldRequest.Cookies["my"] = "cookie";
var oldClient = new HttpClient(new IHttpRequestInterceptor[0], Mocker.Resolve<ICacheManager>(), Mocker.Resolve<IRateLimitService>(), Mocker.Resolve<IHttpDispatcher>(), Mocker.GetMock<IUserAgentBuilder>().Object, Mocker.Resolve<Logger>());
var oldClient = new HttpClient(Array.Empty<IHttpRequestInterceptor>(), Mocker.Resolve<ICacheManager>(), Mocker.Resolve<IRateLimitService>(), Mocker.Resolve<IHttpDispatcher>(), Mocker.GetMock<IUserAgentBuilder>().Object, Mocker.Resolve<Logger>());
oldClient.Should().NotBeSameAs(Subject);

@ -60,7 +60,7 @@ namespace NzbDrone.Common.Http
public string[] GetCookieHeaders()
{
return Headers.GetValues("Set-Cookie") ?? new string[0];
return Headers.GetValues("Set-Cookie") ?? Array.Empty<string>();
}
public Dictionary<string, string> GetCookies()

@ -89,7 +89,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DelugeTests
Mocker.GetMock<IHttpClient>()
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0]));
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Array.Empty<byte>()));
}
protected void GivenFailedDownload()

@ -35,7 +35,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
Mocker.GetMock<IHttpClient>()
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0]));
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Array.Empty<byte>()));
Mocker.GetMock<IRemotePathMappingService>()
.Setup(v => v.RemapRemoteToLocal(It.IsAny<string>(), It.IsAny<OsPath>()))

@ -277,7 +277,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
Mocker.GetMock<IHttpClient>()
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0]));
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Array.Empty<byte>()));
_downloadStationConfigItems = new Dictionary<string, object>
{

@ -170,7 +170,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
Mocker.GetMock<IHttpClient>()
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0]));
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Array.Empty<byte>()));
_downloadStationConfigItems = new Dictionary<string, object>
{

@ -79,7 +79,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.FreeboxDownloadTests
Mocker.GetMock<IHttpClient>()
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0]));
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Array.Empty<byte>()));
}
protected void GivenCategory()

@ -86,7 +86,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.HadoukenTests
Mocker.GetMock<IHttpClient>()
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0]));
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Array.Empty<byte>()));
}
protected void GivenFailedDownload()

@ -38,7 +38,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
Mocker.GetMock<IHttpClient>()
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0]));
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Array.Empty<byte>()));
Mocker.GetMock<IQBittorrentProxy>()
.Setup(s => s.GetConfig(It.IsAny<QBittorrentSettings>()))
@ -56,7 +56,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
Mocker.GetMock<IHttpClient>()
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
.Returns<HttpRequest>(r => new HttpResponse(r, httpHeader, new byte[0], System.Net.HttpStatusCode.SeeOther));
.Returns<HttpRequest>(r => new HttpResponse(r, httpHeader, Array.Empty<byte>(), System.Net.HttpStatusCode.SeeOther));
}
protected void GivenRedirectToTorrent()
@ -66,7 +66,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
Mocker.GetMock<IHttpClient>()
.Setup(s => s.Get(It.Is<HttpRequest>(h => h.Url.FullUri == _downloadUrl)))
.Returns<HttpRequest>(r => new HttpResponse(r, httpHeader, new byte[0], System.Net.HttpStatusCode.Found));
.Returns<HttpRequest>(r => new HttpResponse(r, httpHeader, Array.Empty<byte>(), System.Net.HttpStatusCode.Found));
}
protected void GivenFailedDownload()
@ -523,7 +523,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
Mocker.GetMock<IQBittorrentProxy>()
.Setup(v => v.MoveTorrentToTopInQueue(It.IsAny<string>(), It.IsAny<QBittorrentSettings>()))
.Throws(new HttpException(new HttpResponse(new HttpRequest("http://me.local/"), new HttpHeader(), new byte[0], System.Net.HttpStatusCode.Forbidden)));
.Throws(new HttpException(new HttpResponse(new HttpRequest("http://me.local/"), new HttpHeader(), Array.Empty<byte>(), System.Net.HttpStatusCode.Forbidden)));
var remoteEpisode = CreateRemoteEpisode();

@ -545,7 +545,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
public void should_test_failed_if_tv_sorting_empty()
{
_config.Misc.enable_tv_sorting = true;
_config.Misc.tv_categories = new string[0];
_config.Misc.tv_categories = Array.Empty<string>();
var result = new NzbDroneValidationResult(Subject.Test());

@ -99,7 +99,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests
Mocker.GetMock<IHttpClient>()
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0]));
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Array.Empty<byte>()));
_transmissionConfigItems = new Dictionary<string, object>();

@ -91,7 +91,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests
Mocker.GetMock<IHttpClient>()
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0]));
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Array.Empty<byte>()));
}
protected void GivenRedirectToMagnet()
@ -101,7 +101,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests
Mocker.GetMock<IHttpClient>()
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
.Returns<HttpRequest>(r => new HttpResponse(r, httpHeader, new byte[0], System.Net.HttpStatusCode.SeeOther));
.Returns<HttpRequest>(r => new HttpResponse(r, httpHeader, Array.Empty<byte>(), System.Net.HttpStatusCode.SeeOther));
}
protected void GivenRedirectToTorrent()
@ -111,7 +111,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests
Mocker.GetMock<IHttpClient>()
.Setup(s => s.Get(It.Is<HttpRequest>(h => h.Url.ToString() == _downloadUrl)))
.Returns<HttpRequest>(r => new HttpResponse(r, httpHeader, new byte[0], System.Net.HttpStatusCode.Found));
.Returns<HttpRequest>(r => new HttpResponse(r, httpHeader, Array.Empty<byte>(), System.Net.HttpStatusCode.Found));
}
protected void GivenFailedDownload()

@ -132,7 +132,7 @@ namespace NzbDrone.Core.Test.Download
public void Download_report_should_trigger_indexer_backoff_on_http429_with_long_time()
{
var request = new HttpRequest("http://my.indexer.com");
var response = new HttpResponse(request, new HttpHeader(), new byte[0], (HttpStatusCode)429);
var response = new HttpResponse(request, new HttpHeader(), Array.Empty<byte>(), (HttpStatusCode)429);
response.Headers["Retry-After"] = "300";
var mock = WithUsenetClient();
@ -152,7 +152,7 @@ namespace NzbDrone.Core.Test.Download
public void Download_report_should_trigger_indexer_backoff_on_http429_based_on_date()
{
var request = new HttpRequest("http://my.indexer.com");
var response = new HttpResponse(request, new HttpHeader(), new byte[0], (HttpStatusCode)429);
var response = new HttpResponse(request, new HttpHeader(), Array.Empty<byte>(), (HttpStatusCode)429);
response.Headers["Retry-After"] = DateTime.UtcNow.AddSeconds(300).ToString("r");
var mock = WithUsenetClient();

@ -26,7 +26,7 @@ namespace NzbDrone.Core.Test.Framework
Mocker.SetConstant<ICreateManagedWebProxy>(new ManagedWebProxyFactory(Mocker.Resolve<CacheManager>()));
Mocker.SetConstant<ICertificateValidationService>(new X509CertificateValidationService(Mocker.Resolve<ConfigService>(), TestLogger));
Mocker.SetConstant<IHttpDispatcher>(new ManagedHttpDispatcher(Mocker.Resolve<IHttpProxySettingsProvider>(), Mocker.Resolve<ICreateManagedWebProxy>(), Mocker.Resolve<ICertificateValidationService>(), Mocker.Resolve<UserAgentBuilder>(), Mocker.Resolve<CacheManager>(), TestLogger));
Mocker.SetConstant<IHttpClient>(new HttpClient(new IHttpRequestInterceptor[0], Mocker.Resolve<CacheManager>(), Mocker.Resolve<RateLimitService>(), Mocker.Resolve<IHttpDispatcher>(), Mocker.Resolve<UserAgentBuilder>(), TestLogger));
Mocker.SetConstant<IHttpClient>(new HttpClient(Array.Empty<IHttpRequestInterceptor>(), Mocker.Resolve<CacheManager>(), Mocker.Resolve<RateLimitService>(), Mocker.Resolve<IHttpDispatcher>(), Mocker.Resolve<UserAgentBuilder>(), TestLogger));
Mocker.SetConstant<ISonarrCloudRequestBuilder>(new SonarrCloudRequestBuilder());
}
}

@ -16,7 +16,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
{
Mocker.GetMock<IProvideDownloadClient>()
.Setup(s => s.GetDownloadClients())
.Returns(new IDownloadClient[0]);
.Returns(Array.Empty<IDownloadClient>());
Subject.Check().ShouldBeWarning();
}

@ -76,7 +76,7 @@ namespace NzbDrone.Core.Test.IndexerTests.BroadcastheNetTests
{
Mocker.GetMock<IHttpClient>()
.Setup(v => v.Execute(It.IsAny<HttpRequest>()))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0], System.Net.HttpStatusCode.BadRequest));
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Array.Empty<byte>(), System.Net.HttpStatusCode.BadRequest));
var results = Subject.FetchRecent();
@ -92,7 +92,7 @@ namespace NzbDrone.Core.Test.IndexerTests.BroadcastheNetTests
{
Mocker.GetMock<IHttpClient>()
.Setup(v => v.Execute(It.IsAny<HttpRequest>()))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0], System.Net.HttpStatusCode.Unauthorized));
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Array.Empty<byte>(), System.Net.HttpStatusCode.Unauthorized));
var results = Subject.FetchRecent();
@ -108,7 +108,7 @@ namespace NzbDrone.Core.Test.IndexerTests.BroadcastheNetTests
{
Mocker.GetMock<IHttpClient>()
.Setup(v => v.Execute(It.IsAny<HttpRequest>()))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0], System.Net.HttpStatusCode.NotFound));
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Array.Empty<byte>(), System.Net.HttpStatusCode.NotFound));
var results = Subject.FetchRecent();
@ -124,7 +124,7 @@ namespace NzbDrone.Core.Test.IndexerTests.BroadcastheNetTests
{
Mocker.GetMock<IHttpClient>()
.Setup(v => v.Execute(It.IsAny<HttpRequest>()))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0], System.Net.HttpStatusCode.ServiceUnavailable));
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Array.Empty<byte>(), System.Net.HttpStatusCode.ServiceUnavailable));
var results = Subject.FetchRecent();

@ -115,7 +115,7 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
public void should_record_indexer_failure_if_caps_throw()
{
var request = new HttpRequest("http://my.indexer.com");
var response = new HttpResponse(request, new HttpHeader(), new byte[0], (HttpStatusCode)429);
var response = new HttpResponse(request, new HttpHeader(), Array.Empty<byte>(), (HttpStatusCode)429);
response.Headers["Retry-After"] = "300";
Mocker.GetMock<INewznabCapabilitiesProvider>()

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@ -91,7 +92,7 @@ namespace NzbDrone.Core.Test.MediaFiles
private void WasImportedResponse()
{
Mocker.GetMock<IDiskScanService>().Setup(c => c.GetVideoFiles(It.IsAny<string>(), It.IsAny<bool>()))
.Returns(new string[0]);
.Returns(Array.Empty<string>());
}
[Test]
@ -140,7 +141,7 @@ namespace NzbDrone.Core.Test.MediaFiles
Mocker.GetMock<IDiskScanService>()
.Setup(c => c.GetVideoFiles(It.IsAny<string>(), It.IsAny<bool>()))
.Returns(new string[0]);
.Returns(Array.Empty<string>());
Subject.ProcessRootFolder(new DirectoryInfo(_droneFactory));

@ -1,3 +1,4 @@
using System;
using System.Linq;
using FizzWare.NBuilder;
using FluentAssertions;
@ -84,7 +85,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
public void should_should_be_accepted_for_full_season()
{
_localEpisode.Path = @"C:\Test\Unsorted\Series.Title.S01\S01E01.mkv".AsOsAgnostic();
_localEpisode.FolderEpisodeInfo.EpisodeNumbers = new int[0];
_localEpisode.FolderEpisodeInfo.EpisodeNumbers = Array.Empty<int>();
_localEpisode.FolderEpisodeInfo.FullSeason = true;
GivenEpisodes(_localEpisode.FileEpisodeInfo, _localEpisode.FileEpisodeInfo.EpisodeNumbers);

@ -1,3 +1,4 @@
using System;
using FizzWare.NBuilder;
using FluentAssertions;
using NUnit.Framework;
@ -104,9 +105,9 @@ namespace NzbDrone.Core.Test.NotificationTests.EmailTests
[Test]
public void should_not_be_valid_if_to_bcc_cc_are_all_empty()
{
_emailSettings.To = new string[] { };
_emailSettings.Cc = new string[] { };
_emailSettings.Bcc = new string[] { };
_emailSettings.To = Array.Empty<string>();
_emailSettings.Cc = Array.Empty<string>();
_emailSettings.Bcc = Array.Empty<string>();
_validator.Validate(_emailSettings).IsValid.Should().BeFalse();
}

@ -42,7 +42,7 @@ namespace NzbDrone.Core.Test.ParserTests.ParsingServiceTests
SeriesTitle = _series.Title,
SeasonNumber = 1,
EpisodeNumbers = new[] { 1 },
AbsoluteEpisodeNumbers = new int[0],
AbsoluteEpisodeNumbers = Array.Empty<int>(),
Languages = new List<Language> { Language.English }
};
@ -282,7 +282,7 @@ namespace NzbDrone.Core.Test.ParserTests.ParsingServiceTests
{
GivenAbsoluteNumberingSeries();
_parsedEpisodeInfo.SeasonNumber = seasonNumber;
_parsedEpisodeInfo.EpisodeNumbers = new int[] { };
_parsedEpisodeInfo.EpisodeNumbers = Array.Empty<int>();
Mocker.GetMock<IEpisodeService>()
.Setup(s => s.FindEpisodesBySceneNumbering(It.IsAny<int>(), seasonNumber, It.IsAny<int>()))
@ -303,7 +303,7 @@ namespace NzbDrone.Core.Test.ParserTests.ParsingServiceTests
{
GivenAbsoluteNumberingSeries();
_parsedEpisodeInfo.SeasonNumber = seasonNumber;
_parsedEpisodeInfo.EpisodeNumbers = new int[] { };
_parsedEpisodeInfo.EpisodeNumbers = Array.Empty<int>();
Mocker.GetMock<IEpisodeService>()
.Setup(s => s.FindEpisodesBySceneNumbering(It.IsAny<int>(), seasonNumber, It.IsAny<int>()))

@ -192,7 +192,7 @@ namespace NzbDrone.Core.DecisionEngine
private DownloadDecision GetDecisionForReport(RemoteEpisode remoteEpisode, SearchCriteriaBase searchCriteria = null)
{
var reasons = new Rejection[0];
var reasons = Array.Empty<Rejection>();
foreach (var specifications in _specifications.GroupBy(v => v.Priority).OrderBy(v => v.Key))
{

@ -354,7 +354,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge
{
if (result.Torrents == null)
{
return new DelugeTorrent[0];
return Array.Empty<DelugeTorrent>();
}
return result.Torrents.Values.ToArray();

@ -112,7 +112,7 @@ namespace NzbDrone.Core.Download.Clients.Hadouken
{
if (torrentsRaw == null)
{
return new HadoukenTorrent[0];
return Array.Empty<HadoukenTorrent>();
}
var torrents = new List<HadoukenTorrent>();

@ -1,4 +1,5 @@
using NzbDrone.Core.Indexers;
using System;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.Download.TrackedDownloads
@ -18,7 +19,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads
public TrackedDownload()
{
StatusMessages = new TrackedDownloadStatusMessage[] { };
StatusMessages = Array.Empty<TrackedDownloadStatusMessage>();
}
public void Warn(string message, params object[] args)

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using FluentValidation;
using NzbDrone.Core.Annotations;
@ -22,9 +23,9 @@ namespace NzbDrone.Core.ImportLists.Sonarr
{
BaseUrl = "";
ApiKey = "";
ProfileIds = new int[] { };
LanguageProfileIds = new int[] { };
TagIds = new int[] { };
ProfileIds = Array.Empty<int>();
LanguageProfileIds = Array.Empty<int>();
TagIds = Array.Empty<int>();
}
[FieldDefinition(0, Label = "Full URL", HelpText = "URL, including port, of the Sonarr V3 instance to import from")]

@ -1,4 +1,5 @@
using System.Collections.Concurrent;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using FluentValidation;
@ -36,7 +37,7 @@ namespace NzbDrone.Core.Indexers.FileList
(int)FileListCategories.TV_4K
};
AnimeCategories = new int[0];
AnimeCategories = Array.Empty<int>();
}
[FieldDefinition(0, Label = "Username", Privacy = PrivacyLevel.UserName)]

@ -51,7 +51,7 @@ namespace NzbDrone.Core.Indexers.Newznab
yield return GetDefinition("OZnzb.com", GetSettings("https://api.oznzb.com"));
yield return GetDefinition("SimplyNZBs", GetSettings("https://simplynzbs.com"));
yield return GetDefinition("Tabula Rasa", GetSettings("https://www.tabula-rasa.pw", apiPath: @"/api/v1/api"));
yield return GetDefinition("AnimeTosho Usenet", GetSettings("https://feed.animetosho.org", apiPath: @"/nabapi", categories: new int[0], animeCategories: new[] { 5070 }));
yield return GetDefinition("AnimeTosho Usenet", GetSettings("https://feed.animetosho.org", apiPath: @"/nabapi", categories: Array.Empty<int>(), animeCategories: new[] { 5070 }));
}
}

@ -41,8 +41,8 @@ namespace NzbDrone.Core.Indexers.Torznab
get
{
yield return GetDefinition("HD4Free.xyz", GetSettings("http://hd4free.xyz"));
yield return GetDefinition("AnimeTosho Torrents", GetSettings("https://feed.animetosho.org", apiPath: @"/nabapi", categories: new int[0], animeCategories: new[] { 5070 }));
yield return GetDefinition("Nyaa Pantsu", GetSettings("https://nyaa.pantsu.cat", apiPath: @"/feed/torznab", categories: new int[0], animeCategories: new[] { 5070 }));
yield return GetDefinition("AnimeTosho Torrents", GetSettings("https://feed.animetosho.org", apiPath: @"/nabapi", categories: Array.Empty<int>(), animeCategories: new[] { 5070 }));
yield return GetDefinition("Nyaa Pantsu", GetSettings("https://nyaa.pantsu.cat", apiPath: @"/feed/torznab", categories: Array.Empty<int>(), animeCategories: new[] { 5070 }));
}
}

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using FluentValidation;
using NzbDrone.Core.Annotations;
@ -22,7 +23,7 @@ namespace NzbDrone.Core.Notifications.Mailgun
public MailgunSettings()
{
Recipients = new string[] { };
Recipients = Array.Empty<string>();
}
[FieldDefinition(0, Label = "API Key", HelpText = "The API key generated from MailGun")]

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using FluentValidation;
using NzbDrone.Core.Annotations;
@ -20,8 +21,8 @@ namespace NzbDrone.Core.Notifications.PushBullet
public PushBulletSettings()
{
DeviceIds = new string[] { };
ChannelTags = new string[] { };
DeviceIds = Array.Empty<string>();
ChannelTags = Array.Empty<string>();
}
[FieldDefinition(0, Label = "Access Token", Privacy = PrivacyLevel.ApiKey, HelpLink = "https://www.pushbullet.com/#settings/account")]

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using FluentValidation;
using NzbDrone.Core.Annotations;
@ -23,7 +24,7 @@ namespace NzbDrone.Core.Notifications.Pushover
public PushoverSettings()
{
Priority = 0;
Devices = new string[] { };
Devices = Array.Empty<string>();
}
// TODO: Get Pushover to change our app name (or create a new app) when we have a new logo

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using FluentValidation;
using NzbDrone.Core.Annotations;
using NzbDrone.Core.ThingiProvider;
@ -24,7 +25,7 @@ namespace NzbDrone.Core.Notifications.SendGrid
public SendGridSettings()
{
BaseUrl = "https://api.sendgrid.com/v3/";
Recipients = new string[] { };
Recipients = Array.Empty<string>();
}
public string BaseUrl { get; set; }

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
@ -32,9 +33,9 @@ namespace NzbDrone.Core.Parser.Model
public ParsedEpisodeInfo()
{
EpisodeNumbers = new int[0];
AbsoluteEpisodeNumbers = new int[0];
SpecialAbsoluteEpisodeNumbers = new decimal[0];
EpisodeNumbers = Array.Empty<int>();
AbsoluteEpisodeNumbers = Array.Empty<int>();
SpecialAbsoluteEpisodeNumbers = Array.Empty<decimal>();
Languages = new List<Language>();
}

@ -890,8 +890,8 @@ namespace NzbDrone.Core.Parser
result = new ParsedEpisodeInfo
{
ReleaseTitle = releaseTitle,
EpisodeNumbers = new int[0],
AbsoluteEpisodeNumbers = new int[0]
EpisodeNumbers = Array.Empty<int>(),
AbsoluteEpisodeNumbers = Array.Empty<int>()
};
foreach (Match matchGroup in matchCollection)

@ -126,7 +126,7 @@ namespace NzbDrone.Host
c.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{ apiKeyHeader, new string[] { } }
{ apiKeyHeader, Array.Empty<string>() }
});
var apikeyQuery = new OpenApiSecurityScheme
@ -157,7 +157,7 @@ namespace NzbDrone.Host
c.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{ apikeyQuery, new string[] { } }
{ apikeyQuery, Array.Empty<string>() }
});
});

@ -49,8 +49,8 @@ namespace NzbDrone.RuntimePatches.Mono
Instance.DebugOpcodes("Before", codes);
var targetType = method.DeclaringType;
var copyMethod = targetType.GetMethod("Copy", new Type[0]);
var disposeMethod = targetType.GetMethod("Dispose", new Type[0]);
var copyMethod = targetType.GetMethod("Copy", Array.Empty<Type>());
var disposeMethod = targetType.GetMethod("Dispose", Array.Empty<Type>());
var setFlagsMethod = targetType.GetMethod("SetFlags", new[] { typeof(ulong) });
if (patchable && copyMethod != null && disposeMethod != null && setFlagsMethod != null)

Loading…
Cancel
Save