From 12374f7f0038e5b25548f5ab3f71122410832393 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 --- .../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 +++--- src/NzbDrone.Common/Expansive/Expansive.cs | 2 +- src/NzbDrone.Common/Expansive/TreeNode.cs | 4 ++-- .../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 | 4 ++-- .../Instrumentation/CleansingJsonVisitor.cs | 2 +- .../Instrumentation/NzbDroneLogger.cs | 2 +- .../Serializer/Newtonsoft.Json/JsonVisitor.cs | 6 +++--- .../UnderscoreStringEnumConverter.cs | 4 ++-- .../System.Text.Json/STJVersionConverter.cs | 2 +- .../LimitedConcurrencyLevelTaskScheduler.cs | 2 +- src/NzbDrone.Console/ConsoleApp.cs | 2 +- .../Datastore/BasicRepositoryFixture.cs | 4 ++-- .../Blackhole/ScanWatchFolderFixture.cs | 2 +- .../Extras/ExtraServiceFixture.cs | 2 +- .../Subtitles/SubtitleServiceFixture.cs | 4 ++-- src/NzbDrone.Core.Test/FluentTest.cs | 4 ++-- .../DownloadClientRootFolderCheckFixture.cs | 2 +- .../DatabaseTargetFixture.cs | 2 +- .../ParserTests/CrapParserFixture.cs | 12 +++++------ .../Delay/DelayProfileServiceFixture.cs | 4 ++-- .../EpisodesWhereCutoffUnmetFixture.cs | 2 +- .../EpisodesWithFilesFixture.cs | 2 +- .../FindEpisodeByTitleFixture.cs | 4 ++-- .../Configuration/ConfigFileProvider.cs | 2 +- .../Datastore/BasicRepository.cs | 2 +- .../Datastore/Converters/CommandConverter.cs | 4 ++-- .../020_add_year_and_seasons_to_series.cs | 18 ++++++++--------- .../029_add_formats_to_naming_config.cs | 6 +++--- ...d_season_folder_format_to_naming_config.cs | 8 ++++---- .../Migration/033_add_api_key_to_pushover.cs | 6 +++--- .../036_update_with_quality_converters.cs | 12 +++++------ .../037_add_configurable_qualities.cs | 8 ++++---- .../043_convert_config_to_download_clients.cs | 8 ++++---- .../Migration/051_download_client_import.cs | 20 +++++++++---------- .../Migration/053_add_series_sorttitle.cs | 8 ++++---- ...7_convert_episode_file_path_to_relative.cs | 8 ++++---- .../Migration/062_convert_quality_models.cs | 6 +++--- .../Migration/068_add_release_restrictions.cs | 8 ++++---- .../Datastore/Migration/069_quality_proper.cs | 6 +++--- .../Datastore/Migration/070_delay_profile.cs | 14 ++++++------- .../Datastore/Migration/072_history_grabid.cs | 4 ++-- .../Datastore/Migration/079_dedupe_tags.cs | 12 +++++------ ...e_to_episodeFiles_history_and_blacklist.cs | 14 ++++++------- .../Migration/111_create_language_profiles.cs | 8 ++++---- .../132_add_download_client_priority.cs | 4 ++-- .../134_add_specials_folder_format.cs | 2 +- .../147_swap_filechmod_for_folderchmod.cs | 6 +++--- .../Migration/163_mediainfo_to_ffmpeg.cs | 2 +- .../Migration/166_update_series_sort_title.cs | 6 +++--- .../Migration/171_add_custom_formats.cs | 6 +++--- .../Migration/Framework/SqliteSchemaDumper.cs | 6 +++--- .../Download/Clients/Deluge/DelugeProxy.cs | 2 +- .../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 | 4 ++-- .../Download/Extensions/XmlExtensions.cs | 4 ++-- src/NzbDrone.Core/Extras/ExtraService.cs | 4 ++-- .../Extras/Others/OtherExtraService.cs | 4 ++-- .../Extras/Subtitles/SubtitleService.cs | 2 +- src/NzbDrone.Core/Fluent.cs | 8 ++++---- .../Checks/PackageGlobalMessageCheck.cs | 2 +- .../ImportLists/HttpImportListBase.cs | 2 +- .../ImportLists/Plex/PlexParser.cs | 4 ++-- .../BroadcastheNet/BroadcastheNetParser.cs | 4 ++-- src/NzbDrone.Core/Indexers/HttpIndexerBase.cs | 2 +- .../MediaCover/MediaCoverService.cs | 2 +- .../Manual/ManualImportService.cs | 2 +- .../NotUnpackingSpecification.cs | 4 ++-- .../MediaFiles/UpdateEpisodeFileService.cs | 4 ++-- .../Messaging/Commands/CommandExecutor.cs | 2 +- .../Messaging/Commands/CommandQueueManager.cs | 2 +- .../MetadataSource/SearchSeriesComparer.cs | 4 ++-- .../Notifications/Xbmc/Model/XbmcVersion.cs | 2 +- .../Organizer/FileNameBuilder.cs | 10 +++++----- src/NzbDrone.Core/Parser/LanguageParser.cs | 2 +- .../Parser/Model/ParsedEpisodeInfo.cs | 2 +- src/NzbDrone.Core/Parser/Parser.cs | 2 +- src/NzbDrone.Core/Parser/ParsingService.cs | 2 +- .../Profiles/Delay/DelayProfileService.cs | 4 ++-- .../Qualities/QualityDefinitionService.cs | 6 +++--- src/NzbDrone.Core/Qualities/QualityModel.cs | 2 +- .../Qualities/QualityModelComparer.cs | 4 ++-- .../RootFolders/RootFolderService.cs | 2 +- src/NzbDrone.Core/Tv/SeriesService.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 | 4 ++-- .../ServiceInstall/ServiceHelper.cs | 2 +- .../ServiceUninstall/ServiceHelper.cs | 2 +- .../Logs/LogFileControllerBase.cs | 2 +- src/Sonarr.Http/ClientSchema/SchemaBuilder.cs | 2 +- .../RuntimePatchExtensions.cs | 6 +++--- 113 files changed, 269 insertions(+), 269 deletions(-) diff --git a/src/NzbDrone.Automation.Test/AutomationTest.cs b/src/NzbDrone.Automation.Test/AutomationTest.cs index e6228ef17..37996477f 100644 --- a/src/NzbDrone.Automation.Test/AutomationTest.cs +++ b/src/NzbDrone.Automation.Test/AutomationTest.cs @@ -67,7 +67,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 b0c787a8a..69c69a936 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.Support.UI; @@ -36,7 +36,7 @@ namespace NzbDrone.Automation.Test.PageModel { try { - IWebElement element = d.FindElement(By.Id("followingBalls")); + var element = d.FindElement(By.Id("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 9622f4e01..f381a96a0 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 009037f49..dd27f6f1b 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 d6c99e5ab..2c2bfc4ab 100644 --- a/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs +++ b/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs @@ -799,7 +799,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(); @@ -833,7 +833,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 39745eb3b..12b54da36 100644 --- a/src/NzbDrone.Common/ArchiveService.cs +++ b/src/NzbDrone.Common/ArchiveService.cs @@ -74,18 +74,18 @@ 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); @@ -94,7 +94,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); } @@ -107,7 +107,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/Expansive/Expansive.cs b/src/NzbDrone.Common/Expansive/Expansive.cs index 39589bc05..8fdd91c5c 100644 --- a/src/NzbDrone.Common/Expansive/Expansive.cs +++ b/src/NzbDrone.Common/Expansive/Expansive.cs @@ -90,7 +90,7 @@ namespace NzbDrone.Common.Expansive return source.ExpandInternal( name => { - IDictionary modelDict = model.ToDictionary(); + var modelDict = model.ToDictionary(); if (RequireAllExpansions && !modelDict.ContainsKey(name)) { return ""; diff --git a/src/NzbDrone.Common/Expansive/TreeNode.cs b/src/NzbDrone.Common/Expansive/TreeNode.cs index ef5bf7fe6..573fccb99 100644 --- a/src/NzbDrone.Common/Expansive/TreeNode.cs +++ b/src/NzbDrone.Common/Expansive/TreeNode.cs @@ -57,7 +57,7 @@ namespace NzbDrone.Common.Expansive { // return (Parent == null) ? this : Parent.Root; - TreeNode node = this; + var node = this; while (node.Parent != null) { node = node.Parent; @@ -74,7 +74,7 @@ namespace NzbDrone.Common.Expansive get { _CallTree = new List(); - TreeNode node = this; + var node = this; while (node.Parent != null) { node = node.Parent; 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 8964c2ffc..dd359e06d 100644 --- a/src/NzbDrone.Common/Extensions/PathExtensions.cs +++ b/src/NzbDrone.Common/Extensions/PathExtensions.cs @@ -254,13 +254,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 46333df0e..022d8adee 100644 --- a/src/NzbDrone.Common/Http/Proxy/HttpProxySettings.cs +++ b/src/NzbDrone.Common/Http/Proxy/HttpProxySettings.cs @@ -1,4 +1,4 @@ -using System; +using System; using NzbDrone.Common.Extensions; namespace NzbDrone.Common.Http.Proxy @@ -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 89bacde34..34df2dff3 100644 --- a/src/NzbDrone.Common/Instrumentation/CleansingJsonVisitor.cs +++ b/src/NzbDrone.Common/Instrumentation/CleansingJsonVisitor.cs @@ -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 c43923481..f654de585 100644 --- a/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs +++ b/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs @@ -106,7 +106,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}}"; 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 4c28feb67..bec13eb3a 100644 --- a/src/NzbDrone.Common/TPL/LimitedConcurrencyLevelTaskScheduler.cs +++ b/src/NzbDrone.Common/TPL/LimitedConcurrencyLevelTaskScheduler.cs @@ -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 71c1216f9..cf90e8481 100644 --- a/src/NzbDrone.Console/ConsoleApp.cs +++ b/src/NzbDrone.Console/ConsoleApp.cs @@ -113,7 +113,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); diff --git a/src/NzbDrone.Core.Test/Datastore/BasicRepositoryFixture.cs b/src/NzbDrone.Core.Test/Datastore/BasicRepositoryFixture.cs index 91d72e227..fac7e7f00 100644 --- a/src/NzbDrone.Core.Test/Datastore/BasicRepositoryFixture.cs +++ b/src/NzbDrone.Core.Test/Datastore/BasicRepositoryFixture.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using FizzWare.NBuilder; @@ -198,7 +198,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 de958c08d..95f8dff2b 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 5d14f384b..25ed38a3f 100644 --- a/src/NzbDrone.Core.Test/Extras/ExtraServiceFixture.cs +++ b/src/NzbDrone.Core.Test/Extras/ExtraServiceFixture.cs @@ -116,7 +116,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 532736000..cdfac939c 100644 --- a/src/NzbDrone.Core.Test/Extras/Subtitles/SubtitleServiceFixture.cs +++ b/src/NzbDrone.Core.Test/Extras/Subtitles/SubtitleServiceFixture.cs @@ -120,7 +120,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(Path.Combine("Season 1", expectedOutputs[i]).AsOsAgnostic()).Should().Be(true); } @@ -149,7 +149,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(Path.Combine("Season 1", 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 d58c902e6..5dda85647 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientRootFolderCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientRootFolderCheckFixture.cs @@ -74,7 +74,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/InstrumentationTests/DatabaseTargetFixture.cs b/src/NzbDrone.Core.Test/InstrumentationTests/DatabaseTargetFixture.cs index 2da264d0d..cd3eb1b7a 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/ParserTests/CrapParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/CrapParserFixture.cs index f6efa3a7d..9d34e2283 100644 --- a/src/NzbDrone.Core.Test/ParserTests/CrapParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/CrapParserFixture.cs @@ -42,13 +42,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(System.Text.Encoding.Default.GetBytes(hash)); @@ -67,17 +67,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/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.Test/TvTests/EpisodeRepositoryTests/EpisodesWhereCutoffUnmetFixture.cs b/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWhereCutoffUnmetFixture.cs index 7e4b977f0..fe05ea3bc 100644 --- a/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWhereCutoffUnmetFixture.cs +++ b/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWhereCutoffUnmetFixture.cs @@ -86,7 +86,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests var qualityRawHDLanguageMet = new EpisodeFile { RelativePath = "h", Quality = new QualityModel { Quality = Quality.RAWHD }, Languages = new List { Language.Spanish } }; var qualityRawHDLanguageExceed = new EpisodeFile { RelativePath = "i", Quality = new QualityModel { Quality = Quality.RAWHD }, Languages = new List { Language.French } }; - MediaFileRepository fileRepository = Mocker.Resolve(); + var fileRepository = Mocker.Resolve(); qualityMetLanguageUnmet = fileRepository.Insert(qualityMetLanguageUnmet); qualityMetLanguageMet = fileRepository.Insert(qualityMetLanguageMet); diff --git a/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWithFilesFixture.cs b/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWithFilesFixture.cs index b468effa2..b8e8bbbfd 100644 --- a/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWithFilesFixture.cs +++ b/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWithFilesFixture.cs @@ -36,7 +36,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests .BuildListOfNew() .ToList(); - for (int i = 0; i < _episodeFiles.Count; i++) + for (var i = 0; i < _episodeFiles.Count; i++) { _episodes[i].EpisodeFileId = _episodeFiles[i].Id; } diff --git a/src/NzbDrone.Core.Test/TvTests/EpisodeServiceTests/FindEpisodeByTitleFixture.cs b/src/NzbDrone.Core.Test/TvTests/EpisodeServiceTests/FindEpisodeByTitleFixture.cs index 8b3447c81..7d7d779cd 100644 --- a/src/NzbDrone.Core.Test/TvTests/EpisodeServiceTests/FindEpisodeByTitleFixture.cs +++ b/src/NzbDrone.Core.Test/TvTests/EpisodeServiceTests/FindEpisodeByTitleFixture.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using FizzWare.NBuilder; using FluentAssertions; @@ -24,7 +24,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeServiceTests private void GivenEpisodesWithTitles(params string[] titles) { - for (int i = 0; i < titles.Length; i++) + for (var i = 0; i < titles.Length; i++) { _episodes[i].Title = titles[i]; } diff --git a/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs b/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs index a5e475549..766147a2a 100644 --- a/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs +++ b/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs @@ -131,7 +131,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 5f59e9e8a..e0fab1b1c 100644 --- a/src/NzbDrone.Core/Datastore/BasicRepository.cs +++ b/src/NzbDrone.Core/Datastore/BasicRepository.cs @@ -197,7 +197,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 0799d21bc..790464f3f 100644 --- a/src/NzbDrone.Core/Datastore/Converters/CommandConverter.cs +++ b/src/NzbDrone.Core/Datastore/Converters/CommandConverter.cs @@ -1,4 +1,4 @@ -using System.Data; +using System.Data; using System.Text.Json; using NzbDrone.Common.Extensions; using NzbDrone.Common.Reflection; @@ -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/020_add_year_and_seasons_to_series.cs b/src/NzbDrone.Core/Datastore/Migration/020_add_year_and_seasons_to_series.cs index bfbf78a77..d08d32e0e 100644 --- a/src/NzbDrone.Core/Datastore/Migration/020_add_year_and_seasons_to_series.cs +++ b/src/NzbDrone.Core/Datastore/Migration/020_add_year_and_seasons_to_series.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Data; using FluentMigrator; using NzbDrone.Common.Serializer; @@ -19,28 +19,28 @@ namespace NzbDrone.Core.Datastore.Migration private void ConvertSeasons(IDbConnection conn, IDbTransaction tran) { - using (IDbCommand allSeriesCmd = conn.CreateCommand()) + using (var allSeriesCmd = conn.CreateCommand()) { allSeriesCmd.Transaction = tran; allSeriesCmd.CommandText = @"SELECT Id FROM Series"; - using (IDataReader allSeriesReader = allSeriesCmd.ExecuteReader()) + using (var allSeriesReader = allSeriesCmd.ExecuteReader()) { while (allSeriesReader.Read()) { - int seriesId = allSeriesReader.GetInt32(0); + var seriesId = allSeriesReader.GetInt32(0); var seasons = new List(); - using (IDbCommand seasonsCmd = conn.CreateCommand()) + using (var seasonsCmd = conn.CreateCommand()) { seasonsCmd.Transaction = tran; seasonsCmd.CommandText = string.Format(@"SELECT SeasonNumber, Monitored FROM Seasons WHERE SeriesId = {0}", seriesId); - using (IDataReader seasonReader = seasonsCmd.ExecuteReader()) + using (var seasonReader = seasonsCmd.ExecuteReader()) { while (seasonReader.Read()) { - int seasonNumber = seasonReader.GetInt32(0); - bool monitored = seasonReader.GetBoolean(1); + var seasonNumber = seasonReader.GetInt32(0); + var monitored = seasonReader.GetBoolean(1); if (seasonNumber == 0) { @@ -52,7 +52,7 @@ namespace NzbDrone.Core.Datastore.Migration } } - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { var text = string.Format("UPDATE Series SET Seasons = '{0}' WHERE Id = {1}", seasons.ToJson(), seriesId); diff --git a/src/NzbDrone.Core/Datastore/Migration/029_add_formats_to_naming_config.cs b/src/NzbDrone.Core/Datastore/Migration/029_add_formats_to_naming_config.cs index 6c645499f..6297bc38b 100644 --- a/src/NzbDrone.Core/Datastore/Migration/029_add_formats_to_naming_config.cs +++ b/src/NzbDrone.Core/Datastore/Migration/029_add_formats_to_naming_config.cs @@ -19,11 +19,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()) { var separatorIndex = namingConfigReader.GetOrdinal("Separator"); var numberStyleIndex = namingConfigReader.GetOrdinal("NumberStyle"); @@ -96,7 +96,7 @@ namespace NzbDrone.Core.Datastore.Migration dailyEpisodeFormat += qualityFormat; } - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { var text = string.Format("UPDATE NamingConfig " + "SET StandardEpisodeFormat = '{0}', " + diff --git a/src/NzbDrone.Core/Datastore/Migration/030_add_season_folder_format_to_naming_config.cs b/src/NzbDrone.Core/Datastore/Migration/030_add_season_folder_format_to_naming_config.cs index 9b40bcb15..d7e7c8873 100644 --- a/src/NzbDrone.Core/Datastore/Migration/030_add_season_folder_format_to_naming_config.cs +++ b/src/NzbDrone.Core/Datastore/Migration/030_add_season_folder_format_to_naming_config.cs @@ -1,4 +1,4 @@ -using System.Data; +using System.Data; using FluentMigrator; using NzbDrone.Core.Datastore.Migration.Framework; @@ -17,13 +17,13 @@ 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 [Value] FROM Config WHERE [Key] = 'seasonfolderformat'"; var seasonFormat = "Season {season}"; - using (IDataReader namingConfigReader = namingConfigCmd.ExecuteReader()) + using (var namingConfigReader = namingConfigCmd.ExecuteReader()) { while (namingConfigReader.Read()) { @@ -39,7 +39,7 @@ namespace NzbDrone.Core.Datastore.Migration } } - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { var text = string.Format("UPDATE NamingConfig " + "SET SeasonFolderFormat = '{0}'", diff --git a/src/NzbDrone.Core/Datastore/Migration/033_add_api_key_to_pushover.cs b/src/NzbDrone.Core/Datastore/Migration/033_add_api_key_to_pushover.cs index 5cf34e945..9fde88cbe 100644 --- a/src/NzbDrone.Core/Datastore/Migration/033_add_api_key_to_pushover.cs +++ b/src/NzbDrone.Core/Datastore/Migration/033_add_api_key_to_pushover.cs @@ -17,12 +17,12 @@ namespace NzbDrone.Core.Datastore.Migration private void UpdatePushoverSettings(IDbConnection conn, IDbTransaction tran) { - using (IDbCommand selectCommand = conn.CreateCommand()) + using (var selectCommand = conn.CreateCommand()) { selectCommand.Transaction = tran; selectCommand.CommandText = @"SELECT * FROM Notifications WHERE ConfigContract = 'PushoverSettings'"; - using (IDataReader reader = selectCommand.ExecuteReader()) + using (var reader = selectCommand.ExecuteReader()) { while (reader.Read()) { @@ -39,7 +39,7 @@ namespace NzbDrone.Core.Datastore.Migration settings.Priority = 1; } - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { var text = string.Format("UPDATE Notifications " + "SET Settings = '{0}'" + diff --git a/src/NzbDrone.Core/Datastore/Migration/036_update_with_quality_converters.cs b/src/NzbDrone.Core/Datastore/Migration/036_update_with_quality_converters.cs index 6937e0bdd..7aefd52bc 100644 --- a/src/NzbDrone.Core/Datastore/Migration/036_update_with_quality_converters.cs +++ b/src/NzbDrone.Core/Datastore/Migration/036_update_with_quality_converters.cs @@ -29,11 +29,11 @@ namespace NzbDrone.Core.Datastore.Migration var qualityProfileItemConverter = new EmbeddedDocumentConverter>(new QualityIntConverter()); // Convert 'Allowed' column in QualityProfiles from Json List to Json List (int = Quality) - using (IDbCommand qualityProfileCmd = conn.CreateCommand()) + using (var qualityProfileCmd = conn.CreateCommand()) { qualityProfileCmd.Transaction = tran; qualityProfileCmd.CommandText = @"SELECT Id, Allowed FROM QualityProfiles"; - using (IDataReader qualityProfileReader = qualityProfileCmd.ExecuteReader()) + using (var qualityProfileReader = qualityProfileCmd.ExecuteReader()) { while (qualityProfileReader.Read()) { @@ -44,7 +44,7 @@ namespace NzbDrone.Core.Datastore.Migration var items = Quality.DefaultQualityDefinitions.OrderBy(v => v.Weight).Select(v => new QualityProfileQualityItem { Quality = v.Quality, Allowed = allowed.Contains(v.Quality) }).ToList(); - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { updateCmd.Transaction = tran; updateCmd.CommandText = "UPDATE QualityProfiles SET Items = ? WHERE Id = ?"; @@ -72,11 +72,11 @@ namespace NzbDrone.Core.Datastore.Migration { var qualityModelConverter = new EmbeddedDocumentConverter(new QualityIntConverter()); - using (IDbCommand qualityModelCmd = conn.CreateCommand()) + using (var qualityModelCmd = conn.CreateCommand()) { qualityModelCmd.Transaction = tran; qualityModelCmd.CommandText = @"SELECT Distinct Quality FROM " + tableName; - using (IDataReader qualityModelReader = qualityModelCmd.ExecuteReader()) + using (var qualityModelReader = qualityModelCmd.ExecuteReader()) { while (qualityModelReader.Read()) { @@ -93,7 +93,7 @@ namespace NzbDrone.Core.Datastore.Migration Proper = sourceQuality.Proper }; - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { updateCmd.Transaction = tran; updateCmd.CommandText = "UPDATE " + tableName + " SET Quality = ? WHERE Quality = ?"; diff --git a/src/NzbDrone.Core/Datastore/Migration/037_add_configurable_qualities.cs b/src/NzbDrone.Core/Datastore/Migration/037_add_configurable_qualities.cs index 75f08ff34..d7e95ed68 100644 --- a/src/NzbDrone.Core/Datastore/Migration/037_add_configurable_qualities.cs +++ b/src/NzbDrone.Core/Datastore/Migration/037_add_configurable_qualities.cs @@ -1,4 +1,4 @@ -using System.Data; +using System.Data; using System.Linq; using FluentMigrator; using NzbDrone.Core.Datastore.Migration.Framework; @@ -30,11 +30,11 @@ namespace NzbDrone.Core.Datastore.Migration private void ConvertQualities(IDbConnection conn, IDbTransaction tran) { // Convert QualitySizes to a more generic QualityDefinitions table. - using (IDbCommand qualitySizeCmd = conn.CreateCommand()) + using (var qualitySizeCmd = conn.CreateCommand()) { qualitySizeCmd.Transaction = tran; qualitySizeCmd.CommandText = @"SELECT QualityId, MinSize, MaxSize FROM QualitySizes"; - using (IDataReader qualitySizeReader = qualitySizeCmd.ExecuteReader()) + using (var qualitySizeReader = qualitySizeCmd.ExecuteReader()) { while (qualitySizeReader.Read()) { @@ -44,7 +44,7 @@ namespace NzbDrone.Core.Datastore.Migration var defaultConfig = Quality.DefaultQualityDefinitions.Single(p => (int)p.Quality == qualityId); - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { updateCmd.Transaction = tran; updateCmd.CommandText = "INSERT INTO QualityDefinitions (Quality, Title, Weight, MinSize, MaxSize) VALUES (?, ?, ?, ?, ?)"; diff --git a/src/NzbDrone.Core/Datastore/Migration/043_convert_config_to_download_clients.cs b/src/NzbDrone.Core/Datastore/Migration/043_convert_config_to_download_clients.cs index 2f03fde24..d871e40ea 100644 --- a/src/NzbDrone.Core/Datastore/Migration/043_convert_config_to_download_clients.cs +++ b/src/NzbDrone.Core/Datastore/Migration/043_convert_config_to_download_clients.cs @@ -19,11 +19,11 @@ namespace NzbDrone.Core.Datastore.Migration { var config = new Dictionary(); - using (IDbCommand configCmd = conn.CreateCommand()) + using (var configCmd = conn.CreateCommand()) { configCmd.Transaction = tran; configCmd.CommandText = @"SELECT * FROM Config"; - using (IDataReader configReader = configCmd.ExecuteReader()) + using (var configReader = configCmd.ExecuteReader()) { var keyIndex = configReader.GetOrdinal("Key"); var valueIndex = configReader.GetOrdinal("Value"); @@ -119,7 +119,7 @@ namespace NzbDrone.Core.Datastore.Migration string configContract, int protocol) { - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { var text = string.Format("INSERT INTO DownloadClients (Enable, Name, Implementation, Settings, ConfigContract, Protocol) VALUES (1, ?, ?, ?, ?, ?)"); updateCmd.AddParameter(name); @@ -136,7 +136,7 @@ namespace NzbDrone.Core.Datastore.Migration private void DeleteOldConfigValues(IDbConnection conn, IDbTransaction tran) { - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { var text = "DELETE FROM Config WHERE [KEY] IN ('nzbgetusername', 'nzbgetpassword', 'nzbgethost', 'nzbgetport', " + "'nzbgettvcategory', 'nzbgetrecenttvpriority', 'nzbgetoldertvpriority', 'sabhost', 'sabport', " + diff --git a/src/NzbDrone.Core/Datastore/Migration/051_download_client_import.cs b/src/NzbDrone.Core/Datastore/Migration/051_download_client_import.cs index a4bb597d2..ef875b0d1 100644 --- a/src/NzbDrone.Core/Datastore/Migration/051_download_client_import.cs +++ b/src/NzbDrone.Core/Datastore/Migration/051_download_client_import.cs @@ -24,7 +24,7 @@ namespace NzbDrone.Core.Datastore.Migration private void EnableCompletedDownloadHandlingForNewUsers(IDbConnection conn, IDbTransaction tran) { - using (IDbCommand cmd = conn.CreateCommand()) + using (var cmd = conn.CreateCommand()) { cmd.Transaction = tran; cmd.CommandText = @"SELECT Value FROM Config WHERE Key = 'downloadedepisodesfolder'"; @@ -41,7 +41,7 @@ namespace NzbDrone.Core.Datastore.Migration private void ConvertFolderSettings(IDbConnection conn, IDbTransaction tran) { - using (IDbCommand downloadClientsCmd = conn.CreateCommand()) + using (var downloadClientsCmd = conn.CreateCommand()) { downloadClientsCmd.Transaction = tran; downloadClientsCmd.CommandText = @"SELECT Value FROM Config WHERE Key = 'downloadedepisodesfolder'"; @@ -49,7 +49,7 @@ namespace NzbDrone.Core.Datastore.Migration downloadClientsCmd.Transaction = tran; downloadClientsCmd.CommandText = @"SELECT Id, Implementation, Settings, ConfigContract FROM DownloadClients WHERE ConfigContract = 'FolderSettings'"; - using (IDataReader downloadClientReader = downloadClientsCmd.ExecuteReader()) + using (var downloadClientReader = downloadClientsCmd.ExecuteReader()) { while (downloadClientReader.Read()) { @@ -68,7 +68,7 @@ namespace NzbDrone.Core.Datastore.Migration WatchFolder = downloadedEpisodesFolder }.ToJson(); - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { updateCmd.Transaction = tran; updateCmd.CommandText = "UPDATE DownloadClients SET Implementation = ?, Settings = ?, ConfigContract = ? WHERE Id = ?"; @@ -87,7 +87,7 @@ namespace NzbDrone.Core.Datastore.Migration NzbFolder = settingsJson.Value("folder") }.ToJson(); - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { updateCmd.Transaction = tran; updateCmd.CommandText = "UPDATE DownloadClients SET Settings = ?, ConfigContract = ? WHERE Id = ?"; @@ -100,7 +100,7 @@ namespace NzbDrone.Core.Datastore.Migration } else { - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { updateCmd.Transaction = tran; updateCmd.CommandText = "DELETE FROM DownloadClients WHERE Id = ?"; @@ -138,11 +138,11 @@ namespace NzbDrone.Core.Datastore.Migration { var historyItems = new List(); - using (IDbCommand historyCmd = conn.CreateCommand()) + using (var historyCmd = conn.CreateCommand()) { historyCmd.Transaction = tran; historyCmd.CommandText = @"SELECT Id, EpisodeId, SeriesId, SourceTitle, Date, Data, EventType FROM History WHERE EventType NOT NULL"; - using (IDataReader historyRead = historyCmd.ExecuteReader()) + using (var historyRead = historyCmd.ExecuteReader()) { while (historyRead.Read()) { @@ -176,7 +176,7 @@ namespace NzbDrone.Core.Datastore.Migration { var list = historyItemGroup.ToList(); - for (int i = 0; i < list.Count - 1; i++) + for (var i = 0; i < list.Count - 1; i++) { var grabbedEvent = list[i]; if (grabbedEvent.EventType != MigrationHistoryEventType.Grabbed) @@ -232,7 +232,7 @@ namespace NzbDrone.Core.Datastore.Migration foreach (var pair in historyItemsToAssociate) { - using (IDbCommand updateHistoryCmd = conn.CreateCommand()) + using (var updateHistoryCmd = conn.CreateCommand()) { pair.Key.Data["downloadClient"] = pair.Value.Data["downloadClient"]; pair.Key.Data["downloadClientId"] = pair.Value.Data["downloadClientId"]; diff --git a/src/NzbDrone.Core/Datastore/Migration/053_add_series_sorttitle.cs b/src/NzbDrone.Core/Datastore/Migration/053_add_series_sorttitle.cs index 46e1b8ce3..9d4168b94 100644 --- a/src/NzbDrone.Core/Datastore/Migration/053_add_series_sorttitle.cs +++ b/src/NzbDrone.Core/Datastore/Migration/053_add_series_sorttitle.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, Title FROM Series"; - using (IDataReader seriesReader = getSeriesCmd.ExecuteReader()) + using (var seriesReader = getSeriesCmd.ExecuteReader()) { while (seriesReader.Read()) { @@ -29,7 +29,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 Series SET SortTitle = ? WHERE Id = ?"; diff --git a/src/NzbDrone.Core/Datastore/Migration/057_convert_episode_file_path_to_relative.cs b/src/NzbDrone.Core/Datastore/Migration/057_convert_episode_file_path_to_relative.cs index caf5644dd..37893357d 100644 --- a/src/NzbDrone.Core/Datastore/Migration/057_convert_episode_file_path_to_relative.cs +++ b/src/NzbDrone.Core/Datastore/Migration/057_convert_episode_file_path_to_relative.cs @@ -1,4 +1,4 @@ -using System.Data; +using System.Data; using System.IO; using FluentMigrator; using NzbDrone.Core.Datastore.Migration.Framework; @@ -20,18 +20,18 @@ namespace NzbDrone.Core.Datastore.Migration private void UpdateRelativePaths(IDbConnection conn, IDbTransaction tran) { - using (IDbCommand getSeriesCmd = conn.CreateCommand()) + using (var getSeriesCmd = conn.CreateCommand()) { getSeriesCmd.Transaction = tran; getSeriesCmd.CommandText = @"SELECT Id, Path FROM Series"; - using (IDataReader seriesReader = getSeriesCmd.ExecuteReader()) + using (var seriesReader = getSeriesCmd.ExecuteReader()) { while (seriesReader.Read()) { var seriesId = seriesReader.GetInt32(0); var seriesPath = seriesReader.GetString(1) + Path.DirectorySeparatorChar; - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { updateCmd.Transaction = tran; updateCmd.CommandText = "UPDATE EpisodeFiles SET RelativePath = REPLACE(Path, ?, '') WHERE SeriesId = ?"; diff --git a/src/NzbDrone.Core/Datastore/Migration/062_convert_quality_models.cs b/src/NzbDrone.Core/Datastore/Migration/062_convert_quality_models.cs index c6df4927a..10ec980d5 100644 --- a/src/NzbDrone.Core/Datastore/Migration/062_convert_quality_models.cs +++ b/src/NzbDrone.Core/Datastore/Migration/062_convert_quality_models.cs @@ -26,12 +26,12 @@ namespace NzbDrone.Core.Datastore.Migration { var qualitiesToUpdate = new Dictionary(); - using (IDbCommand qualityModelCmd = conn.CreateCommand()) + using (var qualityModelCmd = conn.CreateCommand()) { qualityModelCmd.Transaction = tran; qualityModelCmd.CommandText = @"SELECT Distinct Quality FROM " + tableName; - using (IDataReader qualityModelReader = qualityModelCmd.ExecuteReader()) + using (var qualityModelReader = qualityModelCmd.ExecuteReader()) { while (qualityModelReader.Read()) { @@ -57,7 +57,7 @@ namespace NzbDrone.Core.Datastore.Migration foreach (var quality in qualitiesToUpdate) { - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { updateCmd.Transaction = tran; updateCmd.CommandText = "UPDATE " + tableName + " SET Quality = ? WHERE Quality = ?"; diff --git a/src/NzbDrone.Core/Datastore/Migration/068_add_release_restrictions.cs b/src/NzbDrone.Core/Datastore/Migration/068_add_release_restrictions.cs index a7cc93e0c..43937e6b2 100644 --- a/src/NzbDrone.Core/Datastore/Migration/068_add_release_restrictions.cs +++ b/src/NzbDrone.Core/Datastore/Migration/068_add_release_restrictions.cs @@ -1,4 +1,4 @@ -using System.Data; +using System.Data; using FluentMigrator; using NzbDrone.Core.Datastore.Migration.Framework; @@ -21,19 +21,19 @@ namespace NzbDrone.Core.Datastore.Migration private void ConvertRestrictions(IDbConnection conn, IDbTransaction tran) { - using (IDbCommand getRestictionsCmd = conn.CreateCommand()) + using (var getRestictionsCmd = conn.CreateCommand()) { getRestictionsCmd.Transaction = tran; getRestictionsCmd.CommandText = @"SELECT [Value] FROM Config WHERE [Key] = 'releaserestrictions'"; - using (IDataReader configReader = getRestictionsCmd.ExecuteReader()) + using (var configReader = getRestictionsCmd.ExecuteReader()) { while (configReader.Read()) { var restrictions = configReader.GetString(0); restrictions = restrictions.Replace("\n", ","); - using (IDbCommand insertCmd = conn.CreateCommand()) + using (var insertCmd = conn.CreateCommand()) { insertCmd.Transaction = tran; insertCmd.CommandText = "INSERT INTO Restrictions (Ignored, Tags) VALUES (?, '[]')"; diff --git a/src/NzbDrone.Core/Datastore/Migration/069_quality_proper.cs b/src/NzbDrone.Core/Datastore/Migration/069_quality_proper.cs index 3dc644c9e..36c183fae 100644 --- a/src/NzbDrone.Core/Datastore/Migration/069_quality_proper.cs +++ b/src/NzbDrone.Core/Datastore/Migration/069_quality_proper.cs @@ -19,12 +19,12 @@ namespace NzbDrone.Core.Datastore.Migration private void ConvertQualityTitle(IDbConnection conn, IDbTransaction tran) { - using (IDbCommand namingConfigCmd = conn.CreateCommand()) + using (var namingConfigCmd = conn.CreateCommand()) { namingConfigCmd.Transaction = tran; namingConfigCmd.CommandText = @"SELECT StandardEpisodeFormat, DailyEpisodeFormat, AnimeEpisodeFormat FROM NamingConfig LIMIT 1"; - using (IDataReader configReader = namingConfigCmd.ExecuteReader()) + using (var configReader = namingConfigCmd.ExecuteReader()) { while (configReader.Read()) { @@ -36,7 +36,7 @@ namespace NzbDrone.Core.Datastore.Migration var newDaily = GetNewFormat(currentDaily); var newAnime = GetNewFormat(currentAnime); - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { updateCmd.Transaction = tran; diff --git a/src/NzbDrone.Core/Datastore/Migration/070_delay_profile.cs b/src/NzbDrone.Core/Datastore/Migration/070_delay_profile.cs index 7de99f6ce..b2cd28121 100644 --- a/src/NzbDrone.Core/Datastore/Migration/070_delay_profile.cs +++ b/src/NzbDrone.Core/Datastore/Migration/070_delay_profile.cs @@ -56,7 +56,7 @@ namespace NzbDrone.Core.Datastore.Migration var tagId = InsertTag(conn, tran, tag); var tags = string.Format("[{0}]", tagId); - using (IDbCommand insertDelayProfileCmd = conn.CreateCommand()) + using (var insertDelayProfileCmd = conn.CreateCommand()) { insertDelayProfileCmd.Transaction = tran; insertDelayProfileCmd.CommandText = "INSERT INTO DelayProfiles (EnableUsenet, EnableTorrent, PreferredProtocol, TorrentDelay, UsenetDelay, [Order], Tags) VALUES (1, 1, 1, 0, ?, ?, ?)"; @@ -80,12 +80,12 @@ namespace NzbDrone.Core.Datastore.Migration { var profiles = new List(); - using (IDbCommand getProfilesCmd = conn.CreateCommand()) + using (var getProfilesCmd = conn.CreateCommand()) { getProfilesCmd.Transaction = tran; getProfilesCmd.CommandText = @"SELECT Id, GrabDelay FROM Profiles"; - using (IDataReader profileReader = getProfilesCmd.ExecuteReader()) + using (var profileReader = getProfilesCmd.ExecuteReader()) { while (profileReader.Read()) { @@ -106,7 +106,7 @@ namespace NzbDrone.Core.Datastore.Migration private int InsertTag(IDbConnection conn, IDbTransaction tran, string tagLabel) { - using (IDbCommand insertCmd = conn.CreateCommand()) + using (var insertCmd = conn.CreateCommand()) { insertCmd.Transaction = tran; insertCmd.CommandText = @"INSERT INTO Tags (Label) VALUES (?); SELECT last_insert_rowid()"; @@ -120,13 +120,13 @@ namespace NzbDrone.Core.Datastore.Migration private void UpdateSeries(IDbConnection conn, IDbTransaction tran, IEnumerable profileIds, int tagId) { - using (IDbCommand getSeriesCmd = conn.CreateCommand()) + using (var getSeriesCmd = conn.CreateCommand()) { getSeriesCmd.Transaction = tran; getSeriesCmd.CommandText = "SELECT Id, Tags FROM Series WHERE ProfileId IN (?)"; getSeriesCmd.AddParameter(string.Join(",", profileIds)); - using (IDataReader seriesReader = getSeriesCmd.ExecuteReader()) + using (var seriesReader = getSeriesCmd.ExecuteReader()) { while (seriesReader.Read()) { @@ -136,7 +136,7 @@ namespace NzbDrone.Core.Datastore.Migration var tags = Json.Deserialize>(tagString); tags.Add(tagId); - using (IDbCommand updateSeriesCmd = conn.CreateCommand()) + using (var updateSeriesCmd = conn.CreateCommand()) { updateSeriesCmd.Transaction = tran; updateSeriesCmd.CommandText = "UPDATE Series SET Tags = ? WHERE Id = ?"; diff --git a/src/NzbDrone.Core/Datastore/Migration/072_history_grabid.cs b/src/NzbDrone.Core/Datastore/Migration/072_history_grabid.cs index 40eece1a0..9e51224fb 100644 --- a/src/NzbDrone.Core/Datastore/Migration/072_history_grabid.cs +++ b/src/NzbDrone.Core/Datastore/Migration/072_history_grabid.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Data; using FluentMigrator; @@ -22,7 +22,7 @@ namespace NzbDrone.Core.Datastore.Migration private void MoveToColumn(IDbConnection conn, IDbTransaction tran) { - using (IDbCommand getHistory = conn.CreateCommand()) + using (var getHistory = conn.CreateCommand()) { getHistory.Transaction = tran; getHistory.CommandText = @"SELECT Id, Data FROM History WHERE Data LIKE '%downloadClientId%'"; diff --git a/src/NzbDrone.Core/Datastore/Migration/079_dedupe_tags.cs b/src/NzbDrone.Core/Datastore/Migration/079_dedupe_tags.cs index c371705e6..1f140c937 100644 --- a/src/NzbDrone.Core/Datastore/Migration/079_dedupe_tags.cs +++ b/src/NzbDrone.Core/Datastore/Migration/079_dedupe_tags.cs @@ -45,12 +45,12 @@ namespace NzbDrone.Core.Datastore.Migration { var tags = new List(); - using (IDbCommand tagCmd = conn.CreateCommand()) + using (var tagCmd = conn.CreateCommand()) { tagCmd.Transaction = tran; tagCmd.CommandText = @"SELECT Id, Label FROM Tags"; - using (IDataReader tagReader = tagCmd.ExecuteReader()) + using (var tagReader = tagCmd.ExecuteReader()) { while (tagReader.Read()) { @@ -69,12 +69,12 @@ namespace NzbDrone.Core.Datastore.Migration { var tagged = new List(); - using (IDbCommand tagCmd = conn.CreateCommand()) + using (var tagCmd = conn.CreateCommand()) { tagCmd.Transaction = tran; tagCmd.CommandText = string.Format("SELECT Id, Tags FROM {0}", table); - using (IDataReader tagReader = tagCmd.ExecuteReader()) + using (var tagReader = tagCmd.ExecuteReader()) { while (tagReader.Read()) { @@ -111,7 +111,7 @@ namespace NzbDrone.Core.Datastore.Migration foreach (var model in toUpdate.DistinctBy(m => m.Id)) { - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { updateCmd.Transaction = tran; updateCmd.CommandText = string.Format(@"UPDATE {0} SET Tags = ? WHERE Id = ?", table); @@ -127,7 +127,7 @@ namespace NzbDrone.Core.Datastore.Migration { var idsToRemove = replacements.Select(r => r.OldId).Distinct(); - using (IDbCommand removeCmd = conn.CreateCommand()) + using (var removeCmd = conn.CreateCommand()) { removeCmd.Transaction = tran; removeCmd.CommandText = string.Format("DELETE FROM Tags WHERE Id IN ({0})", string.Join(",", idsToRemove)); diff --git a/src/NzbDrone.Core/Datastore/Migration/102_add_language_to_episodeFiles_history_and_blacklist.cs b/src/NzbDrone.Core/Datastore/Migration/102_add_language_to_episodeFiles_history_and_blacklist.cs index 56d1e84d6..fd9cff0e2 100644 --- a/src/NzbDrone.Core/Datastore/Migration/102_add_language_to_episodeFiles_history_and_blacklist.cs +++ b/src/NzbDrone.Core/Datastore/Migration/102_add_language_to_episodeFiles_history_and_blacklist.cs @@ -32,12 +32,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); @@ -56,11 +56,11 @@ namespace NzbDrone.Core.Datastore.Migration } var seriesLanguages = new Dictionary(); - using (IDbCommand getSeriesCmd = conn.CreateCommand()) + using (var getSeriesCmd = conn.CreateCommand()) { getSeriesCmd.Transaction = tran; getSeriesCmd.CommandText = @"SELECT Id, ProfileId FROM Series"; - using (IDataReader seriesReader = getSeriesCmd.ExecuteReader()) + using (var seriesReader = getSeriesCmd.ExecuteReader()) { while (seriesReader.Read()) { @@ -78,7 +78,7 @@ namespace NzbDrone.Core.Datastore.Migration var seriesIds = group.Select(v => v.ToString()).Join(","); - using (IDbCommand updateEpisodeFilesCmd = conn.CreateCommand()) + using (var updateEpisodeFilesCmd = conn.CreateCommand()) { updateEpisodeFilesCmd.Transaction = tran; updateEpisodeFilesCmd.CommandText = $"UPDATE EpisodeFiles SET Language = ? WHERE SeriesId IN ({seriesIds})"; @@ -89,7 +89,7 @@ namespace NzbDrone.Core.Datastore.Migration updateEpisodeFilesCmd.ExecuteNonQuery(); } - using (IDbCommand updateHistoryCmd = conn.CreateCommand()) + using (var updateHistoryCmd = conn.CreateCommand()) { updateHistoryCmd.Transaction = tran; updateHistoryCmd.CommandText = $"UPDATE History SET Language = ? WHERE SeriesId IN ({seriesIds})"; @@ -100,7 +100,7 @@ namespace NzbDrone.Core.Datastore.Migration updateHistoryCmd.ExecuteNonQuery(); } - using (IDbCommand updateBlacklistCmd = conn.CreateCommand()) + using (var updateBlacklistCmd = conn.CreateCommand()) { updateBlacklistCmd.Transaction = tran; updateBlacklistCmd.CommandText = $"UPDATE Blacklist SET Language = ? WHERE SeriesId IN ({seriesIds})"; diff --git a/src/NzbDrone.Core/Datastore/Migration/111_create_language_profiles.cs b/src/NzbDrone.Core/Datastore/Migration/111_create_language_profiles.cs index e66de0593..0405a339a 100644 --- a/src/NzbDrone.Core/Datastore/Migration/111_create_language_profiles.cs +++ b/src/NzbDrone.Core/Datastore/Migration/111_create_language_profiles.cs @@ -33,7 +33,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; insertNewLanguageProfileCmd.CommandText = "INSERT INTO LanguageProfiles (Id, Name, Cutoff, Languages) VALUES (?, ?, ?, ?)"; @@ -47,7 +47,7 @@ namespace NzbDrone.Core.Datastore.Migration insertNewLanguageProfileCmd.ExecuteNonQuery(); } - using (IDbCommand updateSeriesCmd = conn.CreateCommand()) + using (var updateSeriesCmd = conn.CreateCommand()) { foreach (var profileId in profile.ProfileIds) { @@ -84,12 +84,12 @@ namespace NzbDrone.Core.Datastore.Migration var profiles = GetDefaultLanguageProfiles(); var thereAreProfiles = false; - using (IDbCommand getProfilesCmd = conn.CreateCommand()) + using (var getProfilesCmd = conn.CreateCommand()) { getProfilesCmd.Transaction = tran; getProfilesCmd.CommandText = @"SELECT Id, Language FROM Profiles"; - using (IDataReader profileReader = getProfilesCmd.ExecuteReader()) + using (var profileReader = getProfilesCmd.ExecuteReader()) { while (profileReader.Read()) { diff --git a/src/NzbDrone.Core/Datastore/Migration/132_add_download_client_priority.cs b/src/NzbDrone.Core/Datastore/Migration/132_add_download_client_priority.cs index 9430b59f1..f70cbc89d 100644 --- a/src/NzbDrone.Core/Datastore/Migration/132_add_download_client_priority.cs +++ b/src/NzbDrone.Core/Datastore/Migration/132_add_download_client_priority.cs @@ -29,8 +29,8 @@ namespace NzbDrone.Core.Datastore.Migration using (var reader = cmd.ExecuteReader()) { - int nextUsenet = 1; - int nextTorrent = 1; + var nextUsenet = 1; + var nextTorrent = 1; while (reader.Read()) { var id = reader.GetInt32(0); diff --git a/src/NzbDrone.Core/Datastore/Migration/134_add_specials_folder_format.cs b/src/NzbDrone.Core/Datastore/Migration/134_add_specials_folder_format.cs index 3be8fb369..c0ecab3fc 100644 --- a/src/NzbDrone.Core/Datastore/Migration/134_add_specials_folder_format.cs +++ b/src/NzbDrone.Core/Datastore/Migration/134_add_specials_folder_format.cs @@ -17,7 +17,7 @@ namespace NzbDrone.Core.Datastore.Migration { var defaultFormat = "Specials"; - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { updateCmd.Transaction = tran; updateCmd.CommandText = "UPDATE NamingConfig SET SpecialsFolderFormat = ?"; diff --git a/src/NzbDrone.Core/Datastore/Migration/147_swap_filechmod_for_folderchmod.cs b/src/NzbDrone.Core/Datastore/Migration/147_swap_filechmod_for_folderchmod.cs index 0a9835f4c..ab5f0e9d3 100644 --- a/src/NzbDrone.Core/Datastore/Migration/147_swap_filechmod_for_folderchmod.cs +++ b/src/NzbDrone.Core/Datastore/Migration/147_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'"; @@ -31,7 +31,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', ?)"; @@ -41,7 +41,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/163_mediainfo_to_ffmpeg.cs b/src/NzbDrone.Core/Datastore/Migration/163_mediainfo_to_ffmpeg.cs index 7889666d5..c285fe15a 100644 --- a/src/NzbDrone.Core/Datastore/Migration/163_mediainfo_to_ffmpeg.cs +++ b/src/NzbDrone.Core/Datastore/Migration/163_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/166_update_series_sort_title.cs b/src/NzbDrone.Core/Datastore/Migration/166_update_series_sort_title.cs index 0f72b980f..c455b7c2f 100644 --- a/src/NzbDrone.Core/Datastore/Migration/166_update_series_sort_title.cs +++ b/src/NzbDrone.Core/Datastore/Migration/166_update_series_sort_title.cs @@ -15,11 +15,11 @@ namespace NzbDrone.Core.Datastore.Migration private void UpdateSortTitles(IDbConnection conn, IDbTransaction tran) { - using (IDbCommand getSeriesCmd = conn.CreateCommand()) + using (var getSeriesCmd = conn.CreateCommand()) { getSeriesCmd.Transaction = tran; getSeriesCmd.CommandText = @"SELECT Id, TvdbId, Title FROM Series"; - using (IDataReader seriesReader = getSeriesCmd.ExecuteReader()) + using (var seriesReader = getSeriesCmd.ExecuteReader()) { while (seriesReader.Read()) { @@ -29,7 +29,7 @@ namespace NzbDrone.Core.Datastore.Migration var sortTitle = SeriesTitleNormalizer.Normalize(title, tvdbId); - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { updateCmd.Transaction = tran; updateCmd.CommandText = "UPDATE Series SET SortTitle = ? WHERE Id = ?"; diff --git a/src/NzbDrone.Core/Datastore/Migration/171_add_custom_formats.cs b/src/NzbDrone.Core/Datastore/Migration/171_add_custom_formats.cs index fa6ea1924..1fe016229 100644 --- a/src/NzbDrone.Core/Datastore/Migration/171_add_custom_formats.cs +++ b/src/NzbDrone.Core/Datastore/Migration/171_add_custom_formats.cs @@ -182,11 +182,11 @@ namespace NzbDrone.Core.Datastore.Migration private void MigrateNamingConfigs(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()) { var standardEpisodeFormatIndex = namingConfigReader.GetOrdinal("StandardEpisodeFormat"); var dailyEpisodeFormatIndex = namingConfigReader.GetOrdinal("DailyEpisodeFormat"); @@ -198,7 +198,7 @@ namespace NzbDrone.Core.Datastore.Migration var dailyEpisodeFormat = NameReplace(namingConfigReader.GetString(dailyEpisodeFormatIndex)); var animeEpisodeFormat = NameReplace(namingConfigReader.GetString(animeEpisodeFormatIndex)); - using (IDbCommand updateCmd = conn.CreateCommand()) + using (var updateCmd = conn.CreateCommand()) { var text = string.Format("UPDATE NamingConfig " + "SET StandardEpisodeFormat = '{0}', " + diff --git a/src/NzbDrone.Core/Datastore/Migration/Framework/SqliteSchemaDumper.cs b/src/NzbDrone.Core/Datastore/Migration/Framework/SqliteSchemaDumper.cs index 7753bb446..e4b79f730 100644 --- a/src/NzbDrone.Core/Datastore/Migration/Framework/SqliteSchemaDumper.cs +++ b/src/NzbDrone.Core/Datastore/Migration/Framework/SqliteSchemaDumper.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Data; using System.Linq; using FluentMigrator.Model; @@ -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 cf35b8adb..0b39ebc01 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/UsenetDownloadStation.cs b/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs index 993539b1a..27bc2bbdf 100644 --- a/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs +++ b/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs @@ -63,7 +63,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 4ab32e909..54974815c 100644 --- a/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs +++ b/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs @@ -222,7 +222,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 2aba58252..c291bb06f 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.TvCategory.IsNotNullOrWhiteSpace() && !labels.ContainsKey(Settings.TvCategory)) { 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 12a24047d..ebfbe8559 100644 --- a/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs +++ b/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs @@ -124,7 +124,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.TvCategory.IsNotNullOrWhiteSpace() && torrent.Category != Settings.TvCategory) diff --git a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs index cd7a96a32..6a7b372e4 100644 --- a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs +++ b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Net; @@ -215,7 +215,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 636ea94d5..46c2b9024 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(localEpisode, episodeFile, 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(localEpisode, episodeFile, managedFiles[i], isReadOnly); } diff --git a/src/NzbDrone.Core/Extras/Others/OtherExtraService.cs b/src/NzbDrone.Core/Extras/Others/OtherExtraService.cs index c7b5b1ab0..1a1d167c9 100644 --- a/src/NzbDrone.Core/Extras/Others/OtherExtraService.cs +++ b/src/NzbDrone.Core/Extras/Others/OtherExtraService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -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 bd8bf7e74..b7bbe8ea6 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 9d1e4dcb5..1aab8bbb9 100644 --- a/src/NzbDrone.Core/Fluent.cs +++ b/src/NzbDrone.Core/Fluent.cs @@ -100,17 +100,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 8ed876dea..dc3d46700 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/PackageGlobalMessageCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/PackageGlobalMessageCheck.cs @@ -20,7 +20,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/HttpImportListBase.cs b/src/NzbDrone.Core/ImportLists/HttpImportListBase.cs index 1936ced7d..8a19ab64c 100644 --- a/src/NzbDrone.Core/ImportLists/HttpImportListBase.cs +++ b/src/NzbDrone.Core/ImportLists/HttpImportListBase.cs @@ -54,7 +54,7 @@ namespace NzbDrone.Core.ImportLists var pageableRequestChain = pageableRequestChainSelector(generator); - 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/ImportLists/Plex/PlexParser.cs b/src/NzbDrone.Core/ImportLists/Plex/PlexParser.cs index a0accb9da..bae313726 100644 --- a/src/NzbDrone.Core/ImportLists/Plex/PlexParser.cs +++ b/src/NzbDrone.Core/ImportLists/Plex/PlexParser.cs @@ -36,8 +36,8 @@ namespace NzbDrone.Core.ImportLists.Plex var tmdbIdString = FindGuid(item.Guids, "tmdb"); var imdbId = FindGuid(item.Guids, "imdb"); - int.TryParse(tvdbIdString, out int tvdbId); - int.TryParse(tmdbIdString, out int tmdbId); + int.TryParse(tvdbIdString, out var tvdbId); + int.TryParse(tmdbIdString, out var tmdbId); series.Add(new ImportListItemInfo { diff --git a/src/NzbDrone.Core/Indexers/BroadcastheNet/BroadcastheNetParser.cs b/src/NzbDrone.Core/Indexers/BroadcastheNet/BroadcastheNetParser.cs index cb82acf06..51469b0ff 100644 --- a/src/NzbDrone.Core/Indexers/BroadcastheNet/BroadcastheNetParser.cs +++ b/src/NzbDrone.Core/Indexers/BroadcastheNet/BroadcastheNetParser.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Net; using System.Text.RegularExpressions; @@ -43,7 +43,7 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet throw new IndexerException(indexerResponse, "Indexer API returned an internal server error"); } - JsonRpcResponse jsonResponse = new HttpResponse>(indexerResponse.HttpResponse).Resource; + var jsonResponse = new HttpResponse>(indexerResponse.HttpResponse).Resource; if (jsonResponse.Error != null || jsonResponse.Result == null) { diff --git a/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs b/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs index 0be68fb9a..cabe20948 100644 --- a/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs +++ b/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs @@ -132,7 +132,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/MediaCover/MediaCoverService.cs b/src/NzbDrone.Core/MediaCover/MediaCoverService.cs index 4e5d76984..c8a900253 100644 --- a/src/NzbDrone.Core/MediaCover/MediaCoverService.cs +++ b/src/NzbDrone.Core/MediaCover/MediaCoverService.cs @@ -109,7 +109,7 @@ namespace NzbDrone.Core.MediaCover private bool EnsureCovers(Series series) { - bool updated = false; + var updated = false; var toResize = new List>(); foreach (var cover in series.Images) diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs index 33be2c397..c01e5536b 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs @@ -452,7 +452,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.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/EpisodeImport/Specifications/NotUnpackingSpecification.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotUnpackingSpecification.cs index 5b42a609e..f8097737d 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotUnpackingSpecification.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotUnpackingSpecification.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using NLog; using NzbDrone.Common.Disk; @@ -33,7 +33,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications foreach (var workingFolder in _configService.DownloadClientWorkingFolders.Split('|')) { - DirectoryInfo parent = Directory.GetParent(localEpisode.Path); + var parent = Directory.GetParent(localEpisode.Path); while (parent != null) { if (parent.Name.StartsWith(workingFolder)) diff --git a/src/NzbDrone.Core/MediaFiles/UpdateEpisodeFileService.cs b/src/NzbDrone.Core/MediaFiles/UpdateEpisodeFileService.cs index 04febdc54..172cb5aba 100644 --- a/src/NzbDrone.Core/MediaFiles/UpdateEpisodeFileService.cs +++ b/src/NzbDrone.Core/MediaFiles/UpdateEpisodeFileService.cs @@ -84,7 +84,7 @@ namespace NzbDrone.Core.MediaFiles if (DateTime.TryParse(fileDate + ' ' + fileTime, out var airDate)) { // avoiding false +ve checks and set date skewing by not using UTC (Windows) - DateTime oldDateTime = _diskProvider.FileGetLastWrite(filePath); + var oldDateTime = _diskProvider.FileGetLastWrite(filePath); if (OsInfo.IsNotWindows && airDate < EpochTime) { @@ -117,7 +117,7 @@ namespace NzbDrone.Core.MediaFiles private bool ChangeFileDateToUtcAirDate(string filePath, DateTime airDateUtc) { - DateTime oldLastWrite = _diskProvider.FileGetLastWrite(filePath); + var oldLastWrite = _diskProvider.FileGetLastWrite(filePath); if (OsInfo.IsNotWindows && airDateUtc < EpochTime) { diff --git a/src/NzbDrone.Core/Messaging/Commands/CommandExecutor.cs b/src/NzbDrone.Core/Messaging/Commands/CommandExecutor.cs index 18dabae07..cc263b161 100644 --- a/src/NzbDrone.Core/Messaging/Commands/CommandExecutor.cs +++ b/src/NzbDrone.Core/Messaging/Commands/CommandExecutor.cs @@ -127,7 +127,7 @@ namespace NzbDrone.Core.Messaging.Commands { _cancellationTokenSource = new CancellationTokenSource(); - for (int i = 0; i < THREAD_LIMIT; i++) + for (var i = 0; i < THREAD_LIMIT; 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/SearchSeriesComparer.cs b/src/NzbDrone.Core/MetadataSource/SearchSeriesComparer.cs index 7b49247a5..724964277 100644 --- a/src/NzbDrone.Core/MetadataSource/SearchSeriesComparer.cs +++ b/src/NzbDrone.Core/MetadataSource/SearchSeriesComparer.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Text.RegularExpressions; using NzbDrone.Common.Extensions; @@ -35,7 +35,7 @@ namespace NzbDrone.Core.MetadataSource public int Compare(Series x, Series 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/Notifications/Xbmc/Model/XbmcVersion.cs b/src/NzbDrone.Core/Notifications/Xbmc/Model/XbmcVersion.cs index 1c6ca0c06..ba32635dc 100644 --- a/src/NzbDrone.Core/Notifications/Xbmc/Model/XbmcVersion.cs +++ b/src/NzbDrone.Core/Notifications/Xbmc/Model/XbmcVersion.cs @@ -107,7 +107,7 @@ namespace NzbDrone.Core.Notifications.Xbmc.Model unchecked { // Overflow is fine, just wrap - int hash = 17; + var hash = 17; hash = (hash * 23) + Major.GetHashCode(); hash = (hash * 23) + Minor.GetHashCode(); hash = (hash * 23) + Patch.GetHashCode(); diff --git a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs index 6d6ca214c..5b638cfbd 100644 --- a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs +++ b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs @@ -460,7 +460,7 @@ namespace NzbDrone.Core.Organizer { var episodeFormats = GetEpisodeFormat(pattern).DistinctBy(v => v.SeasonEpisodePattern).ToList(); - int index = 1; + var index = 1; foreach (var episodeFormat in episodeFormats) { var seasonEpisodePattern = episodeFormat.SeasonEpisodePattern; @@ -523,7 +523,7 @@ namespace NzbDrone.Core.Organizer { var absoluteEpisodeFormats = GetAbsoluteFormat(pattern).DistinctBy(v => v.AbsoluteEpisodePattern).ToList(); - int index = 1; + var index = 1; foreach (var absoluteEpisodeFormat in absoluteEpisodeFormats) { if (series.SeriesType != SeriesTypes.Anime || episodes.Any(e => !e.AbsoluteEpisodeNumber.HasValue)) @@ -711,7 +711,7 @@ namespace NzbDrone.Core.Organizer } } - for (int i = 0; i < tokens.Count; i++) + for (var i = 0; i < tokens.Count; i++) { try { @@ -872,7 +872,7 @@ namespace NzbDrone.Core.Organizer { var pattern = string.Empty; - for (int i = 0; i < episodes.Count; i++) + for (var i = 0; i < episodes.Count; i++) { var patternToReplace = i == 0 ? basePattern : formatPattern; @@ -886,7 +886,7 @@ namespace NzbDrone.Core.Organizer { var pattern = string.Empty; - for (int i = 0; i < episodes.Count; i++) + for (var i = 0; i < episodes.Count; i++) { var patternToReplace = i == 0 ? basePattern : formatPattern; diff --git a/src/NzbDrone.Core/Parser/LanguageParser.cs b/src/NzbDrone.Core/Parser/LanguageParser.cs index 3d38efab3..c55e4d07b 100644 --- a/src/NzbDrone.Core/Parser/LanguageParser.cs +++ b/src/NzbDrone.Core/Parser/LanguageParser.cs @@ -208,7 +208,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/Model/ParsedEpisodeInfo.cs b/src/NzbDrone.Core/Parser/Model/ParsedEpisodeInfo.cs index 20ee0d024..9423bd5ca 100644 --- a/src/NzbDrone.Core/Parser/Model/ParsedEpisodeInfo.cs +++ b/src/NzbDrone.Core/Parser/Model/ParsedEpisodeInfo.cs @@ -91,7 +91,7 @@ namespace NzbDrone.Core.Parser.Model public override string ToString() { - string episodeString = "[Unknown Episode]"; + var episodeString = "[Unknown Episode]"; if (IsDaily && EpisodeNumbers.Empty()) { diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index 1a62d1dd3..dd9b96195 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -905,7 +905,7 @@ namespace NzbDrone.Core.Parser int.TryParse(matchCollection[0].Groups["airyear"].Value, out var airYear); - int lastSeasonEpisodeStringIndex = matchCollection[0].Groups["title"].EndIndex(); + var lastSeasonEpisodeStringIndex = matchCollection[0].Groups["title"].EndIndex(); ParsedEpisodeInfo result; diff --git a/src/NzbDrone.Core/Parser/ParsingService.cs b/src/NzbDrone.Core/Parser/ParsingService.cs index fc1792f24..987028f5a 100644 --- a/src/NzbDrone.Core/Parser/ParsingService.cs +++ b/src/NzbDrone.Core/Parser/ParsingService.cs @@ -571,7 +571,7 @@ namespace NzbDrone.Core.Parser { if (series.UseSceneNumbering && sceneSource) { - List episodes = new List(); + var episodes = new List(); if (searchCriteria != null) { diff --git a/src/NzbDrone.Core/Profiles/Delay/DelayProfileService.cs b/src/NzbDrone.Core/Profiles/Delay/DelayProfileService.cs index b95072763..b71f80dd4 100644 --- a/src/NzbDrone.Core/Profiles/Delay/DelayProfileService.cs +++ b/src/NzbDrone.Core/Profiles/Delay/DelayProfileService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using NzbDrone.Common.Cache; @@ -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 ba9582e07..4370c4df0 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 016f6cf12..e375188fc 100644 --- a/src/NzbDrone.Core/Qualities/QualityModel.cs +++ b/src/NzbDrone.Core/Qualities/QualityModel.cs @@ -40,7 +40,7 @@ namespace NzbDrone.Core.Qualities unchecked { // Overflow is fine, just wrap - 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 8aa34ff89..b3812ed90 100644 --- a/src/NzbDrone.Core/Qualities/QualityModelComparer.cs +++ b/src/NzbDrone.Core/Qualities/QualityModelComparer.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using NzbDrone.Common.EnsureThat; using NzbDrone.Core.Profiles.Qualities; @@ -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/RootFolders/RootFolderService.cs b/src/NzbDrone.Core/RootFolders/RootFolderService.cs index c3ddd3ba8..8702ddfbf 100644 --- a/src/NzbDrone.Core/RootFolders/RootFolderService.cs +++ b/src/NzbDrone.Core/RootFolders/RootFolderService.cs @@ -148,7 +148,7 @@ namespace NzbDrone.Core.RootFolders if (subFolderDepth > 0) { - for (int i = 0; i < subFolderDepth; i++) + for (var i = 0; i < subFolderDepth; i++) { possibleSeriesFolders = possibleSeriesFolders.SelectMany(_diskProvider.GetDirectories).ToList(); } diff --git a/src/NzbDrone.Core/Tv/SeriesService.cs b/src/NzbDrone.Core/Tv/SeriesService.cs index 82ceee980..864eba357 100644 --- a/src/NzbDrone.Core/Tv/SeriesService.cs +++ b/src/NzbDrone.Core/Tv/SeriesService.cs @@ -96,7 +96,7 @@ namespace NzbDrone.Core.Tv public Series FindByTitleInexact(string title) { // find any series clean title within the provided release title - string cleanTitle = title.CleanSeriesTitle(); + var cleanTitle = title.CleanSeriesTitle(); var list = _seriesRepository.FindByTitleInexact(cleanTitle); if (!list.Any()) { diff --git a/src/NzbDrone.Mono.Test/DiskProviderTests/DiskProviderFixture.cs b/src/NzbDrone.Mono.Test/DiskProviderTests/DiskProviderFixture.cs index 913e69fa5..4c02386ec 100644 --- a/src/NzbDrone.Mono.Test/DiskProviderTests/DiskProviderFixture.cs +++ b/src/NzbDrone.Mono.Test/DiskProviderTests/DiskProviderFixture.cs @@ -59,7 +59,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 515a1b1fa..30811edbf 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:\\Sonarr\\".AsOsAgnostic(); + var targetFolder = "c:\\Sonarr\\".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:\\Sonarr\\".AsOsAgnostic(); - string targetProcess = "c:\\Sonarr\\Sonarr.Console".AsOsAgnostic().ProcessNameToExe(); + var targetFolder = "c:\\Sonarr\\".AsOsAgnostic(); + var targetProcess = "c:\\Sonarr\\Sonarr.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 ec2fa3bc2..616c5d2da 100644 --- a/src/NzbDrone.Update/UpdateEngine/InstallUpdateService.cs +++ b/src/NzbDrone.Update/UpdateEngine/InstallUpdateService.cs @@ -151,7 +151,7 @@ namespace NzbDrone.Update.UpdateEngine _logger.Info("Waiting for external auto-restart."); var theDakoLimit = 10; - for (int i = 0; i < theDakoLimit; i++) + for (var i = 0; i < theDakoLimit; 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 fdb0b0988..1cda90713 100644 --- a/src/NzbDrone.Windows.Test/DiskProviderTests/FreeSpaceFixture.cs +++ b/src/NzbDrone.Windows.Test/DiskProviderTests/FreeSpaceFixture.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using FluentAssertions; using NUnit.Framework; using NzbDrone.Common.Test.DiskTests; @@ -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/ServiceHelpers/ServiceInstall/ServiceHelper.cs b/src/ServiceHelpers/ServiceInstall/ServiceHelper.cs index 1162f764c..7e412aa4d 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 a1b97ccad..efcc26626 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); } diff --git a/src/Sonarr.Api.V3/Logs/LogFileControllerBase.cs b/src/Sonarr.Api.V3/Logs/LogFileControllerBase.cs index d305174db..9c58ed40a 100644 --- a/src/Sonarr.Api.V3/Logs/LogFileControllerBase.cs +++ b/src/Sonarr.Api.V3/Logs/LogFileControllerBase.cs @@ -33,7 +33,7 @@ namespace Sonarr.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/Sonarr.Http/ClientSchema/SchemaBuilder.cs b/src/Sonarr.Http/ClientSchema/SchemaBuilder.cs index 0f79f4ff6..079262827 100644 --- a/src/Sonarr.Http/ClientSchema/SchemaBuilder.cs +++ b/src/Sonarr.Http/ClientSchema/SchemaBuilder.cs @@ -86,7 +86,7 @@ namespace Sonarr.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/Sonarr.RuntimePatches/RuntimePatchExtensions.cs b/src/Sonarr.RuntimePatches/RuntimePatchExtensions.cs index c14ac6ed2..0d5a3c01f 100644 --- a/src/Sonarr.RuntimePatches/RuntimePatchExtensions.cs +++ b/src/Sonarr.RuntimePatches/RuntimePatchExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -42,7 +42,7 @@ namespace NzbDrone.RuntimePatches public static string GetSimplifiedName(this Type t, bool includeNamespace = false) { - StringBuilder sb = new StringBuilder(); + var sb = new StringBuilder(); if (includeNamespace && string.IsNullOrEmpty(t.Namespace)) { @@ -55,7 +55,7 @@ namespace NzbDrone.RuntimePatches sb.Append(t.Name, 0, t.Name.LastIndexOf('`')); sb.Append('<'); var args = t.GetGenericArguments(); - for (int i = 0; i < args.Length; i++) + for (var i = 0; i < args.Length; i++) { if (i != 0) {