From c9878241745a2f18b2d43ec791410b8711250519 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Tue, 23 May 2023 13:52:39 +0300 Subject: [PATCH] Use 'var' instead of explicit type (cherry picked from commit 12374f7f0038e5b25548f5ab3f71122410832393) --- .../AutomationTest.cs | 2 +- .../PageModel/PageBase.cs | 4 +-- .../CacheTests/CachedFixture.cs | 10 +++---- .../ConfigFileProviderTest.cs | 10 +++---- .../DirectoryLookupServiceFixture.cs | 6 ++--- .../Http/HttpClientFixture.cs | 4 +-- src/NzbDrone.Common/ArchiveService.cs | 14 +++++----- src/NzbDrone.Common/ConvertBase32.cs | 14 +++++----- src/NzbDrone.Common/Disk/OsPath.cs | 6 ++--- .../Extensions/IEnumerableExtensions.cs | 4 +-- .../Extensions/LevenstheinExtensions.cs | 8 +++--- .../Extensions/PathExtensions.cs | 4 +-- src/NzbDrone.Common/HashUtil.cs | 8 +++--- src/NzbDrone.Common/Http/HttpUri.cs | 2 +- .../Http/Proxy/HttpProxySettings.cs | 2 +- .../Instrumentation/CleansingJsonVisitor.cs | 4 +-- .../Instrumentation/NzbDroneLogger.cs | 2 +- .../Serializer/Newtonsoft.Json/JsonVisitor.cs | 6 ++--- .../UnderscoreStringEnumConverter.cs | 4 +-- .../System.Text.Json/STJVersionConverter.cs | 2 +- .../LimitedConcurrencyLevelTaskScheduler.cs | 4 +-- src/NzbDrone.Console/ConsoleApp.cs | 2 +- .../Datastore/BasicRepositoryFixture.cs | 2 +- .../Blackhole/ScanWatchFolderFixture.cs | 2 +- .../Extras/ExtraServiceFixture.cs | 2 +- .../Subtitles/SubtitleServiceFixture.cs | 4 +-- src/NzbDrone.Core.Test/FluentTest.cs | 4 +-- .../DownloadClientRootFolderCheckFixture.cs | 2 +- .../NewznabRequestGeneratorFixture.cs | 4 +-- .../IndexerTests/PTPTests/PTPFixture.cs | 2 +- .../DatabaseTargetFixture.cs | 2 +- .../NotMultiPartSpecificationFixture.cs | 8 +++--- .../ParserTests/CrapParserFixture.cs | 12 ++++----- .../ParserTests/ParserFixture.cs | 7 +++-- .../RomanNumeralConversionFixture.cs | 10 +++---- .../Delay/DelayProfileServiceFixture.cs | 4 +-- .../Configuration/ConfigFileProvider.cs | 2 +- .../Datastore/BasicRepository.cs | 2 +- .../Datastore/Converters/CommandConverter.cs | 2 +- .../109_add_movie_formats_to_naming_config.cs | 8 +++--- .../Migration/115_update_movie_sorttitle.cs | 8 +++--- .../116_update_movie_sorttitle_again.cs | 8 +++--- .../Migration/117_update_movie_file.cs | 8 +++--- .../Migration/118_update_movie_slug.cs | 8 +++--- .../Migration/121_update_filedate_config.cs | 8 +++--- .../Migration/125_fix_imdb_unique.cs | 2 +- .../126_update_qualities_and_profiles.cs | 6 ++--- .../137_add_import_exclusions_table.cs | 10 +++---- ..._add_language_to_file_history_blacklist.cs | 26 +++++++++---------- .../180_fix_invalid_profile_references.cs | 2 +- .../187_swap_filechmod_for_folderchmod.cs | 6 ++--- .../Migration/199_mediainfo_to_ffmpeg.cs | 2 +- .../201_migrate_discord_from_slack.cs | 6 ++--- .../Datastore/Migration/208_collections.cs | 2 +- .../Migration/Framework/SqliteSchemaDumper.cs | 4 +-- .../Download/Clients/Deluge/DelugeProxy.cs | 2 +- .../Proxies/DownloadStationTaskProxyV2.cs | 4 +-- .../DownloadStation/UsenetDownloadStation.cs | 2 +- .../FreeboxDownloadEncoding.cs | 6 ++--- .../Download/Clients/Nzbget/Nzbget.cs | 2 +- .../Clients/QBittorrent/QBittorrent.cs | 2 +- .../SabnzbdStringArrayConverter.cs | 2 +- .../Download/Clients/rTorrent/RTorrent.cs | 2 +- .../Download/Clients/uTorrent/UTorrent.cs | 2 +- .../Download/Extensions/XmlExtensions.cs | 4 +-- src/NzbDrone.Core/Extras/ExtraService.cs | 4 +-- .../Extras/Others/OtherExtraService.cs | 2 +- .../Extras/Subtitles/SubtitleService.cs | 2 +- src/NzbDrone.Core/Fluent.cs | 10 +++---- .../Checks/PackageGlobalMessageCheck.cs | 2 +- .../CouchPotato/CouchPotatoParser.cs | 4 +-- .../FetchAndParseImportListService.cs | 2 +- .../ImportLists/HttpImportListBase.cs | 2 +- .../ImportLists/Plex/PlexParser.cs | 2 +- .../IndexerSearch/MoviesSearchService.cs | 4 +-- src/NzbDrone.Core/Indexers/HttpIndexerBase.cs | 2 +- src/NzbDrone.Core/Languages/Language.cs | 2 +- .../MediaCover/MediaCoverService.cs | 2 +- .../MovieImport/Manual/ManualImportService.cs | 2 +- .../NotUnpackingSpecification.cs | 2 +- .../Messaging/Commands/CommandExecutor.cs | 6 ++--- .../Messaging/Commands/CommandQueueManager.cs | 2 +- .../MetadataSource/SearchMovieComparer.cs | 2 +- .../MetadataSource/SkyHook/SkyHookProxy.cs | 4 +-- .../AlternativeTitleService.cs | 2 +- .../Movies/Credits/CreditService.cs | 2 +- .../Movies/MovieMetadataRepository.cs | 2 +- .../Translations/MovieTranslationService.cs | 2 +- .../Notifications/Discord/Discord.cs | 2 +- .../Notifications/NotificationService.cs | 2 +- .../Notifications/Slack/Slack.cs | 2 +- .../Organizer/FileNameBuilder.cs | 6 ++--- src/NzbDrone.Core/Parser/LanguageParser.cs | 2 +- src/NzbDrone.Core/Parser/Parser.cs | 8 +++--- .../Parser/RomanNumerals/RomanNumeral.cs | 10 +++---- .../RomanNumerals/RomanNumeralParser.cs | 26 +++++++++---------- .../Profiles/Delay/DelayProfileService.cs | 2 +- .../Qualities/QualityDefinitionService.cs | 6 ++--- src/NzbDrone.Core/Qualities/QualityModel.cs | 2 +- .../Qualities/QualityModelComparer.cs | 2 +- .../Validation/Paths/MovieExistsValidator.cs | 2 +- .../DiskProviderTests/DiskProviderFixture.cs | 2 +- .../ReleaseFileVersionAdapter.cs | 2 +- .../ConcurrencyCounter.cs | 2 +- .../ExceptionVerification.cs | 4 +-- .../StartNzbDroneService.cs | 6 ++--- .../UpdateEngine/InstallUpdateService.cs | 2 +- .../DiskProviderTests/FreeSpaceFixture.cs | 2 +- .../Calendar/CalendarFeedController.cs | 4 +-- .../ExtraFiles/ExtraFileController.cs | 6 ++--- .../Logs/LogFileControllerBase.cs | 2 +- src/Radarr.Api.V3/Movies/MovieResource.cs | 4 +-- src/Radarr.Http/ClientSchema/SchemaBuilder.cs | 2 +- .../ServiceInstall/ServiceHelper.cs | 2 +- .../ServiceUninstall/ServiceHelper.cs | 2 +- 115 files changed, 257 insertions(+), 258 deletions(-) diff --git a/src/NzbDrone.Automation.Test/AutomationTest.cs b/src/NzbDrone.Automation.Test/AutomationTest.cs index 5091c7142..3ac0f9539 100644 --- a/src/NzbDrone.Automation.Test/AutomationTest.cs +++ b/src/NzbDrone.Automation.Test/AutomationTest.cs @@ -68,7 +68,7 @@ namespace NzbDrone.Automation.Test { try { - Screenshot image = ((ITakesScreenshot)driver).GetScreenshot(); + var image = ((ITakesScreenshot)driver).GetScreenshot(); image.SaveAsFile($"./{name}_test_screenshot.png", ScreenshotImageFormat.Png); } catch (Exception ex) diff --git a/src/NzbDrone.Automation.Test/PageModel/PageBase.cs b/src/NzbDrone.Automation.Test/PageModel/PageBase.cs index 21651f631..48c77ba7c 100644 --- a/src/NzbDrone.Automation.Test/PageModel/PageBase.cs +++ b/src/NzbDrone.Automation.Test/PageModel/PageBase.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading; using OpenQA.Selenium; using OpenQA.Selenium.Remote; @@ -37,7 +37,7 @@ namespace NzbDrone.Automation.Test.PageModel { try { - IWebElement element = d.FindElement(By.ClassName("followingBalls")); + var element = d.FindElement(By.ClassName("followingBalls")); return !element.Displayed; } catch (NoSuchElementException) diff --git a/src/NzbDrone.Common.Test/CacheTests/CachedFixture.cs b/src/NzbDrone.Common.Test/CacheTests/CachedFixture.cs index 7c892047d..bdbd45aca 100644 --- a/src/NzbDrone.Common.Test/CacheTests/CachedFixture.cs +++ b/src/NzbDrone.Common.Test/CacheTests/CachedFixture.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading; using FluentAssertions; using NUnit.Framework; @@ -65,9 +65,9 @@ namespace NzbDrone.Common.Test.CacheTests [Test] public void should_store_null() { - int hitCount = 0; + var hitCount = 0; - for (int i = 0; i < 10; i++) + for (var i = 0; i < 10; i++) { _cachedString.Get("key", () => { @@ -83,10 +83,10 @@ namespace NzbDrone.Common.Test.CacheTests [Platform(Exclude = "MacOsX")] public void should_honor_ttl() { - int hitCount = 0; + var hitCount = 0; _cachedString = new Cached(); - for (int i = 0; i < 10; i++) + for (var i = 0; i < 10; i++) { _cachedString.Get("key", () => diff --git a/src/NzbDrone.Common.Test/ConfigFileProviderTest.cs b/src/NzbDrone.Common.Test/ConfigFileProviderTest.cs index 82c2f854e..2f4ac7ff0 100644 --- a/src/NzbDrone.Common.Test/ConfigFileProviderTest.cs +++ b/src/NzbDrone.Common.Test/ConfigFileProviderTest.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using FluentAssertions; using Moq; using NUnit.Framework; @@ -142,7 +142,7 @@ namespace NzbDrone.Common.Test [Test] public void SaveDictionary_should_save_proper_value() { - int port = 20555; + var port = 20555; var dic = Subject.GetConfigDictionary(); dic["Port"] = 20555; @@ -155,9 +155,9 @@ namespace NzbDrone.Common.Test [Test] public void SaveDictionary_should_only_save_specified_values() { - int port = 20555; - int origSslPort = 20551; - int sslPort = 20552; + var port = 20555; + var origSslPort = 20551; + var sslPort = 20552; var dic = Subject.GetConfigDictionary(); dic["Port"] = port; diff --git a/src/NzbDrone.Common.Test/DiskTests/DirectoryLookupServiceFixture.cs b/src/NzbDrone.Common.Test/DiskTests/DirectoryLookupServiceFixture.cs index 78aa99f7d..1dc4256ee 100644 --- a/src/NzbDrone.Common.Test/DiskTests/DirectoryLookupServiceFixture.cs +++ b/src/NzbDrone.Common.Test/DiskTests/DirectoryLookupServiceFixture.cs @@ -42,7 +42,7 @@ namespace NzbDrone.Common.Test.DiskTests [Test] public void should_not_contain_recycling_bin_for_root_of_drive() { - string root = @"C:\".AsOsAgnostic(); + var root = @"C:\".AsOsAgnostic(); SetupFolders(root); Mocker.GetMock() @@ -55,7 +55,7 @@ namespace NzbDrone.Common.Test.DiskTests [Test] public void should_not_contain_system_volume_information() { - string root = @"C:\".AsOsAgnostic(); + var root = @"C:\".AsOsAgnostic(); SetupFolders(root); Mocker.GetMock() @@ -68,7 +68,7 @@ namespace NzbDrone.Common.Test.DiskTests [Test] public void should_not_contain_recycling_bin_or_system_volume_information_for_root_of_drive() { - string root = @"C:\".AsOsAgnostic(); + var root = @"C:\".AsOsAgnostic(); SetupFolders(root); Mocker.GetMock() diff --git a/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs b/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs index 38839c6c1..126b048df 100644 --- a/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs +++ b/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs @@ -786,7 +786,7 @@ namespace NzbDrone.Common.Test.Http try { // the date is bad in the below - should be 13-Jul-2026 - string malformedCookie = @"__cfduid=d29e686a9d65800021c66faca0a29b4261436890790; expires=Mon, 13-Jul-26 16:19:50 GMT; path=/; HttpOnly"; + var malformedCookie = @"__cfduid=d29e686a9d65800021c66faca0a29b4261436890790; expires=Mon, 13-Jul-26 16:19:50 GMT; path=/; HttpOnly"; var requestSet = new HttpRequestBuilder($"https://{_httpBinHost}/response-headers") .AddQueryParam("Set-Cookie", malformedCookie) .Build(); @@ -820,7 +820,7 @@ namespace NzbDrone.Common.Test.Http { try { - string url = $"https://{_httpBinHost}/response-headers?Set-Cookie={Uri.EscapeDataString(malformedCookie)}"; + var url = $"https://{_httpBinHost}/response-headers?Set-Cookie={Uri.EscapeDataString(malformedCookie)}"; var requestSet = new HttpRequest(url); requestSet.AllowAutoRedirect = false; diff --git a/src/NzbDrone.Common/ArchiveService.cs b/src/NzbDrone.Common/ArchiveService.cs index 2dee4d822..4cd6f6835 100644 --- a/src/NzbDrone.Common/ArchiveService.cs +++ b/src/NzbDrone.Common/ArchiveService.cs @@ -74,17 +74,17 @@ namespace NzbDrone.Common continue; // Ignore directories } - string entryFileName = zipEntry.Name; + var entryFileName = zipEntry.Name; // to remove the folder from the entry:- entryFileName = Path.GetFileName(entryFileName); // Optionally match entrynames against a selection list here to skip as desired. // The unpacked length is available in the zipEntry.Size property. - byte[] buffer = new byte[4096]; // 4K is optimum - Stream zipStream = zipFile.GetInputStream(zipEntry); + var buffer = new byte[4096]; // 4K is optimum + var zipStream = zipFile.GetInputStream(zipEntry); // Manipulate the output filename here as desired. - string fullZipToPath = Path.Combine(destination, entryFileName); - string directoryName = Path.GetDirectoryName(fullZipToPath); + var fullZipToPath = Path.Combine(destination, entryFileName); + var directoryName = Path.GetDirectoryName(fullZipToPath); if (directoryName.Length > 0) { Directory.CreateDirectory(directoryName); @@ -93,7 +93,7 @@ namespace NzbDrone.Common // Unzip file in buffered chunks. This is just as fast as unpacking to a buffer the full size // of the file, but does not waste memory. // The "using" will close the stream even if an exception occurs. - using (FileStream streamWriter = File.Create(fullZipToPath)) + using (var streamWriter = File.Create(fullZipToPath)) { StreamUtils.Copy(zipStream, streamWriter, buffer); } @@ -106,7 +106,7 @@ namespace NzbDrone.Common Stream inStream = File.OpenRead(compressedFile); Stream gzipStream = new GZipInputStream(inStream); - TarArchive tarArchive = TarArchive.CreateInputTarArchive(gzipStream, null); + var tarArchive = TarArchive.CreateInputTarArchive(gzipStream, null); tarArchive.ExtractContents(destination); tarArchive.Close(); diff --git a/src/NzbDrone.Common/ConvertBase32.cs b/src/NzbDrone.Common/ConvertBase32.cs index 3ee7803d5..bf36e61d5 100644 --- a/src/NzbDrone.Common/ConvertBase32.cs +++ b/src/NzbDrone.Common/ConvertBase32.cs @@ -1,4 +1,4 @@ -namespace NzbDrone.Common +namespace NzbDrone.Common { public static class ConvertBase32 { @@ -6,17 +6,17 @@ public static byte[] FromBase32String(string str) { - int numBytes = str.Length * 5 / 8; - byte[] bytes = new byte[numBytes]; + var numBytes = str.Length * 5 / 8; + var bytes = new byte[numBytes]; // all UPPERCASE chars str = str.ToUpper(); - int bitBuffer = 0; - int bitBufferCount = 0; - int index = 0; + var bitBuffer = 0; + var bitBufferCount = 0; + var index = 0; - for (int i = 0; i < str.Length; i++) + for (var i = 0; i < str.Length; i++) { bitBuffer = (bitBuffer << 5) | ValidChars.IndexOf(str[i]); bitBufferCount += 5; diff --git a/src/NzbDrone.Common/Disk/OsPath.cs b/src/NzbDrone.Common/Disk/OsPath.cs index 8d8dcf2f9..f6f01fccf 100644 --- a/src/NzbDrone.Common/Disk/OsPath.cs +++ b/src/NzbDrone.Common/Disk/OsPath.cs @@ -255,7 +255,7 @@ namespace NzbDrone.Common.Disk var stringComparison = (Kind == OsPathKind.Windows || other.Kind == OsPathKind.Windows) ? StringComparison.InvariantCultureIgnoreCase : StringComparison.InvariantCulture; - for (int i = 0; i < leftFragments.Length; i++) + for (var i = 0; i < leftFragments.Length; i++) { if (!string.Equals(leftFragments[i], rightFragments[i], stringComparison)) { @@ -372,12 +372,12 @@ namespace NzbDrone.Common.Disk var newFragments = new List(); - for (int j = i; j < rightFragments.Length; j++) + for (var j = i; j < rightFragments.Length; j++) { newFragments.Add(".."); } - for (int j = i; j < leftFragments.Length; j++) + for (var j = i; j < leftFragments.Length; j++) { newFragments.Add(leftFragments[j]); } diff --git a/src/NzbDrone.Common/Extensions/IEnumerableExtensions.cs b/src/NzbDrone.Common/Extensions/IEnumerableExtensions.cs index 5c3c22f65..4e592c575 100644 --- a/src/NzbDrone.Common/Extensions/IEnumerableExtensions.cs +++ b/src/NzbDrone.Common/Extensions/IEnumerableExtensions.cs @@ -126,9 +126,9 @@ namespace NzbDrone.Common.Extensions private static IEnumerable InternalDropLast(IEnumerable source, int n) { - Queue buffer = new Queue(n + 1); + var buffer = new Queue(n + 1); - foreach (T x in source) + foreach (var x in source) { buffer.Enqueue(x); diff --git a/src/NzbDrone.Common/Extensions/LevenstheinExtensions.cs b/src/NzbDrone.Common/Extensions/LevenstheinExtensions.cs index 825525457..eb20ce7b0 100644 --- a/src/NzbDrone.Common/Extensions/LevenstheinExtensions.cs +++ b/src/NzbDrone.Common/Extensions/LevenstheinExtensions.cs @@ -21,7 +21,7 @@ namespace NzbDrone.Common.Extensions return text.Length * costDelete; } - int[] matrix = new int[other.Length + 1]; + var matrix = new int[other.Length + 1]; for (var i = 1; i < matrix.Length; i++) { @@ -30,13 +30,13 @@ namespace NzbDrone.Common.Extensions for (var i = 0; i < text.Length; i++) { - int topLeft = matrix[0]; + var topLeft = matrix[0]; matrix[0] = matrix[0] + costDelete; for (var j = 0; j < other.Length; j++) { - int top = matrix[j]; - int left = matrix[j + 1]; + var top = matrix[j]; + var left = matrix[j + 1]; var sumIns = top + costInsert; var sumDel = left + costDelete; diff --git a/src/NzbDrone.Common/Extensions/PathExtensions.cs b/src/NzbDrone.Common/Extensions/PathExtensions.cs index 2b5e88adc..c82907ec9 100644 --- a/src/NzbDrone.Common/Extensions/PathExtensions.cs +++ b/src/NzbDrone.Common/Extensions/PathExtensions.cs @@ -245,13 +245,13 @@ namespace NzbDrone.Common.Extensions var firstPath = paths.First(); var length = firstPath.Length; - for (int i = 1; i < paths.Count; i++) + for (var i = 1; i < paths.Count; i++) { var path = paths[i]; length = Math.Min(length, path.Length); - for (int characterIndex = 0; characterIndex < length; characterIndex++) + for (var characterIndex = 0; characterIndex < length; characterIndex++) { if (path[characterIndex] != firstPath[characterIndex]) { diff --git a/src/NzbDrone.Common/HashUtil.cs b/src/NzbDrone.Common/HashUtil.cs index a60349271..fadbf831d 100644 --- a/src/NzbDrone.Common/HashUtil.cs +++ b/src/NzbDrone.Common/HashUtil.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Text; namespace NzbDrone.Common @@ -7,9 +7,9 @@ namespace NzbDrone.Common { public static string CalculateCrc(string input) { - uint mCrc = 0xffffffff; - byte[] bytes = Encoding.UTF8.GetBytes(input); - foreach (byte myByte in bytes) + var mCrc = 0xffffffff; + var bytes = Encoding.UTF8.GetBytes(input); + foreach (var myByte in bytes) { mCrc ^= (uint)myByte << 24; for (var i = 0; i < 8; i++) diff --git a/src/NzbDrone.Common/Http/HttpUri.cs b/src/NzbDrone.Common/Http/HttpUri.cs index d9d915bb8..31626b925 100644 --- a/src/NzbDrone.Common/Http/HttpUri.cs +++ b/src/NzbDrone.Common/Http/HttpUri.cs @@ -22,7 +22,7 @@ namespace NzbDrone.Common.Http public HttpUri(string scheme, string host, int? port, string path, string query, string fragment) { - StringBuilder builder = new StringBuilder(); + var builder = new StringBuilder(); if (scheme.IsNotNullOrWhiteSpace()) { diff --git a/src/NzbDrone.Common/Http/Proxy/HttpProxySettings.cs b/src/NzbDrone.Common/Http/Proxy/HttpProxySettings.cs index ef59c9c0f..022d8adee 100644 --- a/src/NzbDrone.Common/Http/Proxy/HttpProxySettings.cs +++ b/src/NzbDrone.Common/Http/Proxy/HttpProxySettings.cs @@ -31,7 +31,7 @@ namespace NzbDrone.Common.Http.Proxy if (!string.IsNullOrWhiteSpace(BypassFilter)) { var hostlist = BypassFilter.Split(','); - for (int i = 0; i < hostlist.Length; i++) + for (var i = 0; i < hostlist.Length; i++) { if (hostlist[i].StartsWith("*")) { diff --git a/src/NzbDrone.Common/Instrumentation/CleansingJsonVisitor.cs b/src/NzbDrone.Common/Instrumentation/CleansingJsonVisitor.cs index 1e32d399f..34df2dff3 100644 --- a/src/NzbDrone.Common/Instrumentation/CleansingJsonVisitor.cs +++ b/src/NzbDrone.Common/Instrumentation/CleansingJsonVisitor.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json.Linq; +using Newtonsoft.Json.Linq; using NzbDrone.Common.Serializer; namespace NzbDrone.Common.Instrumentation @@ -16,7 +16,7 @@ namespace NzbDrone.Common.Instrumentation } } - foreach (JToken token in json) + foreach (var token in json) { Visit(token); } diff --git a/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs b/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs index 8a8f296d3..15f0ebbfe 100644 --- a/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs +++ b/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs @@ -94,7 +94,7 @@ namespace NzbDrone.Common.Instrumentation private static void RegisterDebugger() { - DebuggerTarget target = new DebuggerTarget(); + var target = new DebuggerTarget(); target.Name = "debuggerLogger"; target.Layout = "[${level}] [${threadid}] ${logger}: ${message} ${onexception:inner=${newline}${newline}[v${assembly-version}] ${exception:format=ToString}${newline}${exception:format=Data}${newline}}"; diff --git a/src/NzbDrone.Common/Serializer/Newtonsoft.Json/JsonVisitor.cs b/src/NzbDrone.Common/Serializer/Newtonsoft.Json/JsonVisitor.cs index 0e69a0ae0..093de5b99 100644 --- a/src/NzbDrone.Common/Serializer/Newtonsoft.Json/JsonVisitor.cs +++ b/src/NzbDrone.Common/Serializer/Newtonsoft.Json/JsonVisitor.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json.Linq; +using Newtonsoft.Json.Linq; namespace NzbDrone.Common.Serializer { @@ -60,7 +60,7 @@ namespace NzbDrone.Common.Serializer public virtual void Visit(JArray json) { - foreach (JToken token in json) + foreach (var token in json) { Visit(token); } @@ -72,7 +72,7 @@ namespace NzbDrone.Common.Serializer public virtual void Visit(JObject json) { - foreach (JProperty property in json.Properties()) + foreach (var property in json.Properties()) { Visit(property); } diff --git a/src/NzbDrone.Common/Serializer/Newtonsoft.Json/UnderscoreStringEnumConverter.cs b/src/NzbDrone.Common/Serializer/Newtonsoft.Json/UnderscoreStringEnumConverter.cs index 772f5640c..b202253b6 100644 --- a/src/NzbDrone.Common/Serializer/Newtonsoft.Json/UnderscoreStringEnumConverter.cs +++ b/src/NzbDrone.Common/Serializer/Newtonsoft.Json/UnderscoreStringEnumConverter.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Text; using Newtonsoft.Json; @@ -42,7 +42,7 @@ namespace NzbDrone.Common.Serializer var enumText = value.ToString(); var builder = new StringBuilder(enumText.Length + 4); builder.Append(char.ToLower(enumText[0])); - for (int i = 1; i < enumText.Length; i++) + for (var i = 1; i < enumText.Length; i++) { if (char.IsUpper(enumText[i])) { diff --git a/src/NzbDrone.Common/Serializer/System.Text.Json/STJVersionConverter.cs b/src/NzbDrone.Common/Serializer/System.Text.Json/STJVersionConverter.cs index 70ad492c3..6fd024f7d 100644 --- a/src/NzbDrone.Common/Serializer/System.Text.Json/STJVersionConverter.cs +++ b/src/NzbDrone.Common/Serializer/System.Text.Json/STJVersionConverter.cs @@ -18,7 +18,7 @@ namespace NzbDrone.Common.Serializer { try { - Version v = new Version(reader.GetString()); + var v = new Version(reader.GetString()); return v; } catch (Exception) diff --git a/src/NzbDrone.Common/TPL/LimitedConcurrencyLevelTaskScheduler.cs b/src/NzbDrone.Common/TPL/LimitedConcurrencyLevelTaskScheduler.cs index 176ed380d..ba9d804d3 100644 --- a/src/NzbDrone.Common/TPL/LimitedConcurrencyLevelTaskScheduler.cs +++ b/src/NzbDrone.Common/TPL/LimitedConcurrencyLevelTaskScheduler.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading; @@ -137,7 +137,7 @@ namespace NzbDrone.Common.TPL /// An enumerable of the tasks currently scheduled. protected sealed override IEnumerable GetScheduledTasks() { - bool lockTaken = false; + var lockTaken = false; try { Monitor.TryEnter(_tasks, ref lockTaken); diff --git a/src/NzbDrone.Console/ConsoleApp.cs b/src/NzbDrone.Console/ConsoleApp.cs index 75fe1fb60..65c22338e 100644 --- a/src/NzbDrone.Console/ConsoleApp.cs +++ b/src/NzbDrone.Console/ConsoleApp.cs @@ -110,7 +110,7 @@ namespace NzbDrone.Console } System.Console.WriteLine("Non-recoverable failure, waiting for user intervention..."); - for (int i = 0; i < 3600; i++) + for (var i = 0; i < 3600; i++) { System.Threading.Thread.Sleep(1000); if (!System.Console.IsInputRedirected && System.Console.KeyAvailable) diff --git a/src/NzbDrone.Core.Test/Datastore/BasicRepositoryFixture.cs b/src/NzbDrone.Core.Test/Datastore/BasicRepositoryFixture.cs index 9f0cf4b92..8070f9fda 100644 --- a/src/NzbDrone.Core.Test/Datastore/BasicRepositoryFixture.cs +++ b/src/NzbDrone.Core.Test/Datastore/BasicRepositoryFixture.cs @@ -197,7 +197,7 @@ namespace NzbDrone.Core.Test.Datastore Subject.SetFields(_basicList, x => x.Interval); - for (int i = 0; i < _basicList.Count; i++) + for (var i = 0; i < _basicList.Count; i++) { _basicList[i].LastExecution = executionBackup[i]; } diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/Blackhole/ScanWatchFolderFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/Blackhole/ScanWatchFolderFixture.cs index 18c03ab88..46364534a 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/Blackhole/ScanWatchFolderFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/Blackhole/ScanWatchFolderFixture.cs @@ -79,7 +79,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole VerifySingleItem(DownloadItemStatus.Downloading); // If we keep changing the file every 20ms we should stay Downloading. - for (int i = 0; i < 10; i++) + for (var i = 0; i < 10; i++) { TestLogger.Info("Iteration {0}", i); diff --git a/src/NzbDrone.Core.Test/Extras/ExtraServiceFixture.cs b/src/NzbDrone.Core.Test/Extras/ExtraServiceFixture.cs index 38a059d68..177b3d962 100644 --- a/src/NzbDrone.Core.Test/Extras/ExtraServiceFixture.cs +++ b/src/NzbDrone.Core.Test/Extras/ExtraServiceFixture.cs @@ -108,7 +108,7 @@ namespace NzbDrone.Core.Test.Extras private void WithExistingFiles(List files) { - foreach (string file in files) + foreach (var file in files) { WithExistingFile(file); } diff --git a/src/NzbDrone.Core.Test/Extras/Subtitles/SubtitleServiceFixture.cs b/src/NzbDrone.Core.Test/Extras/Subtitles/SubtitleServiceFixture.cs index df15a0491..f162f08ee 100644 --- a/src/NzbDrone.Core.Test/Extras/Subtitles/SubtitleServiceFixture.cs +++ b/src/NzbDrone.Core.Test/Extras/Subtitles/SubtitleServiceFixture.cs @@ -112,7 +112,7 @@ namespace NzbDrone.Core.Test.Extras.Subtitles results.Count.Should().Be(expectedOutputs.Length); - for (int i = 0; i < expectedOutputs.Length; i++) + for (var i = 0; i < expectedOutputs.Length; i++) { results[i].RelativePath.AsOsAgnostic().PathEquals(expectedOutputs[i].AsOsAgnostic()).Should().Be(true); } @@ -141,7 +141,7 @@ namespace NzbDrone.Core.Test.Extras.Subtitles results.Count.Should().Be(expectedOutputs.Length); - for (int i = 0; i < expectedOutputs.Length; i++) + for (var i = 0; i < expectedOutputs.Length; i++) { results[i].RelativePath.AsOsAgnostic().PathEquals(expectedOutputs[i].AsOsAgnostic()).Should().Be(true); } diff --git a/src/NzbDrone.Core.Test/FluentTest.cs b/src/NzbDrone.Core.Test/FluentTest.cs index df4adae3a..30a3b1ab9 100644 --- a/src/NzbDrone.Core.Test/FluentTest.cs +++ b/src/NzbDrone.Core.Test/FluentTest.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Text; using FluentAssertions; @@ -57,7 +57,7 @@ namespace NzbDrone.Core.Test [Test] public void ToBestDateTime_DayOfWeek() { - for (int i = 2; i < 7; i++) + for (var i = 2; i < 7; i++) { var dateTime = DateTime.Today.AddDays(i); diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientRootFolderCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientRootFolderCheckFixture.cs index 831e9de1a..f3e826fd6 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientRootFolderCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientRootFolderCheckFixture.cs @@ -79,7 +79,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks [Test] public void should_return_ok_if_not_downloading_to_root_folder() { - string rootFolderPath = "c:\\Test2".AsOsAgnostic(); + var rootFolderPath = "c:\\Test2".AsOsAgnostic(); GivenRootFolder(rootFolderPath); diff --git a/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabRequestGeneratorFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabRequestGeneratorFixture.cs index ad7e03270..2ee99abf8 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabRequestGeneratorFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabRequestGeneratorFixture.cs @@ -211,7 +211,7 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests _capabilities.SupportedMovieSearchParameters = new[] { "q" }; _capabilities.TextSearchEngine = "raw"; - MovieSearchCriteria movieRawSearchCriteria = new MovieSearchCriteria + var movieRawSearchCriteria = new MovieSearchCriteria { Movie = new Movies.Movie { Title = "Some Movie & Title: Words", Year = 2021, TmdbId = 123 }, SceneTitles = new List { "Some Movie & Title: Words" } @@ -232,7 +232,7 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests _capabilities.SupportedMovieSearchParameters = new[] { "q" }; _capabilities.TextSearchEngine = "sphinx"; - MovieSearchCriteria movieRawSearchCriteria = new MovieSearchCriteria + var movieRawSearchCriteria = new MovieSearchCriteria { Movie = new Movies.Movie { Title = "Some Movie & Title: Words", Year = 2021, TmdbId = 123 }, SceneTitles = new List { "Some Movie & Title: Words" } diff --git a/src/NzbDrone.Core.Test/IndexerTests/PTPTests/PTPFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/PTPTests/PTPFixture.cs index ce2a26050..2dd371949 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/PTPTests/PTPFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/PTPTests/PTPFixture.cs @@ -31,7 +31,7 @@ namespace NzbDrone.Core.Test.IndexerTests.PTPTests { var authResponse = new PassThePopcornAuthResponse { Result = "Ok" }; - System.IO.StringWriter authStream = new System.IO.StringWriter(); + var authStream = new System.IO.StringWriter(); Json.Serialize(authResponse, authStream); var responseJson = ReadAllText(fileName); diff --git a/src/NzbDrone.Core.Test/InstrumentationTests/DatabaseTargetFixture.cs b/src/NzbDrone.Core.Test/InstrumentationTests/DatabaseTargetFixture.cs index fd75b5d84..62cee2d9c 100644 --- a/src/NzbDrone.Core.Test/InstrumentationTests/DatabaseTargetFixture.cs +++ b/src/NzbDrone.Core.Test/InstrumentationTests/DatabaseTargetFixture.cs @@ -48,7 +48,7 @@ namespace NzbDrone.Core.Test.InstrumentationTests public void write_long_log() { var message = string.Empty; - for (int i = 0; i < 100; i++) + for (var i = 0; i < 100; i++) { message += Guid.NewGuid(); } diff --git a/src/NzbDrone.Core.Test/MediaFiles/MovieImport/Specifications/NotMultiPartSpecificationFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/MovieImport/Specifications/NotMultiPartSpecificationFixture.cs index 10b71b8e6..17d133fea 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/MovieImport/Specifications/NotMultiPartSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/MovieImport/Specifications/NotMultiPartSpecificationFixture.cs @@ -41,7 +41,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Specifications { _localMovie.Path = paths.First().ToString().AsOsAgnostic(); - string[] filePaths = paths.Cast().Select(x => x.AsOsAgnostic()).ToArray(); + var filePaths = paths.Cast().Select(x => x.AsOsAgnostic()).ToArray(); Mocker.GetMock() .Setup(s => s.GetFiles(_localMovie.Path.GetParentPath(), SearchOption.TopDirectoryOnly)) @@ -69,7 +69,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Specifications { _localMovie.Path = paths.First().ToString().AsOsAgnostic(); - string[] filePaths = paths.Cast().Select(x => x.AsOsAgnostic()).ToArray(); + var filePaths = paths.Cast().Select(x => x.AsOsAgnostic()).ToArray(); Mocker.GetMock() .Setup(s => s.GetFiles(_localMovie.Path.GetParentPath(), SearchOption.TopDirectoryOnly)) @@ -87,7 +87,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Specifications { _localMovie.Path = paths.First().ToString().AsOsAgnostic(); - string[] filePaths = paths.Cast().Select(x => x.AsOsAgnostic()).ToArray(); + var filePaths = paths.Cast().Select(x => x.AsOsAgnostic()).ToArray(); Mocker.GetMock() .Setup(s => s.GetFiles(_localMovie.Path.GetParentPath(), SearchOption.TopDirectoryOnly)) @@ -105,7 +105,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Specifications { _localMovie.Path = paths.First().ToString().AsOsAgnostic(); - string[] filePaths = paths.Cast().Select(x => x.AsOsAgnostic()).ToArray(); + var filePaths = paths.Cast().Select(x => x.AsOsAgnostic()).ToArray(); Mocker.GetMock() .Setup(s => s.GetFiles(_localMovie.Path.GetParentPath(), SearchOption.TopDirectoryOnly)) diff --git a/src/NzbDrone.Core.Test/ParserTests/CrapParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/CrapParserFixture.cs index 4f1470810..a9b328b0d 100644 --- a/src/NzbDrone.Core.Test/ParserTests/CrapParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/CrapParserFixture.cs @@ -40,13 +40,13 @@ namespace NzbDrone.Core.Test.ParserTests [Test] public void should_not_parse_md5() { - string hash = "CRAPPY TEST SEED"; + var hash = "CRAPPY TEST SEED"; var hashAlgo = System.Security.Cryptography.MD5.Create(); var repetitions = 100; var success = 0; - for (int i = 0; i < repetitions; i++) + for (var i = 0; i < repetitions; i++) { var hashData = hashAlgo.ComputeHash(Encoding.Default.GetBytes(hash)); @@ -65,17 +65,17 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase(40)] public void should_not_parse_random(int length) { - string charset = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + var charset = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; var hashAlgo = new Random(); var repetitions = 500; var success = 0; - for (int i = 0; i < repetitions; i++) + for (var i = 0; i < repetitions; i++) { - StringBuilder hash = new StringBuilder(length); + var hash = new StringBuilder(length); - for (int x = 0; x < length; x++) + for (var x = 0; x < length; x++) { hash.Append(charset[hashAlgo.Next() % charset.Length]); } diff --git a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs index 8cb8501cc..3d8323dc7 100644 --- a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs @@ -4,7 +4,6 @@ using FluentAssertions.Execution; using NUnit.Framework; using NzbDrone.Core.Languages; using NzbDrone.Core.Parser; -using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.ParserTests @@ -72,7 +71,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("[sam] Toward the Terra (1980) [BD 1080p TrueHD].mkv", "Toward the Terra", "sam", 1980)] public void should_parse_anime_movie_title(string postTitle, string title, string releaseGroup, int year) { - ParsedMovieInfo movie = Parser.Parser.ParseMovieTitle(postTitle); + var movie = Parser.Parser.ParseMovieTitle(postTitle); using (new AssertionScope()) { movie.PrimaryMovieTitle.Should().Be(title); @@ -89,7 +88,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("[Kulot] Violet Evergarden Gaiden Eien to Jidou Shuki Ningyou [Dual-Audio][BDRip 1920x804 HEVC FLACx2] [91FC62A8].mkv", "Violet Evergarden Gaiden Eien to Jidou Shuki Ningyou", "Kulot")] public void should_parse_anime_movie_title_without_year(string postTitle, string title, string releaseGroup) { - ParsedMovieInfo movie = Parser.Parser.ParseMovieTitle(postTitle); + var movie = Parser.Parser.ParseMovieTitle(postTitle); using (new AssertionScope()) { movie.PrimaryMovieTitle.Should().Be(title); @@ -127,7 +126,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("Kick.Ass.2.2013.German.DTS.DL.720p.BluRay.x264-Pate_", "Kick Ass 2", "", 2013, Description = "underscore at the end")] public void should_parse_german_movie(string postTitle, string title, string edition, int year) { - ParsedMovieInfo movie = Parser.Parser.ParseMovieTitle(postTitle); + var movie = Parser.Parser.ParseMovieTitle(postTitle); using (new AssertionScope()) { movie.PrimaryMovieTitle.Should().Be(title); diff --git a/src/NzbDrone.Core.Test/ParserTests/RomanNumeralTests/RomanNumeralConversionFixture.cs b/src/NzbDrone.Core.Test/ParserTests/RomanNumeralTests/RomanNumeralConversionFixture.cs index e6166733f..3e1c3e9e0 100644 --- a/src/NzbDrone.Core.Test/ParserTests/RomanNumeralTests/RomanNumeralConversionFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/RomanNumeralTests/RomanNumeralConversionFixture.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; using Newtonsoft.Json; using NUnit.Framework; @@ -25,9 +25,9 @@ namespace NzbDrone.Core.Test.ParserTests.RomanNumeralTests [Order(0)] public void should_convert_arabic_numeral_to_roman_numeral([Range(1, 20)] int arabicNumeral) { - RomanNumeral romanNumeral = new RomanNumeral(arabicNumeral); + var romanNumeral = new RomanNumeral(arabicNumeral); - string expectedValue = _arabicToRomanNumeralsMapping[arabicNumeral]; + var expectedValue = _arabicToRomanNumeralsMapping[arabicNumeral]; Assert.AreEqual(romanNumeral.ToRomanNumeral(), expectedValue); } @@ -36,9 +36,9 @@ namespace NzbDrone.Core.Test.ParserTests.RomanNumeralTests [Order(1)] public void should_convert_roman_numeral_to_arabic_numeral([Range(1, 20)] int arabicNumeral) { - RomanNumeral romanNumeral = new RomanNumeral(_arabicToRomanNumeralsMapping[arabicNumeral]); + var romanNumeral = new RomanNumeral(_arabicToRomanNumeralsMapping[arabicNumeral]); - int expectecdValue = arabicNumeral; + var expectecdValue = arabicNumeral; Assert.AreEqual(romanNumeral.ToInt(), expectecdValue); } diff --git a/src/NzbDrone.Core.Test/Profiles/Delay/DelayProfileServiceFixture.cs b/src/NzbDrone.Core.Test/Profiles/Delay/DelayProfileServiceFixture.cs index c86678035..587de3258 100644 --- a/src/NzbDrone.Core.Test/Profiles/Delay/DelayProfileServiceFixture.cs +++ b/src/NzbDrone.Core.Test/Profiles/Delay/DelayProfileServiceFixture.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using FizzWare.NBuilder; using FluentAssertions; @@ -67,7 +67,7 @@ namespace NzbDrone.Core.Test.Profiles.Delay var moving = _last; var result = Subject.Reorder(moving.Id, null).OrderBy(d => d.Order).ToList(); - for (int i = 1; i < result.Count; i++) + for (var i = 1; i < result.Count; i++) { var delayProfile = result[i]; diff --git a/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs b/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs index aa88606f2..9f9ecaba0 100644 --- a/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs +++ b/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs @@ -142,7 +142,7 @@ namespace NzbDrone.Core.Configuration { const string defaultValue = "*"; - string bindAddress = GetValue("BindAddress", defaultValue); + var bindAddress = GetValue("BindAddress", defaultValue); if (string.IsNullOrWhiteSpace(bindAddress)) { return defaultValue; diff --git a/src/NzbDrone.Core/Datastore/BasicRepository.cs b/src/NzbDrone.Core/Datastore/BasicRepository.cs index 6d213d273..5443c0c1a 100644 --- a/src/NzbDrone.Core/Datastore/BasicRepository.cs +++ b/src/NzbDrone.Core/Datastore/BasicRepository.cs @@ -203,7 +203,7 @@ namespace NzbDrone.Core.Datastore using (var conn = _database.OpenConnection()) { - using (IDbTransaction tran = conn.BeginTransaction(IsolationLevel.ReadCommitted)) + using (var tran = conn.BeginTransaction(IsolationLevel.ReadCommitted)) { foreach (var model in models) { diff --git a/src/NzbDrone.Core/Datastore/Converters/CommandConverter.cs b/src/NzbDrone.Core/Datastore/Converters/CommandConverter.cs index e2f77c6f0..790464f3f 100644 --- a/src/NzbDrone.Core/Datastore/Converters/CommandConverter.cs +++ b/src/NzbDrone.Core/Datastore/Converters/CommandConverter.cs @@ -18,7 +18,7 @@ namespace NzbDrone.Core.Datastore.Converters } string contract; - using (JsonDocument body = JsonDocument.Parse(stringValue)) + using (var body = JsonDocument.Parse(stringValue)) { contract = body.RootElement.GetProperty("name").GetString(); } diff --git a/src/NzbDrone.Core/Datastore/Migration/109_add_movie_formats_to_naming_config.cs b/src/NzbDrone.Core/Datastore/Migration/109_add_movie_formats_to_naming_config.cs index e20cb8939..3750e5963 100644 --- a/src/NzbDrone.Core/Datastore/Migration/109_add_movie_formats_to_naming_config.cs +++ b/src/NzbDrone.Core/Datastore/Migration/109_add_movie_formats_to_naming_config.cs @@ -1,4 +1,4 @@ -using System.Data; +using System.Data; using FluentMigrator; using NzbDrone.Core.Datastore.Migration.Framework; @@ -17,11 +17,11 @@ namespace NzbDrone.Core.Datastore.Migration private void ConvertConfig(IDbConnection conn, IDbTransaction tran) { - using (IDbCommand namingConfigCmd = conn.CreateCommand()) + using (var namingConfigCmd = conn.CreateCommand()) { namingConfigCmd.Transaction = tran; namingConfigCmd.CommandText = @"SELECT * FROM ""NamingConfig"" LIMIT 1"; - using (IDataReader namingConfigReader = namingConfigCmd.ExecuteReader()) + using (var namingConfigReader = namingConfigCmd.ExecuteReader()) { while (namingConfigReader.Read()) { @@ -36,7 +36,7 @@ namespace NzbDrone.Core.Datastore.Migration var movieFolderFormat = string.Format("{0} {1}", movieTitlePattern, movieYearPattern); - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { var text = string.Format("UPDATE \"NamingConfig\" " + "SET \"StandardMovieFormat\" = '{0}', " + diff --git a/src/NzbDrone.Core/Datastore/Migration/115_update_movie_sorttitle.cs b/src/NzbDrone.Core/Datastore/Migration/115_update_movie_sorttitle.cs index 8ae00b36b..341c4365b 100644 --- a/src/NzbDrone.Core/Datastore/Migration/115_update_movie_sorttitle.cs +++ b/src/NzbDrone.Core/Datastore/Migration/115_update_movie_sorttitle.cs @@ -1,4 +1,4 @@ -using System.Data; +using System.Data; using FluentMigrator; using NzbDrone.Core.Datastore.Migration.Framework; @@ -15,11 +15,11 @@ namespace NzbDrone.Core.Datastore.Migration private void SetSortTitles(IDbConnection conn, IDbTransaction tran) { - using (IDbCommand getSeriesCmd = conn.CreateCommand()) + using (var getSeriesCmd = conn.CreateCommand()) { getSeriesCmd.Transaction = tran; getSeriesCmd.CommandText = @"SELECT ""Id"", ""Title"" FROM ""Movies"""; - using (IDataReader seriesReader = getSeriesCmd.ExecuteReader()) + using (var seriesReader = getSeriesCmd.ExecuteReader()) { while (seriesReader.Read()) { @@ -28,7 +28,7 @@ namespace NzbDrone.Core.Datastore.Migration var sortTitle = Parser.Parser.NormalizeTitle(title).ToLower(); - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { updateCmd.Transaction = tran; updateCmd.CommandText = "UPDATE \"Movies\" SET \"SortTitle\" = ? WHERE \"Id\" = ?"; diff --git a/src/NzbDrone.Core/Datastore/Migration/116_update_movie_sorttitle_again.cs b/src/NzbDrone.Core/Datastore/Migration/116_update_movie_sorttitle_again.cs index e998afc41..5a9286054 100644 --- a/src/NzbDrone.Core/Datastore/Migration/116_update_movie_sorttitle_again.cs +++ b/src/NzbDrone.Core/Datastore/Migration/116_update_movie_sorttitle_again.cs @@ -1,4 +1,4 @@ -using System.Data; +using System.Data; using FluentMigrator; using NzbDrone.Core.Datastore.Migration.Framework; @@ -14,11 +14,11 @@ namespace NzbDrone.Core.Datastore.Migration private void SetSortTitles(IDbConnection conn, IDbTransaction tran) { - using (IDbCommand getSeriesCmd = conn.CreateCommand()) + using (var getSeriesCmd = conn.CreateCommand()) { getSeriesCmd.Transaction = tran; getSeriesCmd.CommandText = @"SELECT ""Id"", ""Title"" FROM ""Movies"""; - using (IDataReader seriesReader = getSeriesCmd.ExecuteReader()) + using (var seriesReader = getSeriesCmd.ExecuteReader()) { while (seriesReader.Read()) { @@ -27,7 +27,7 @@ namespace NzbDrone.Core.Datastore.Migration var sortTitle = Parser.Parser.NormalizeTitle(title).ToLower(); - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { updateCmd.Transaction = tran; updateCmd.CommandText = "UPDATE \"Movies\" SET \"SortTitle\" = ? WHERE \"Id\" = ?"; diff --git a/src/NzbDrone.Core/Datastore/Migration/117_update_movie_file.cs b/src/NzbDrone.Core/Datastore/Migration/117_update_movie_file.cs index 0e180e18c..72d9ff8d3 100644 --- a/src/NzbDrone.Core/Datastore/Migration/117_update_movie_file.cs +++ b/src/NzbDrone.Core/Datastore/Migration/117_update_movie_file.cs @@ -1,4 +1,4 @@ -using System.Data; +using System.Data; using FluentMigrator; using NzbDrone.Core.Datastore.Migration.Framework; @@ -16,11 +16,11 @@ namespace NzbDrone.Core.Datastore.Migration private void SetSortTitles(IDbConnection conn, IDbTransaction tran) { - using (IDbCommand getSeriesCmd = conn.CreateCommand()) + using (var getSeriesCmd = conn.CreateCommand()) { getSeriesCmd.Transaction = tran; getSeriesCmd.CommandText = @"SELECT ""Id"", ""RelativePath"" FROM ""MovieFiles"""; - using (IDataReader seriesReader = getSeriesCmd.ExecuteReader()) + using (var seriesReader = getSeriesCmd.ExecuteReader()) { while (seriesReader.Read()) { @@ -36,7 +36,7 @@ namespace NzbDrone.Core.Datastore.Migration edition = result.Edition ?? Parser.Parser.ParseEdition(result.SimpleReleaseTitle); } - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { updateCmd.Transaction = tran; updateCmd.CommandText = "UPDATE \"MovieFiles\" SET \"Edition\" = ? WHERE \"Id\" = ?"; diff --git a/src/NzbDrone.Core/Datastore/Migration/118_update_movie_slug.cs b/src/NzbDrone.Core/Datastore/Migration/118_update_movie_slug.cs index adb1a7ed2..101751b0a 100644 --- a/src/NzbDrone.Core/Datastore/Migration/118_update_movie_slug.cs +++ b/src/NzbDrone.Core/Datastore/Migration/118_update_movie_slug.cs @@ -1,4 +1,4 @@ -using System.Data; +using System.Data; using FluentMigrator; using NzbDrone.Core.Datastore.Migration.Framework; @@ -14,11 +14,11 @@ namespace NzbDrone.Core.Datastore.Migration private void SetTitleSlug(IDbConnection conn, IDbTransaction tran) { - using (IDbCommand getSeriesCmd = conn.CreateCommand()) + using (var getSeriesCmd = conn.CreateCommand()) { getSeriesCmd.Transaction = tran; getSeriesCmd.CommandText = @"SELECT ""Id"", ""Title"", ""Year"", ""TmdbId"" FROM ""Movies"""; - using (IDataReader seriesReader = getSeriesCmd.ExecuteReader()) + using (var seriesReader = getSeriesCmd.ExecuteReader()) { while (seriesReader.Read()) { @@ -29,7 +29,7 @@ namespace NzbDrone.Core.Datastore.Migration var titleSlug = Parser.Parser.ToUrlSlug(title + "-" + tmdbId); - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { updateCmd.Transaction = tran; updateCmd.CommandText = "UPDATE \"Movies\" SET \"TitleSlug\" = ? WHERE \"Id\" = ?"; diff --git a/src/NzbDrone.Core/Datastore/Migration/121_update_filedate_config.cs b/src/NzbDrone.Core/Datastore/Migration/121_update_filedate_config.cs index 0eb9fd440..b730c8956 100644 --- a/src/NzbDrone.Core/Datastore/Migration/121_update_filedate_config.cs +++ b/src/NzbDrone.Core/Datastore/Migration/121_update_filedate_config.cs @@ -1,4 +1,4 @@ -using System.Data; +using System.Data; using System.Text; using System.Text.RegularExpressions; using FluentMigrator; @@ -16,18 +16,18 @@ namespace NzbDrone.Core.Datastore.Migration private void SetTitleSlug(IDbConnection conn, IDbTransaction tran) { - using (IDbCommand getSeriesCmd = conn.CreateCommand()) + using (var getSeriesCmd = conn.CreateCommand()) { getSeriesCmd.Transaction = tran; getSeriesCmd.CommandText = @"SELECT ""Id"", ""Value"" FROM ""Config"" WHERE ""Key"" = 'filedate'"; - using (IDataReader seriesReader = getSeriesCmd.ExecuteReader()) + using (var seriesReader = getSeriesCmd.ExecuteReader()) { while (seriesReader.Read()) { var id = seriesReader.GetInt32(0); var value = seriesReader.GetString(1); - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { updateCmd.Transaction = tran; updateCmd.CommandText = "UPDATE \"Config\" SET \"Value\" = 'Release' WHERE \"Id\" = ?"; diff --git a/src/NzbDrone.Core/Datastore/Migration/125_fix_imdb_unique.cs b/src/NzbDrone.Core/Datastore/Migration/125_fix_imdb_unique.cs index c79a18b5a..d93f46862 100644 --- a/src/NzbDrone.Core/Datastore/Migration/125_fix_imdb_unique.cs +++ b/src/NzbDrone.Core/Datastore/Migration/125_fix_imdb_unique.cs @@ -14,7 +14,7 @@ namespace NzbDrone.Core.Datastore.Migration private void DeleteUniqueIndex(IDbConnection conn, IDbTransaction tran) { - using (IDbCommand getSeriesCmd = conn.CreateCommand()) + using (var getSeriesCmd = conn.CreateCommand()) { getSeriesCmd.Transaction = tran; getSeriesCmd.CommandText = @"DROP INDEX ""IX_Movies_ImdbId"""; diff --git a/src/NzbDrone.Core/Datastore/Migration/126_update_qualities_and_profiles.cs b/src/NzbDrone.Core/Datastore/Migration/126_update_qualities_and_profiles.cs index 6194ec0fe..f7eff5fb5 100644 --- a/src/NzbDrone.Core/Datastore/Migration/126_update_qualities_and_profiles.cs +++ b/src/NzbDrone.Core/Datastore/Migration/126_update_qualities_and_profiles.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Data; using System.Linq; using FluentMigrator; @@ -193,8 +193,8 @@ namespace NzbDrone.Core.Datastore.Migration { while (definitionsReader.Read()) { - int id = definitionsReader.GetInt32(0); - int quality = definitionsReader.GetInt32(1); + var id = definitionsReader.GetInt32(0); + var quality = definitionsReader.GetInt32(1); definitions.Add(new QualityDefinition125 { Id = id, Quality = quality }); } } diff --git a/src/NzbDrone.Core/Datastore/Migration/137_add_import_exclusions_table.cs b/src/NzbDrone.Core/Datastore/Migration/137_add_import_exclusions_table.cs index fe527f04b..da5d6af19 100644 --- a/src/NzbDrone.Core/Datastore/Migration/137_add_import_exclusions_table.cs +++ b/src/NzbDrone.Core/Datastore/Migration/137_add_import_exclusions_table.cs @@ -1,4 +1,4 @@ -using System.Data; +using System.Data; using System.Globalization; using System.Linq; using System.Text.RegularExpressions; @@ -26,12 +26,12 @@ namespace NzbDrone.Core.Datastore.Migration private void AddExisting(IDbConnection conn, IDbTransaction tran) { - using (IDbCommand getSeriesCmd = conn.CreateCommand()) + using (var getSeriesCmd = conn.CreateCommand()) { getSeriesCmd.Transaction = tran; getSeriesCmd.CommandText = @"SELECT ""Key"", ""Value"" FROM ""Config"" WHERE ""Key"" = 'importexclusions'"; - TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; - using (IDataReader seriesReader = getSeriesCmd.ExecuteReader()) + var textInfo = new CultureInfo("en-US", false).TextInfo; + using (var seriesReader = getSeriesCmd.ExecuteReader()) { while (seriesReader.Read()) { @@ -45,7 +45,7 @@ namespace NzbDrone.Core.Datastore.Migration textInfo.ToTitleCase(string.Join(" ", x.Split('-').DropLast(1)))); }).ToList(); - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { updateCmd.Transaction = tran; updateCmd.CommandText = "INSERT INTO \"ImportExclusions\" (tmdbid, MovieTitle) VALUES " + string.Join(", ", importExclusions); diff --git a/src/NzbDrone.Core/Datastore/Migration/154_add_language_to_file_history_blacklist.cs b/src/NzbDrone.Core/Datastore/Migration/154_add_language_to_file_history_blacklist.cs index 499d587d0..25cf04c75 100644 --- a/src/NzbDrone.Core/Datastore/Migration/154_add_language_to_file_history_blacklist.cs +++ b/src/NzbDrone.Core/Datastore/Migration/154_add_language_to_file_history_blacklist.cs @@ -38,12 +38,12 @@ namespace NzbDrone.Core.Datastore.Migration var languageConverter = new EmbeddedDocumentConverter>(new LanguageIntConverter()); var profileLanguages = new Dictionary(); - using (IDbCommand getProfileCmd = conn.CreateCommand()) + using (var getProfileCmd = conn.CreateCommand()) { getProfileCmd.Transaction = tran; getProfileCmd.CommandText = "SELECT \"Id\", \"Language\" FROM \"Profiles\""; - IDataReader profilesReader = getProfileCmd.ExecuteReader(); + var profilesReader = getProfileCmd.ExecuteReader(); while (profilesReader.Read()) { var profileId = profilesReader.GetInt32(0); @@ -65,11 +65,11 @@ namespace NzbDrone.Core.Datastore.Migration var movieLanguages = new Dictionary(); - using (IDbCommand getSeriesCmd = conn.CreateCommand()) + using (var getSeriesCmd = conn.CreateCommand()) { getSeriesCmd.Transaction = tran; getSeriesCmd.CommandText = @"SELECT ""Id"", ""ProfileId"" FROM ""Movies"""; - using (IDataReader moviesReader = getSeriesCmd.ExecuteReader()) + using (var moviesReader = getSeriesCmd.ExecuteReader()) { while (moviesReader.Read()) { @@ -86,11 +86,11 @@ namespace NzbDrone.Core.Datastore.Migration var movieFileLanguages = new Dictionary>(); var releaseLanguages = new Dictionary>(); - using (IDbCommand getSeriesCmd = conn.CreateCommand()) + using (var getSeriesCmd = conn.CreateCommand()) { getSeriesCmd.Transaction = tran; getSeriesCmd.CommandText = @"SELECT ""Id"", ""MovieId"", ""SceneName"", ""MediaInfo"" FROM ""MovieFiles"""; - using (IDataReader movieFilesReader = getSeriesCmd.ExecuteReader()) + using (var movieFilesReader = getSeriesCmd.ExecuteReader()) { while (movieFilesReader.Read()) { @@ -136,11 +136,11 @@ namespace NzbDrone.Core.Datastore.Migration var historyLanguages = new Dictionary>(); - using (IDbCommand getSeriesCmd = conn.CreateCommand()) + using (var getSeriesCmd = conn.CreateCommand()) { getSeriesCmd.Transaction = tran; getSeriesCmd.CommandText = @"SELECT ""Id"", ""SourceTitle"", ""MovieId"" FROM ""History"""; - using (IDataReader historyReader = getSeriesCmd.ExecuteReader()) + using (var historyReader = getSeriesCmd.ExecuteReader()) { while (historyReader.Read()) { @@ -173,11 +173,11 @@ namespace NzbDrone.Core.Datastore.Migration var blacklistLanguages = new Dictionary>(); - using (IDbCommand getSeriesCmd = conn.CreateCommand()) + using (var getSeriesCmd = conn.CreateCommand()) { getSeriesCmd.Transaction = tran; getSeriesCmd.CommandText = @"SELECT ""Id"", ""SourceTitle"", ""MovieId"" FROM ""Blacklist"""; - using (IDataReader blacklistReader = getSeriesCmd.ExecuteReader()) + using (var blacklistReader = getSeriesCmd.ExecuteReader()) { while (blacklistReader.Read()) { @@ -209,7 +209,7 @@ namespace NzbDrone.Core.Datastore.Migration var movieFileIds = group.Select(v => v.ToString()).Join(","); - using (IDbCommand updateMovieFilesCmd = conn.CreateCommand()) + using (var updateMovieFilesCmd = conn.CreateCommand()) { updateMovieFilesCmd.Transaction = tran; if (conn.GetType().FullName == "Npgsql.NpgsqlConnection") @@ -235,7 +235,7 @@ namespace NzbDrone.Core.Datastore.Migration var historyIds = group.Select(v => v.ToString()).Join(","); - using (IDbCommand updateHistoryCmd = conn.CreateCommand()) + using (var updateHistoryCmd = conn.CreateCommand()) { updateHistoryCmd.Transaction = tran; if (conn.GetType().FullName == "Npgsql.NpgsqlConnection") @@ -261,7 +261,7 @@ namespace NzbDrone.Core.Datastore.Migration var blacklistIds = group.Select(v => v.ToString()).Join(","); - using (IDbCommand updateBlacklistCmd = conn.CreateCommand()) + using (var updateBlacklistCmd = conn.CreateCommand()) { updateBlacklistCmd.Transaction = tran; if (conn.GetType().FullName == "Npgsql.NpgsqlConnection") diff --git a/src/NzbDrone.Core/Datastore/Migration/180_fix_invalid_profile_references.cs b/src/NzbDrone.Core/Datastore/Migration/180_fix_invalid_profile_references.cs index 853307fca..8ecd155c6 100644 --- a/src/NzbDrone.Core/Datastore/Migration/180_fix_invalid_profile_references.cs +++ b/src/NzbDrone.Core/Datastore/Migration/180_fix_invalid_profile_references.cs @@ -77,7 +77,7 @@ namespace NzbDrone.Core.Datastore.Migration foreach (var profile in profiles.OrderBy(p => p.Id)) { - using (IDbCommand insertNewLanguageProfileCmd = conn.CreateCommand()) + using (var insertNewLanguageProfileCmd = conn.CreateCommand()) { insertNewLanguageProfileCmd.Transaction = tran; diff --git a/src/NzbDrone.Core/Datastore/Migration/187_swap_filechmod_for_folderchmod.cs b/src/NzbDrone.Core/Datastore/Migration/187_swap_filechmod_for_folderchmod.cs index 0316a72ea..96b50380f 100644 --- a/src/NzbDrone.Core/Datastore/Migration/187_swap_filechmod_for_folderchmod.cs +++ b/src/NzbDrone.Core/Datastore/Migration/187_swap_filechmod_for_folderchmod.cs @@ -17,7 +17,7 @@ namespace NzbDrone.Core.Datastore.Migration private void ConvertFileChmodToFolderChmod(IDbConnection conn, IDbTransaction tran) { - using (IDbCommand getFileChmodCmd = conn.CreateCommand()) + using (var getFileChmodCmd = conn.CreateCommand()) { getFileChmodCmd.Transaction = tran; getFileChmodCmd.CommandText = @"SELECT ""Value"" FROM ""Config"" WHERE ""Key"" = 'filechmod'"; @@ -32,7 +32,7 @@ namespace NzbDrone.Core.Datastore.Migration var folderChmodNum = fileChmodNum | ((fileChmodNum & 0x124) >> 2); var folderChmod = Convert.ToString(folderChmodNum, 8).PadLeft(3, '0'); - using (IDbCommand insertCmd = conn.CreateCommand()) + using (var insertCmd = conn.CreateCommand()) { insertCmd.Transaction = tran; insertCmd.CommandText = "INSERT INTO \"Config\" (\"Key\", \"Value\") VALUES ('chmodfolder', ?)"; @@ -42,7 +42,7 @@ namespace NzbDrone.Core.Datastore.Migration } } - using (IDbCommand deleteCmd = conn.CreateCommand()) + using (var deleteCmd = conn.CreateCommand()) { deleteCmd.Transaction = tran; deleteCmd.CommandText = "DELETE FROM \"Config\" WHERE \"Key\" = 'filechmod'"; diff --git a/src/NzbDrone.Core/Datastore/Migration/199_mediainfo_to_ffmpeg.cs b/src/NzbDrone.Core/Datastore/Migration/199_mediainfo_to_ffmpeg.cs index e3294e6b7..89bf8a7d4 100644 --- a/src/NzbDrone.Core/Datastore/Migration/199_mediainfo_to_ffmpeg.cs +++ b/src/NzbDrone.Core/Datastore/Migration/199_mediainfo_to_ffmpeg.cs @@ -748,7 +748,7 @@ namespace NzbDrone.Core.Datastore.Migration var tokens = mediaInfoLanguages.Split('/', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries).ToList(); var cultures = CultureInfo.GetCultures(CultureTypes.NeutralCultures); - for (int i = 0; i < tokens.Count; i++) + for (var i = 0; i < tokens.Count; i++) { if (tokens[i] == "Swedis") { diff --git a/src/NzbDrone.Core/Datastore/Migration/201_migrate_discord_from_slack.cs b/src/NzbDrone.Core/Datastore/Migration/201_migrate_discord_from_slack.cs index 668d2280a..178faeb3b 100644 --- a/src/NzbDrone.Core/Datastore/Migration/201_migrate_discord_from_slack.cs +++ b/src/NzbDrone.Core/Datastore/Migration/201_migrate_discord_from_slack.cs @@ -45,10 +45,10 @@ namespace NzbDrone.Core.Datastore.Migration return; } - foreach (NotificationEntity201 notification in discordSlackNotifications) + foreach (var notification in discordSlackNotifications) { - SlackNotificationSettings201 settings = JsonSerializer.Deserialize(notification.Settings, _serializerSettings); - DiscordNotificationSettings201 discordSettings = new DiscordNotificationSettings201 + var settings = JsonSerializer.Deserialize(notification.Settings, _serializerSettings); + var discordSettings = new DiscordNotificationSettings201 { Avatar = settings.Icon, GrabFields = new List { 0, 1, 2, 3, 5, 6, 7, 8, 9 }, diff --git a/src/NzbDrone.Core/Datastore/Migration/208_collections.cs b/src/NzbDrone.Core/Datastore/Migration/208_collections.cs index dfb58251a..d647d1129 100644 --- a/src/NzbDrone.Core/Datastore/Migration/208_collections.cs +++ b/src/NzbDrone.Core/Datastore/Migration/208_collections.cs @@ -60,7 +60,7 @@ namespace NzbDrone.Core.Datastore.Migration { while (definitionsReader.Read()) { - string path = definitionsReader.GetString(0); + var path = definitionsReader.GetString(0); rootPaths.Add(path); } } diff --git a/src/NzbDrone.Core/Datastore/Migration/Framework/SqliteSchemaDumper.cs b/src/NzbDrone.Core/Datastore/Migration/Framework/SqliteSchemaDumper.cs index c46be41ee..e4b79f730 100644 --- a/src/NzbDrone.Core/Datastore/Migration/Framework/SqliteSchemaDumper.cs +++ b/src/NzbDrone.Core/Datastore/Migration/Framework/SqliteSchemaDumper.cs @@ -201,7 +201,7 @@ namespace NzbDrone.Core.Datastore.Migration.Framework public virtual IList ReadDbSchema() { - IList tables = ReadTables(); + var tables = ReadTables(); foreach (var table in tables) { table.Indexes = ReadIndexes(table.SchemaName, table.Name); @@ -264,7 +264,7 @@ namespace NzbDrone.Core.Datastore.Migration.Framework protected virtual IList ReadIndexes(string schemaName, string tableName) { var sqlCommand = string.Format(@"SELECT type, name, sql FROM sqlite_master WHERE tbl_name = '{0}' AND type = 'index' AND name NOT LIKE 'sqlite_auto%';", tableName); - DataTable table = Read(sqlCommand).Tables[0]; + var table = Read(sqlCommand).Tables[0]; IList indexes = new List(); diff --git a/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs b/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs index e6cad2df9..ea4d2b562 100644 --- a/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs +++ b/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs @@ -203,7 +203,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge private JsonRpcRequestBuilder BuildRequest(DelugeSettings settings) { - string url = HttpRequestBuilder.BuildBaseUrl(settings.UseSsl, settings.Host, settings.Port, settings.UrlBase); + var url = HttpRequestBuilder.BuildBaseUrl(settings.UseSsl, settings.Host, settings.Port, settings.UrlBase); var requestBuilder = new JsonRpcRequestBuilder(url); requestBuilder.LogResponseContent = true; diff --git a/src/NzbDrone.Core/Download/Clients/DownloadStation/Proxies/DownloadStationTaskProxyV2.cs b/src/NzbDrone.Core/Download/Clients/DownloadStation/Proxies/DownloadStationTaskProxyV2.cs index fa76c1d0d..76222527f 100644 --- a/src/NzbDrone.Core/Download/Clients/DownloadStation/Proxies/DownloadStationTaskProxyV2.cs +++ b/src/NzbDrone.Core/Download/Clients/DownloadStation/Proxies/DownloadStationTaskProxyV2.cs @@ -39,7 +39,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation.Proxies else { _logger.Trace("No directory configured in settings; falling back to client default destination folder."); - string defaultDestination = _defaultDestinationProxy.GetDefaultDestination(settings); + var defaultDestination = _defaultDestinationProxy.GetDefaultDestination(settings); if (defaultDestination.IsNotNullOrWhiteSpace()) { @@ -72,7 +72,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation.Proxies else { _logger.Trace("No directory configured in settings; falling back to client default destination folder."); - string defaultDestination = _defaultDestinationProxy.GetDefaultDestination(settings); + var defaultDestination = _defaultDestinationProxy.GetDefaultDestination(settings); if (defaultDestination.IsNotNullOrWhiteSpace()) { diff --git a/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs b/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs index eb7793281..4df2f7281 100644 --- a/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs +++ b/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs @@ -65,7 +65,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation var items = new List(); long totalRemainingSize = 0; - long globalSpeed = nzbTasks.Where(t => t.Status == DownloadStationTaskStatus.Downloading) + var globalSpeed = nzbTasks.Where(t => t.Status == DownloadStationTaskStatus.Downloading) .Select(GetDownloadSpeed) .Sum(); diff --git a/src/NzbDrone.Core/Download/Clients/FreeboxDownload/FreeboxDownloadEncoding.cs b/src/NzbDrone.Core/Download/Clients/FreeboxDownload/FreeboxDownloadEncoding.cs index 0e12570aa..7c1ef310b 100644 --- a/src/NzbDrone.Core/Download/Clients/FreeboxDownload/FreeboxDownloadEncoding.cs +++ b/src/NzbDrone.Core/Download/Clients/FreeboxDownload/FreeboxDownloadEncoding.cs @@ -1,4 +1,4 @@ -namespace NzbDrone.Core.Download.Clients.FreeboxDownload +namespace NzbDrone.Core.Download.Clients.FreeboxDownload { public static class EncodingForBase64 { @@ -9,7 +9,7 @@ return null; } - byte[] textAsBytes = System.Text.Encoding.UTF8.GetBytes(text); + var textAsBytes = System.Text.Encoding.UTF8.GetBytes(text); return System.Convert.ToBase64String(textAsBytes); } @@ -20,7 +20,7 @@ return null; } - byte[] textAsBytes = System.Convert.FromBase64String(encodedText); + var textAsBytes = System.Convert.FromBase64String(encodedText); return System.Text.Encoding.UTF8.GetString(textAsBytes); } } diff --git a/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs index c4e6883c4..d1b5453d8 100644 --- a/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs +++ b/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs @@ -226,7 +226,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget protected IEnumerable GetCategories(Dictionary config) { - for (int i = 1; i < 100; i++) + for (var i = 1; i < 100; i++) { var name = config.GetValueOrDefault("Category" + i + ".Name"); diff --git a/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs b/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs index 0813bd266..70798f9f4 100644 --- a/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs +++ b/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs @@ -494,7 +494,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent return null; } - Dictionary labels = Proxy.GetLabels(Settings); + var labels = Proxy.GetLabels(Settings); if (Settings.MovieCategory.IsNotNullOrWhiteSpace() && !labels.ContainsKey(Settings.MovieCategory)) { diff --git a/src/NzbDrone.Core/Download/Clients/Sabnzbd/JsonConverters/SabnzbdStringArrayConverter.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/JsonConverters/SabnzbdStringArrayConverter.cs index bca2353a1..b5ab193ce 100644 --- a/src/NzbDrone.Core/Download/Clients/Sabnzbd/JsonConverters/SabnzbdStringArrayConverter.cs +++ b/src/NzbDrone.Core/Download/Clients/Sabnzbd/JsonConverters/SabnzbdStringArrayConverter.cs @@ -14,7 +14,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd.JsonConverters var stringArray = (string[])value; writer.WriteStartArray(); - for (int i = 0; i < stringArray.Length; i++) + for (var i = 0; i < stringArray.Length; i++) { writer.WriteValue(stringArray[i]); } diff --git a/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs b/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs index d4e3e6314..f0ebbfb13 100644 --- a/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs +++ b/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs @@ -119,7 +119,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent _logger.Debug("Retrieved metadata of {0} torrents in client", torrents.Count); var items = new List(); - foreach (RTorrentTorrent torrent in torrents) + foreach (var torrent in torrents) { // Don't concern ourselves with categories other than specified if (Settings.MovieCategory.IsNotNullOrWhiteSpace() && torrent.Category != Settings.MovieCategory) diff --git a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs index 3e566f95e..c5e581254 100644 --- a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs +++ b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs @@ -217,7 +217,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent { var config = _proxy.GetConfig(Settings); - OsPath destDir = new OsPath(null); + var destDir = new OsPath(null); if (config.GetValueOrDefault("dir_active_download_flag") == "true") { diff --git a/src/NzbDrone.Core/Download/Extensions/XmlExtensions.cs b/src/NzbDrone.Core/Download/Extensions/XmlExtensions.cs index bce66c8bc..b4571d6e8 100644 --- a/src/NzbDrone.Core/Download/Extensions/XmlExtensions.cs +++ b/src/NzbDrone.Core/Download/Extensions/XmlExtensions.cs @@ -32,13 +32,13 @@ namespace NzbDrone.Core.Download.Extensions public static long ElementAsLong(this XElement element, XName name) { var el = element.Element(name); - return long.TryParse(el?.Value, out long value) ? value : default; + return long.TryParse(el?.Value, out var value) ? value : default; } public static int ElementAsInt(this XElement element, XName name) { var el = element.Element(name); - return int.TryParse(el?.Value, out int value) ? value : default(int); + return int.TryParse(el?.Value, out var value) ? value : default(int); } public static int GetIntResponse(this XDocument document) diff --git a/src/NzbDrone.Core/Extras/ExtraService.cs b/src/NzbDrone.Core/Extras/ExtraService.cs index 255e75c4c..5bea60634 100644 --- a/src/NzbDrone.Core/Extras/ExtraService.cs +++ b/src/NzbDrone.Core/Extras/ExtraService.cs @@ -83,7 +83,7 @@ namespace NzbDrone.Core.Extras continue; } - for (int i = 0; i < _extraFileManagers.Count; i++) + for (var i = 0; i < _extraFileManagers.Count; i++) { if (_extraFileManagers[i].CanImportFile(localMovie, movieFile, file, extension, isReadOnly)) { @@ -93,7 +93,7 @@ namespace NzbDrone.Core.Extras } } - for (int i = 0; i < _extraFileManagers.Count; i++) + for (var i = 0; i < _extraFileManagers.Count; i++) { _extraFileManagers[i].ImportFiles(localMovie, movieFile, managedFiles[i], isReadOnly); } diff --git a/src/NzbDrone.Core/Extras/Others/OtherExtraService.cs b/src/NzbDrone.Core/Extras/Others/OtherExtraService.cs index 80fa48fdd..3873668da 100644 --- a/src/NzbDrone.Core/Extras/Others/OtherExtraService.cs +++ b/src/NzbDrone.Core/Extras/Others/OtherExtraService.cs @@ -133,7 +133,7 @@ namespace NzbDrone.Core.Extras.Others } } - foreach (string file in matchingFiles) + foreach (var file in matchingFiles) { try { diff --git a/src/NzbDrone.Core/Extras/Subtitles/SubtitleService.cs b/src/NzbDrone.Core/Extras/Subtitles/SubtitleService.cs index a6c050794..583ef0512 100644 --- a/src/NzbDrone.Core/Extras/Subtitles/SubtitleService.cs +++ b/src/NzbDrone.Core/Extras/Subtitles/SubtitleService.cs @@ -177,7 +177,7 @@ namespace NzbDrone.Core.Extras.Subtitles var subtitleFiles = new List(); - foreach (string file in matchingFiles) + foreach (var file in matchingFiles) { var language = LanguageParser.ParseSubtitleLanguage(file); var extension = Path.GetExtension(file); diff --git a/src/NzbDrone.Core/Fluent.cs b/src/NzbDrone.Core/Fluent.cs index cc507b242..37a775e96 100644 --- a/src/NzbDrone.Core/Fluent.cs +++ b/src/NzbDrone.Core/Fluent.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -95,17 +95,17 @@ namespace NzbDrone.Core } var cs = s.ToCharArray(); - int length = 0; - int i = 0; + var length = 0; + var i = 0; while (i < cs.Length) { - int charSize = 1; + var charSize = 1; if (i < (cs.Length - 1) && char.IsSurrogate(cs[i])) { charSize = 2; } - int byteSize = Encoding.UTF8.GetByteCount(cs, i, charSize); + var byteSize = Encoding.UTF8.GetByteCount(cs, i, charSize); if ((byteSize + length) <= maxLength) { i = i + charSize; diff --git a/src/NzbDrone.Core/HealthCheck/Checks/PackageGlobalMessageCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/PackageGlobalMessageCheck.cs index 9299088aa..18e1a9d0d 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/PackageGlobalMessageCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/PackageGlobalMessageCheck.cs @@ -22,7 +22,7 @@ namespace NzbDrone.Core.HealthCheck.Checks } var message = _deploymentInfoProvider.PackageGlobalMessage; - HealthCheckResult result = HealthCheckResult.Notice; + var result = HealthCheckResult.Notice; if (message.StartsWith("Error:")) { diff --git a/src/NzbDrone.Core/ImportLists/CouchPotato/CouchPotatoParser.cs b/src/NzbDrone.Core/ImportLists/CouchPotato/CouchPotatoParser.cs index f772836fc..7f0a26082 100644 --- a/src/NzbDrone.Core/ImportLists/CouchPotato/CouchPotatoParser.cs +++ b/src/NzbDrone.Core/ImportLists/CouchPotato/CouchPotatoParser.cs @@ -35,7 +35,7 @@ namespace NzbDrone.Core.ImportLists.CouchPotato foreach (var item in responseData) { - int tmdbid = item.info?.tmdb_id ?? 0; + var tmdbid = item.info?.tmdb_id ?? 0; // Fix weird error reported by Madmanali93 if (item.type != null && item.releases != null) @@ -54,7 +54,7 @@ namespace NzbDrone.Core.ImportLists.CouchPotato { // snatched,missing,available,downloaded // done,seeding - bool isCompleted = item.releases.Any(rel => (rel.status == "done" || rel.status == "seeding")); + var isCompleted = item.releases.Any(rel => (rel.status == "done" || rel.status == "seeding")); if (!isCompleted) { movies.AddIfNotNull(new ImportListMovie() diff --git a/src/NzbDrone.Core/ImportLists/FetchAndParseImportListService.cs b/src/NzbDrone.Core/ImportLists/FetchAndParseImportListService.cs index 5d9c3f452..82d4c67ec 100644 --- a/src/NzbDrone.Core/ImportLists/FetchAndParseImportListService.cs +++ b/src/NzbDrone.Core/ImportLists/FetchAndParseImportListService.cs @@ -68,7 +68,7 @@ namespace NzbDrone.Core.ImportLists var importListLocal = importList; var blockedLists = _importListStatusService.GetBlockedProviders().ToDictionary(v => v.ProviderId, v => v); - if (blockedLists.TryGetValue(importList.Definition.Id, out ImportListStatus blockedListStatus)) + if (blockedLists.TryGetValue(importList.Definition.Id, out var blockedListStatus)) { _logger.Debug("Temporarily ignoring list {0} till {1} due to recent failures.", importList.Definition.Name, blockedListStatus.DisabledTill.Value.ToLocalTime()); result.AnyFailure |= true; // Ensure we don't clean if a list is down diff --git a/src/NzbDrone.Core/ImportLists/HttpImportListBase.cs b/src/NzbDrone.Core/ImportLists/HttpImportListBase.cs index 4b0f54d3d..9ed678895 100644 --- a/src/NzbDrone.Core/ImportLists/HttpImportListBase.cs +++ b/src/NzbDrone.Core/ImportLists/HttpImportListBase.cs @@ -54,7 +54,7 @@ namespace NzbDrone.Core.ImportLists try { - for (int i = 0; i < pageableRequestChain.Tiers; i++) + for (var i = 0; i < pageableRequestChain.Tiers; i++) { var pageableRequests = pageableRequestChain.GetTier(i); foreach (var pageableRequest in pageableRequests) diff --git a/src/NzbDrone.Core/ImportLists/Plex/PlexParser.cs b/src/NzbDrone.Core/ImportLists/Plex/PlexParser.cs index 64c38858d..21032c5ec 100644 --- a/src/NzbDrone.Core/ImportLists/Plex/PlexParser.cs +++ b/src/NzbDrone.Core/ImportLists/Plex/PlexParser.cs @@ -36,7 +36,7 @@ namespace NzbDrone.Core.ImportLists.Plex var tmdbIdString = FindGuid(item.Guids, "tmdb"); var imdbId = FindGuid(item.Guids, "imdb"); - int.TryParse(tmdbIdString, out int tmdbId); + int.TryParse(tmdbIdString, out var tmdbId); movies.AddIfNotNull(new ImportListMovie() { diff --git a/src/NzbDrone.Core/IndexerSearch/MoviesSearchService.cs b/src/NzbDrone.Core/IndexerSearch/MoviesSearchService.cs index 1a62602aa..b9b5cd043 100644 --- a/src/NzbDrone.Core/IndexerSearch/MoviesSearchService.cs +++ b/src/NzbDrone.Core/IndexerSearch/MoviesSearchService.cs @@ -68,7 +68,7 @@ namespace NzbDrone.Core.IndexerSearch }; pagingSpec.FilterExpressions.Add(v => v.Monitored == true); - List movies = _movieService.MoviesWithoutFiles(pagingSpec).Records.ToList(); + var movies = _movieService.MoviesWithoutFiles(pagingSpec).Records.ToList(); var queue = _queueService.GetQueue().Where(q => q.Movie != null).Select(q => q.Movie.Id); var missing = movies.Where(e => !queue.Contains(e.Id)).ToList(); @@ -88,7 +88,7 @@ namespace NzbDrone.Core.IndexerSearch pagingSpec.FilterExpressions.Add(v => v.Monitored == true); - List movies = _movieCutoffService.MoviesWhereCutoffUnmet(pagingSpec).Records.ToList(); + var movies = _movieCutoffService.MoviesWhereCutoffUnmet(pagingSpec).Records.ToList(); var queue = _queueService.GetQueue().Where(q => q.Movie != null).Select(q => q.Movie.Id); var missing = movies.Where(e => !queue.Contains(e.Id)).ToList(); diff --git a/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs b/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs index 531daeb9d..f1f44f604 100644 --- a/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs +++ b/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs @@ -113,7 +113,7 @@ namespace NzbDrone.Core.Indexers lastReleaseInfo = _indexerStatusService.GetLastRssSyncReleaseInfo(Definition.Id); } - for (int i = 0; i < pageableRequestChain.Tiers; i++) + for (var i = 0; i < pageableRequestChain.Tiers; i++) { var pageableRequests = pageableRequestChain.GetTier(i); diff --git a/src/NzbDrone.Core/Languages/Language.cs b/src/NzbDrone.Core/Languages/Language.cs index 59d6fdd26..edd189c57 100644 --- a/src/NzbDrone.Core/Languages/Language.cs +++ b/src/NzbDrone.Core/Languages/Language.cs @@ -184,7 +184,7 @@ namespace NzbDrone.Core.Languages return Unknown; } - Language language = All.FirstOrDefault(v => v.Id == id); + var language = All.FirstOrDefault(v => v.Id == id); if (language == null) { diff --git a/src/NzbDrone.Core/MediaCover/MediaCoverService.cs b/src/NzbDrone.Core/MediaCover/MediaCoverService.cs index 29bca824b..33a8ae23e 100644 --- a/src/NzbDrone.Core/MediaCover/MediaCoverService.cs +++ b/src/NzbDrone.Core/MediaCover/MediaCoverService.cs @@ -147,7 +147,7 @@ namespace NzbDrone.Core.MediaCover private bool EnsureCovers(Movie movie) { - bool updated = false; + var updated = false; var toResize = new List>(); foreach (var cover in movie.MovieMetadata.Value.Images) diff --git a/src/NzbDrone.Core/MediaFiles/MovieImport/Manual/ManualImportService.cs b/src/NzbDrone.Core/MediaFiles/MovieImport/Manual/ManualImportService.cs index 6cb3d0af4..4e5314771 100644 --- a/src/NzbDrone.Core/MediaFiles/MovieImport/Manual/ManualImportService.cs +++ b/src/NzbDrone.Core/MediaFiles/MovieImport/Manual/ManualImportService.cs @@ -329,7 +329,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Manual var imported = new List(); var importedTrackedDownload = new List(); - for (int i = 0; i < message.Files.Count; i++) + for (var i = 0; i < message.Files.Count; i++) { _logger.ProgressTrace("Processing file {0} of {1}", i + 1, message.Files.Count); diff --git a/src/NzbDrone.Core/MediaFiles/MovieImport/Specifications/NotUnpackingSpecification.cs b/src/NzbDrone.Core/MediaFiles/MovieImport/Specifications/NotUnpackingSpecification.cs index 92921f530..54aff4a63 100644 --- a/src/NzbDrone.Core/MediaFiles/MovieImport/Specifications/NotUnpackingSpecification.cs +++ b/src/NzbDrone.Core/MediaFiles/MovieImport/Specifications/NotUnpackingSpecification.cs @@ -33,7 +33,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Specifications foreach (var workingFolder in _configService.DownloadClientWorkingFolders.Split('|')) { - DirectoryInfo parent = Directory.GetParent(localMovie.Path); + var parent = Directory.GetParent(localMovie.Path); while (parent != null) { if (parent.Name.StartsWith(workingFolder)) diff --git a/src/NzbDrone.Core/Messaging/Commands/CommandExecutor.cs b/src/NzbDrone.Core/Messaging/Commands/CommandExecutor.cs index e3d06d26d..9a6f01edc 100644 --- a/src/NzbDrone.Core/Messaging/Commands/CommandExecutor.cs +++ b/src/NzbDrone.Core/Messaging/Commands/CommandExecutor.cs @@ -125,8 +125,8 @@ namespace NzbDrone.Core.Messaging.Commands _cancellationTokenSource = new CancellationTokenSource(); var envLimit = Environment.GetEnvironmentVariable("THREAD_LIMIT") ?? $"{THREAD_LIMIT}"; - int threadLimit = THREAD_LIMIT; - if (int.TryParse(envLimit, out int parsedLimit)) + var threadLimit = THREAD_LIMIT; + if (int.TryParse(envLimit, out var parsedLimit)) { threadLimit = parsedLimit; } @@ -136,7 +136,7 @@ namespace NzbDrone.Core.Messaging.Commands _logger.Info("Starting {} threads for tasks.", threadLimit); - for (int i = 0; i < threadLimit + 1; i++) + for (var i = 0; i < threadLimit + 1; i++) { var thread = new Thread(ExecuteCommands); thread.Start(); diff --git a/src/NzbDrone.Core/Messaging/Commands/CommandQueueManager.cs b/src/NzbDrone.Core/Messaging/Commands/CommandQueueManager.cs index c2accb8c4..7be373e79 100644 --- a/src/NzbDrone.Core/Messaging/Commands/CommandQueueManager.cs +++ b/src/NzbDrone.Core/Messaging/Commands/CommandQueueManager.cs @@ -139,7 +139,7 @@ namespace NzbDrone.Core.Messaging.Commands public CommandModel Push(string commandName, DateTime? lastExecutionTime, DateTime? lastStartTime, CommandPriority priority = CommandPriority.Normal, CommandTrigger trigger = CommandTrigger.Unspecified) { - dynamic command = GetCommand(commandName); + var command = GetCommand(commandName); command.LastExecutionTime = lastExecutionTime; command.LastStartTime = lastStartTime; command.Trigger = trigger; diff --git a/src/NzbDrone.Core/MetadataSource/SearchMovieComparer.cs b/src/NzbDrone.Core/MetadataSource/SearchMovieComparer.cs index 50bd18bbd..dc23bba7f 100644 --- a/src/NzbDrone.Core/MetadataSource/SearchMovieComparer.cs +++ b/src/NzbDrone.Core/MetadataSource/SearchMovieComparer.cs @@ -35,7 +35,7 @@ namespace NzbDrone.Core.MetadataSource public int Compare(Movie x, Movie y) { - int result = 0; + var result = 0; // Prefer exact matches result = Compare(x, y, s => CleanPunctuation(s.Title).Equals(CleanPunctuation(SearchQuery))); diff --git a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs index 4703c0110..b8a17e369 100644 --- a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs +++ b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs @@ -427,7 +427,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook { var slug = lowerTitle.Split(':')[1].Trim(); - string imdbid = slug; + var imdbid = slug; if (slug.IsNullOrWhiteSpace() || slug.Any(char.IsWhiteSpace)) { @@ -449,7 +449,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook { var slug = lowerTitle.Split(':')[1].Trim(); - int tmdbid = -1; + var tmdbid = -1; if (slug.IsNullOrWhiteSpace() || slug.Any(char.IsWhiteSpace) || !int.TryParse(slug, out tmdbid)) { diff --git a/src/NzbDrone.Core/Movies/AlternativeTitles/AlternativeTitleService.cs b/src/NzbDrone.Core/Movies/AlternativeTitles/AlternativeTitleService.cs index 58ae90d45..ac1db0f61 100644 --- a/src/NzbDrone.Core/Movies/AlternativeTitles/AlternativeTitleService.cs +++ b/src/NzbDrone.Core/Movies/AlternativeTitles/AlternativeTitleService.cs @@ -70,7 +70,7 @@ namespace NzbDrone.Core.Movies.AlternativeTitles public List UpdateTitles(List titles, MovieMetadata movieMetadata) { - int movieMetadataId = movieMetadata.Id; + var movieMetadataId = movieMetadata.Id; // First update the movie ids so we can correlate them later. titles.ForEach(t => t.MovieMetadataId = movieMetadataId); diff --git a/src/NzbDrone.Core/Movies/Credits/CreditService.cs b/src/NzbDrone.Core/Movies/Credits/CreditService.cs index cf6743612..9718b2ede 100644 --- a/src/NzbDrone.Core/Movies/Credits/CreditService.cs +++ b/src/NzbDrone.Core/Movies/Credits/CreditService.cs @@ -59,7 +59,7 @@ namespace NzbDrone.Core.Movies.Credits public List UpdateCredits(List credits, MovieMetadata movieMetadata) { - int movieMetadataId = movieMetadata.Id; + var movieMetadataId = movieMetadata.Id; // First update the movie ids so we can correlate them later. credits.ForEach(t => t.MovieMetadataId = movieMetadataId); diff --git a/src/NzbDrone.Core/Movies/MovieMetadataRepository.cs b/src/NzbDrone.Core/Movies/MovieMetadataRepository.cs index 0007f6138..8c9642bb6 100644 --- a/src/NzbDrone.Core/Movies/MovieMetadataRepository.cs +++ b/src/NzbDrone.Core/Movies/MovieMetadataRepository.cs @@ -88,7 +88,7 @@ namespace NzbDrone.Core.Movies var existingMetadata = FindById(data.Select(x => x.TmdbId).ToList()); var updateMetadataList = new List(); var addMetadataList = new List(); - int upToDateMetadataCount = 0; + var upToDateMetadataCount = 0; foreach (var meta in data) { diff --git a/src/NzbDrone.Core/Movies/Translations/MovieTranslationService.cs b/src/NzbDrone.Core/Movies/Translations/MovieTranslationService.cs index f531ea55d..6668cbc30 100644 --- a/src/NzbDrone.Core/Movies/Translations/MovieTranslationService.cs +++ b/src/NzbDrone.Core/Movies/Translations/MovieTranslationService.cs @@ -43,7 +43,7 @@ namespace NzbDrone.Core.Movies.Translations public List UpdateTranslations(List translations, MovieMetadata movieMetadata) { - int movieMetadataId = movieMetadata.Id; + var movieMetadataId = movieMetadata.Id; // First update the movie ids so we can correlate them later translations.ForEach(t => t.MovieMetadataId = movieMetadataId); diff --git a/src/NzbDrone.Core/Notifications/Discord/Discord.cs b/src/NzbDrone.Core/Notifications/Discord/Discord.cs index f5c83dcaf..0bff06b9e 100644 --- a/src/NzbDrone.Core/Notifications/Discord/Discord.cs +++ b/src/NzbDrone.Core/Notifications/Discord/Discord.cs @@ -247,7 +247,7 @@ namespace NzbDrone.Core.Notifications.Discord { var attachments = new List(); - foreach (RenamedMovieFile renamedFile in renamedFiles) + foreach (var renamedFile in renamedFiles) { attachments.Add(new Embed { diff --git a/src/NzbDrone.Core/Notifications/NotificationService.cs b/src/NzbDrone.Core/Notifications/NotificationService.cs index c3ea11b66..d85785648 100644 --- a/src/NzbDrone.Core/Notifications/NotificationService.cs +++ b/src/NzbDrone.Core/Notifications/NotificationService.cs @@ -300,7 +300,7 @@ namespace NzbDrone.Core.Notifications public void Handle(MoviesDeletedEvent message) { - foreach (Movie movie in message.Movies) + foreach (var movie in message.Movies) { var deleteMessage = new MovieDeleteMessage(movie, message.DeleteFiles); diff --git a/src/NzbDrone.Core/Notifications/Slack/Slack.cs b/src/NzbDrone.Core/Notifications/Slack/Slack.cs index 91de96a78..b1ea493a1 100644 --- a/src/NzbDrone.Core/Notifications/Slack/Slack.cs +++ b/src/NzbDrone.Core/Notifications/Slack/Slack.cs @@ -60,7 +60,7 @@ namespace NzbDrone.Core.Notifications.Slack { var attachments = new List(); - foreach (RenamedMovieFile renamedFile in renamedFiles) + foreach (var renamedFile in renamedFiles) { attachments.Add(new Attachment { diff --git a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs index a363054cc..bf897514f 100644 --- a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs +++ b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs @@ -224,11 +224,11 @@ namespace NzbDrone.Core.Organizer { var colonReplacementFormat = colonReplacement.GetFormatString(); - string result = name; + var result = name; string[] badCharacters = { "\\", "/", "<", ">", "?", "*", ":", "|", "\"" }; string[] goodCharacters = { "+", "+", "", "", "!", "-", colonReplacementFormat, "", "" }; - for (int i = 0; i < badCharacters.Length; i++) + for (var i = 0; i < badCharacters.Length; i++) { result = result.Replace(badCharacters[i], replace ? goodCharacters[i] : string.Empty); } @@ -414,7 +414,7 @@ namespace NzbDrone.Core.Organizer } } - for (int i = 0; i < tokens.Count; i++) + for (var i = 0; i < tokens.Count; i++) { try { diff --git a/src/NzbDrone.Core/Parser/LanguageParser.cs b/src/NzbDrone.Core/Parser/LanguageParser.cs index 3e6df0724..64e6716b8 100644 --- a/src/NzbDrone.Core/Parser/LanguageParser.cs +++ b/src/NzbDrone.Core/Parser/LanguageParser.cs @@ -393,7 +393,7 @@ namespace NzbDrone.Core.Parser return isoLanguage?.Language ?? Language.Unknown; } - foreach (Language language in Language.All) + foreach (var language in Language.All) { if (simpleFilename.EndsWith(language.ToString(), StringComparison.OrdinalIgnoreCase)) { diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index a1872ef57..558b325e5 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -437,7 +437,7 @@ namespace NzbDrone.Core.Parser value = Regex.Replace(value, @"\s", "-", RegexOptions.Compiled); // Should invalid characters be replaced with dash or empty string? - string replaceCharacter = invalidDashReplacement ? "-" : string.Empty; + var replaceCharacter = invalidDashReplacement ? "-" : string.Empty; // Remove invalid chars value = Regex.Replace(value, @"[^a-z0-9\s-_]", replaceCharacter, RegexOptions.Compiled); @@ -593,9 +593,9 @@ namespace NzbDrone.Core.Parser var parts = movieName.Split('.'); movieName = ""; - int n = 0; - bool previousAcronym = false; - string nextPart = ""; + var n = 0; + var previousAcronym = false; + var nextPart = ""; foreach (var part in parts) { if (parts.Length >= n + 2) diff --git a/src/NzbDrone.Core/Parser/RomanNumerals/RomanNumeral.cs b/src/NzbDrone.Core/Parser/RomanNumerals/RomanNumeral.cs index ff3f03596..19795c643 100644 --- a/src/NzbDrone.Core/Parser/RomanNumerals/RomanNumeral.cs +++ b/src/NzbDrone.Core/Parser/RomanNumerals/RomanNumeral.cs @@ -95,9 +95,9 @@ namespace NzbDrone.Core.Parser.RomanNumerals } text = text.ToUpper(); - int len = 0; + var len = 0; - for (int i = 0; i < 3; i++) + for (var i = 0; i < 3; i++) { if (text.StartsWith(Thousands[i])) { @@ -113,7 +113,7 @@ namespace NzbDrone.Core.Parser.RomanNumerals len = 0; } - for (int i = 0; i < 9; i++) + for (var i = 0; i < 9; i++) { if (text.StartsWith(Hundreds[i])) { @@ -129,7 +129,7 @@ namespace NzbDrone.Core.Parser.RomanNumerals len = 0; } - for (int i = 0; i < 9; i++) + for (var i = 0; i < 9; i++) { if (text.StartsWith(Tens[i])) { @@ -145,7 +145,7 @@ namespace NzbDrone.Core.Parser.RomanNumerals len = 0; } - for (int i = 0; i < 9; i++) + for (var i = 0; i < 9; i++) { if (text.StartsWith(Units[i])) { diff --git a/src/NzbDrone.Core/Parser/RomanNumerals/RomanNumeralParser.cs b/src/NzbDrone.Core/Parser/RomanNumerals/RomanNumeralParser.cs index a898fc174..4ca73cf12 100644 --- a/src/NzbDrone.Core/Parser/RomanNumerals/RomanNumeralParser.cs +++ b/src/NzbDrone.Core/Parser/RomanNumerals/RomanNumeralParser.cs @@ -26,32 +26,32 @@ namespace NzbDrone.Core.Parser.RomanNumerals _arabicRomanNumeralsMapping = new HashSet(); _simpleArabicNumeralMappings = new Dictionary(); - foreach (int arabicNumeral in Enumerable.Range(1, DICTIONARY_PREPOPULATION_SIZE + 1)) + foreach (var arabicNumeral in Enumerable.Range(1, DICTIONARY_PREPOPULATION_SIZE + 1)) { GenerateRomanNumerals(arabicNumeral, out var romanNumeralAsString, out var arabicNumeralAsString); - ArabicRomanNumeral arm = new ArabicRomanNumeral(arabicNumeral, arabicNumeralAsString, romanNumeralAsString); + var arm = new ArabicRomanNumeral(arabicNumeral, arabicNumeralAsString, romanNumeralAsString); _arabicRomanNumeralsMapping.Add(arm); - SimpleArabicNumeral sam = new SimpleArabicNumeral(arabicNumeral); - SimpleRomanNumeral srm = new SimpleRomanNumeral(romanNumeralAsString); + var sam = new SimpleArabicNumeral(arabicNumeral); + var srm = new SimpleRomanNumeral(romanNumeralAsString); _simpleArabicNumeralMappings.Add(sam, srm); } } private static void GenerateRomanNumerals(int arabicNumeral, out string romanNumeral, out string arabicNumeralAsString) { - RomanNumeral romanNumeralObject = new RomanNumeral(arabicNumeral); + var romanNumeralObject = new RomanNumeral(arabicNumeral); romanNumeral = romanNumeralObject.ToRomanNumeral(); arabicNumeralAsString = Convert.ToString(arabicNumeral); } private static HashSet GenerateAdditionalMappings(int offset, int length) { - HashSet additionalArabicRomanNumerals = new HashSet(); - foreach (int arabicNumeral in Enumerable.Range(offset, length)) + var additionalArabicRomanNumerals = new HashSet(); + foreach (var arabicNumeral in Enumerable.Range(offset, length)) { GenerateRomanNumerals(arabicNumeral, out var romanNumeral, out var arabicNumeralAsString); - ArabicRomanNumeral arm = new ArabicRomanNumeral(arabicNumeral, arabicNumeralAsString, romanNumeral); + var arm = new ArabicRomanNumeral(arabicNumeral, arabicNumeralAsString, romanNumeral); additionalArabicRomanNumerals.Add(arm); } @@ -78,7 +78,7 @@ namespace NzbDrone.Core.Parser.RomanNumerals return new HashSet(_arabicRomanNumeralsMapping.Take(upToArabicNumber)); } - HashSet largerMapping = GenerateAdditionalMappings(DICTIONARY_PREPOPULATION_SIZE + 1, upToArabicNumber); + var largerMapping = GenerateAdditionalMappings(DICTIONARY_PREPOPULATION_SIZE + 1, upToArabicNumber); _arabicRomanNumeralsMapping = (HashSet)_arabicRomanNumeralsMapping.Union(largerMapping); } @@ -123,12 +123,12 @@ namespace NzbDrone.Core.Parser.RomanNumerals private static Dictionary GenerateAdditionalSimpleNumerals(int offset, int length) { - Dictionary moreNumerals = new Dictionary(); - foreach (int arabicNumeral in Enumerable.Range(offset, length)) + var moreNumerals = new Dictionary(); + foreach (var arabicNumeral in Enumerable.Range(offset, length)) { GenerateRomanNumerals(arabicNumeral, out var romanNumeral, out _); - SimpleArabicNumeral san = new SimpleArabicNumeral(arabicNumeral); - SimpleRomanNumeral srn = new SimpleRomanNumeral(romanNumeral); + var san = new SimpleArabicNumeral(arabicNumeral); + var srn = new SimpleRomanNumeral(romanNumeral); moreNumerals.Add(san, srn); } diff --git a/src/NzbDrone.Core/Profiles/Delay/DelayProfileService.cs b/src/NzbDrone.Core/Profiles/Delay/DelayProfileService.cs index 0179205d4..b71f80dd4 100644 --- a/src/NzbDrone.Core/Profiles/Delay/DelayProfileService.cs +++ b/src/NzbDrone.Core/Profiles/Delay/DelayProfileService.cs @@ -53,7 +53,7 @@ namespace NzbDrone.Core.Profiles.Delay var all = All().OrderBy(d => d.Order).ToList(); - for (int i = 0; i < all.Count; i++) + for (var i = 0; i < all.Count; i++) { if (all[i].Id == 1) { diff --git a/src/NzbDrone.Core/Qualities/QualityDefinitionService.cs b/src/NzbDrone.Core/Qualities/QualityDefinitionService.cs index 968a69407..0aea96a75 100644 --- a/src/NzbDrone.Core/Qualities/QualityDefinitionService.cs +++ b/src/NzbDrone.Core/Qualities/QualityDefinitionService.cs @@ -66,8 +66,8 @@ namespace NzbDrone.Core.Qualities private void InsertMissingDefinitions() { - List insertList = new List(); - List updateList = new List(); + var insertList = new List(); + var updateList = new List(); var allDefinitions = Quality.DefaultQualityDefinitions.OrderBy(d => d.Weight).ToList(); var existingDefinitions = _repo.All().ToList(); @@ -110,7 +110,7 @@ namespace NzbDrone.Core.Qualities public void Execute(ResetQualityDefinitionsCommand message) { - List updateList = new List(); + var updateList = new List(); var allDefinitions = Quality.DefaultQualityDefinitions.OrderBy(d => d.Weight).ToList(); var existingDefinitions = _repo.All().ToList(); diff --git a/src/NzbDrone.Core/Qualities/QualityModel.cs b/src/NzbDrone.Core/Qualities/QualityModel.cs index cf4216ff1..befe1019b 100644 --- a/src/NzbDrone.Core/Qualities/QualityModel.cs +++ b/src/NzbDrone.Core/Qualities/QualityModel.cs @@ -43,7 +43,7 @@ namespace NzbDrone.Core.Qualities // Overflow is fine, just wrap unchecked { - int hash = 17; + var hash = 17; hash = (hash * 23) + Revision.GetHashCode(); hash = (hash * 23) + Quality.GetHashCode(); return hash; diff --git a/src/NzbDrone.Core/Qualities/QualityModelComparer.cs b/src/NzbDrone.Core/Qualities/QualityModelComparer.cs index c4bf4b65a..710e3fda1 100644 --- a/src/NzbDrone.Core/Qualities/QualityModelComparer.cs +++ b/src/NzbDrone.Core/Qualities/QualityModelComparer.cs @@ -44,7 +44,7 @@ namespace NzbDrone.Core.Qualities public int Compare(QualityModel left, QualityModel right, bool respectGroupOrder) { - int result = Compare(left.Quality, right.Quality, respectGroupOrder); + var result = Compare(left.Quality, right.Quality, respectGroupOrder); if (result == 0) { diff --git a/src/NzbDrone.Core/Validation/Paths/MovieExistsValidator.cs b/src/NzbDrone.Core/Validation/Paths/MovieExistsValidator.cs index 1e45a23a7..1938eceec 100644 --- a/src/NzbDrone.Core/Validation/Paths/MovieExistsValidator.cs +++ b/src/NzbDrone.Core/Validation/Paths/MovieExistsValidator.cs @@ -21,7 +21,7 @@ namespace NzbDrone.Core.Validation.Paths return true; } - int tmdbId = (int)context.PropertyValue; + var tmdbId = (int)context.PropertyValue; return _movieService.FindByTmdbId(tmdbId) == null; } diff --git a/src/NzbDrone.Mono.Test/DiskProviderTests/DiskProviderFixture.cs b/src/NzbDrone.Mono.Test/DiskProviderTests/DiskProviderFixture.cs index 25a02fd43..a09a68a98 100644 --- a/src/NzbDrone.Mono.Test/DiskProviderTests/DiskProviderFixture.cs +++ b/src/NzbDrone.Mono.Test/DiskProviderTests/DiskProviderFixture.cs @@ -58,7 +58,7 @@ namespace NzbDrone.Mono.Test.DiskProviderTests { // Remove Write permissions, we're still owner so we can clean it up, but we'll have to do that explicitly. Syscall.stat(path, out var stat); - FilePermissions mode = stat.st_mode; + var mode = stat.st_mode; if (writable) { diff --git a/src/NzbDrone.Mono/EnvironmentInfo/VersionAdapters/ReleaseFileVersionAdapter.cs b/src/NzbDrone.Mono/EnvironmentInfo/VersionAdapters/ReleaseFileVersionAdapter.cs index 78dcceec6..9347176b2 100644 --- a/src/NzbDrone.Mono/EnvironmentInfo/VersionAdapters/ReleaseFileVersionAdapter.cs +++ b/src/NzbDrone.Mono/EnvironmentInfo/VersionAdapters/ReleaseFileVersionAdapter.cs @@ -28,7 +28,7 @@ namespace NzbDrone.Mono.EnvironmentInfo.VersionAdapters var fullName = ""; var version = ""; - bool success = false; + var success = false; foreach (var releaseFile in releaseFiles) { diff --git a/src/NzbDrone.Test.Common/ConcurrencyCounter.cs b/src/NzbDrone.Test.Common/ConcurrencyCounter.cs index f3c12023f..a6a07118b 100644 --- a/src/NzbDrone.Test.Common/ConcurrencyCounter.cs +++ b/src/NzbDrone.Test.Common/ConcurrencyCounter.cs @@ -27,7 +27,7 @@ namespace NzbDrone.Test.Common public int Start() { - int threadId = Environment.CurrentManagedThreadId; + var threadId = Environment.CurrentManagedThreadId; lock (_mutex) { _threads[threadId] = 1; diff --git a/src/NzbDrone.Test.Common/ExceptionVerification.cs b/src/NzbDrone.Test.Common/ExceptionVerification.cs index 4ead02b8f..413769fd9 100644 --- a/src/NzbDrone.Test.Common/ExceptionVerification.cs +++ b/src/NzbDrone.Test.Common/ExceptionVerification.cs @@ -44,10 +44,10 @@ namespace NzbDrone.Test.Common private static string GetLogsString(IEnumerable logs) { - string errors = ""; + var errors = ""; foreach (var log in logs) { - string exception = ""; + var exception = ""; if (log.Exception != null) { exception = string.Format("[{0}: {1}]", log.Exception.GetType(), log.Exception.Message); diff --git a/src/NzbDrone.Update.Test/StartNzbDroneService.cs b/src/NzbDrone.Update.Test/StartNzbDroneService.cs index 87b80469d..6497799e9 100644 --- a/src/NzbDrone.Update.Test/StartNzbDroneService.cs +++ b/src/NzbDrone.Update.Test/StartNzbDroneService.cs @@ -17,7 +17,7 @@ namespace NzbDrone.Update.Test [Test] public void should_start_service_if_app_type_was_serivce() { - string targetFolder = "c:\\Radarr\\".AsOsAgnostic(); + var targetFolder = "c:\\Radarr\\".AsOsAgnostic(); Subject.Start(AppType.Service, targetFolder); @@ -27,8 +27,8 @@ namespace NzbDrone.Update.Test [Test] public void should_start_console_if_app_type_was_service_but_start_failed_because_of_permissions() { - string targetFolder = "c:\\Radarr\\".AsOsAgnostic(); - string targetProcess = "c:\\Radarr\\Radarr.Console".AsOsAgnostic().ProcessNameToExe(); + var targetFolder = "c:\\Radarr\\".AsOsAgnostic(); + var targetProcess = "c:\\Radarr\\Radarr.Console".AsOsAgnostic().ProcessNameToExe(); Mocker.GetMock().Setup(c => c.Start(ServiceProvider.SERVICE_NAME)).Throws(new InvalidOperationException()); diff --git a/src/NzbDrone.Update/UpdateEngine/InstallUpdateService.cs b/src/NzbDrone.Update/UpdateEngine/InstallUpdateService.cs index 1e67e653f..2d64c27e6 100644 --- a/src/NzbDrone.Update/UpdateEngine/InstallUpdateService.cs +++ b/src/NzbDrone.Update/UpdateEngine/InstallUpdateService.cs @@ -153,7 +153,7 @@ namespace NzbDrone.Update.UpdateEngine _terminateNzbDrone.Terminate(processId); _logger.Info("Waiting for external auto-restart."); - for (int i = 0; i < 10; i++) + for (var i = 0; i < 10; i++) { System.Threading.Thread.Sleep(1000); diff --git a/src/NzbDrone.Windows.Test/DiskProviderTests/FreeSpaceFixture.cs b/src/NzbDrone.Windows.Test/DiskProviderTests/FreeSpaceFixture.cs index 644100a0c..1cda90713 100644 --- a/src/NzbDrone.Windows.Test/DiskProviderTests/FreeSpaceFixture.cs +++ b/src/NzbDrone.Windows.Test/DiskProviderTests/FreeSpaceFixture.cs @@ -19,7 +19,7 @@ namespace NzbDrone.Windows.Test.DiskProviderTests public void should_throw_if_drive_doesnt_exist() { // Find a drive that doesn't exist. - for (char driveletter = 'Z'; driveletter > 'D'; driveletter--) + for (var driveletter = 'Z'; driveletter > 'D'; driveletter--) { if (new DriveInfo(driveletter.ToString()).IsReady) { diff --git a/src/Radarr.Api.V3/Calendar/CalendarFeedController.cs b/src/Radarr.Api.V3/Calendar/CalendarFeedController.cs index 377561f62..c84c0d635 100644 --- a/src/Radarr.Api.V3/Calendar/CalendarFeedController.cs +++ b/src/Radarr.Api.V3/Calendar/CalendarFeedController.cs @@ -68,8 +68,8 @@ namespace Radarr.Api.V3.Calendar private void CreateEvent(Ical.Net.Calendar calendar, MovieMetadata movie, string releaseType) { var date = movie.InCinemas; - string eventType = "_cinemas"; - string summaryText = "(Theatrical Release)"; + var eventType = "_cinemas"; + var summaryText = "(Theatrical Release)"; if (releaseType == "digital") { diff --git a/src/Radarr.Api.V3/ExtraFiles/ExtraFileController.cs b/src/Radarr.Api.V3/ExtraFiles/ExtraFileController.cs index da69d1b67..4d8ec87d3 100644 --- a/src/Radarr.Api.V3/ExtraFiles/ExtraFileController.cs +++ b/src/Radarr.Api.V3/ExtraFiles/ExtraFileController.cs @@ -27,9 +27,9 @@ namespace Radarr.Api.V3.ExtraFiles { var extraFiles = new List(); - List subtitleFiles = _subtitleFileService.GetFilesByMovie(movieId); - List metadataFiles = _metadataFileService.GetFilesByMovie(movieId); - List otherExtraFiles = _otherFileService.GetFilesByMovie(movieId); + var subtitleFiles = _subtitleFileService.GetFilesByMovie(movieId); + var metadataFiles = _metadataFileService.GetFilesByMovie(movieId); + var otherExtraFiles = _otherFileService.GetFilesByMovie(movieId); extraFiles.AddRange(subtitleFiles.ToResource()); extraFiles.AddRange(metadataFiles.ToResource()); diff --git a/src/Radarr.Api.V3/Logs/LogFileControllerBase.cs b/src/Radarr.Api.V3/Logs/LogFileControllerBase.cs index cd75a33fa..03fc37191 100644 --- a/src/Radarr.Api.V3/Logs/LogFileControllerBase.cs +++ b/src/Radarr.Api.V3/Logs/LogFileControllerBase.cs @@ -32,7 +32,7 @@ namespace Radarr.Api.V3.Logs var files = GetLogFiles().ToList(); - for (int i = 0; i < files.Count; i++) + for (var i = 0; i < files.Count; i++) { var file = files[i]; var filename = Path.GetFileName(file); diff --git a/src/Radarr.Api.V3/Movies/MovieResource.cs b/src/Radarr.Api.V3/Movies/MovieResource.cs index d9d8f3cf7..9c03439cd 100644 --- a/src/Radarr.Api.V3/Movies/MovieResource.cs +++ b/src/Radarr.Api.V3/Movies/MovieResource.cs @@ -87,9 +87,9 @@ namespace Radarr.Api.V3.Movies return null; } - long size = model.MovieFile?.Size ?? 0; + var size = model.MovieFile?.Size ?? 0; - MovieFileResource movieFile = model.MovieFile?.ToResource(model, upgradableSpecification); + var movieFile = model.MovieFile?.ToResource(model, upgradableSpecification); var translatedTitle = movieTranslation?.Title ?? model.Title; var translatedOverview = movieTranslation?.Overview ?? model.MovieMetadata.Value.Overview; diff --git a/src/Radarr.Http/ClientSchema/SchemaBuilder.cs b/src/Radarr.Http/ClientSchema/SchemaBuilder.cs index e528221d1..c6eee62b1 100644 --- a/src/Radarr.Http/ClientSchema/SchemaBuilder.cs +++ b/src/Radarr.Http/ClientSchema/SchemaBuilder.cs @@ -72,7 +72,7 @@ namespace Radarr.Http.ClientSchema result = GetFieldMapping(type, "", v => v); // Renumber al the field Orders since nested settings will have dupe Orders. - for (int i = 0; i < result.Length; i++) + for (var i = 0; i < result.Length; i++) { result[i].Field.Order = i; } diff --git a/src/ServiceHelpers/ServiceInstall/ServiceHelper.cs b/src/ServiceHelpers/ServiceInstall/ServiceHelper.cs index a651ae317..62b874f48 100644 --- a/src/ServiceHelpers/ServiceInstall/ServiceHelper.cs +++ b/src/ServiceHelpers/ServiceInstall/ServiceHelper.cs @@ -12,7 +12,7 @@ namespace ServiceInstall private static bool IsAnAdministrator() { - WindowsPrincipal principal = new WindowsPrincipal(WindowsIdentity.GetCurrent()); + var principal = new WindowsPrincipal(WindowsIdentity.GetCurrent()); return principal.IsInRole(WindowsBuiltInRole.Administrator); } diff --git a/src/ServiceHelpers/ServiceUninstall/ServiceHelper.cs b/src/ServiceHelpers/ServiceUninstall/ServiceHelper.cs index 174a79ffd..99d4f8ed9 100644 --- a/src/ServiceHelpers/ServiceUninstall/ServiceHelper.cs +++ b/src/ServiceHelpers/ServiceUninstall/ServiceHelper.cs @@ -12,7 +12,7 @@ namespace ServiceUninstall private static bool IsAnAdministrator() { - WindowsPrincipal principal = new WindowsPrincipal(WindowsIdentity.GetCurrent()); + var principal = new WindowsPrincipal(WindowsIdentity.GetCurrent()); return principal.IsInRole(WindowsBuiltInRole.Administrator); }