Use 'var' instead of explicit type

This commit is contained in:
Bogdan 2023-05-23 13:52:39 +03:00 committed by Mark McDowall
parent 281add47de
commit 12374f7f00
113 changed files with 269 additions and 269 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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<string>();
for (int i = 0; i < 10; i++)
for (var i = 0; i < 10; i++)
{
_cachedString.Get("key",
() =>

View File

@ -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;

View File

@ -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<IDiskProvider>()
@ -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<IDiskProvider>()
@ -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<IDiskProvider>()

View File

@ -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;

View File

@ -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();

View File

@ -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;

View File

@ -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<string>();
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]);
}

View File

@ -90,7 +90,7 @@ namespace NzbDrone.Common.Expansive
return source.ExpandInternal(
name =>
{
IDictionary<string, object> modelDict = model.ToDictionary();
var modelDict = model.ToDictionary();
if (RequireAllExpansions && !modelDict.ContainsKey(name))
{
return "";

View File

@ -57,7 +57,7 @@ namespace NzbDrone.Common.Expansive
{
// return (Parent == null) ? this : Parent.Root;
TreeNode<T> node = this;
var node = this;
while (node.Parent != null)
{
node = node.Parent;
@ -74,7 +74,7 @@ namespace NzbDrone.Common.Expansive
get
{
_CallTree = new List<T>();
TreeNode<T> node = this;
var node = this;
while (node.Parent != null)
{
node = node.Parent;

View File

@ -126,9 +126,9 @@ namespace NzbDrone.Common.Extensions
private static IEnumerable<T> InternalDropLast<T>(IEnumerable<T> source, int n)
{
Queue<T> buffer = new Queue<T>(n + 1);
var buffer = new Queue<T>(n + 1);
foreach (T x in source)
foreach (var x in source)
{
buffer.Enqueue(x);

View File

@ -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;

View File

@ -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])
{

View File

@ -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++)

View File

@ -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())
{

View File

@ -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("*"))
{

View File

@ -16,7 +16,7 @@ namespace NzbDrone.Common.Instrumentation
}
}
foreach (JToken token in json)
foreach (var token in json)
{
Visit(token);
}

View File

@ -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}}";

View File

@ -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);
}

View File

@ -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]))
{

View File

@ -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)

View File

@ -137,7 +137,7 @@ namespace NzbDrone.Common.TPL
/// <returns>An enumerable of the tasks currently scheduled.</returns>
protected sealed override IEnumerable<Task> GetScheduledTasks()
{
bool lockTaken = false;
var lockTaken = false;
try
{
Monitor.TryEnter(_tasks, ref lockTaken);

View File

@ -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);

View File

@ -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];
}

View File

@ -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);

View File

@ -116,7 +116,7 @@ namespace NzbDrone.Core.Test.Extras
private void WithExistingFiles(List<string> files)
{
foreach (string file in files)
foreach (var file in files)
{
WithExistingFile(file);
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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();
}

View File

@ -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]);
}

View File

@ -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];

View File

@ -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> { Language.Spanish } };
var qualityRawHDLanguageExceed = new EpisodeFile { RelativePath = "i", Quality = new QualityModel { Quality = Quality.RAWHD }, Languages = new List<Language> { Language.French } };
MediaFileRepository fileRepository = Mocker.Resolve<MediaFileRepository>();
var fileRepository = Mocker.Resolve<MediaFileRepository>();
qualityMetLanguageUnmet = fileRepository.Insert(qualityMetLanguageUnmet);
qualityMetLanguageMet = fileRepository.Insert(qualityMetLanguageMet);

View File

@ -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;
}

View File

@ -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];
}

View File

@ -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;

View File

@ -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)
{

View File

@ -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();
}

View File

@ -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<dynamic>();
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);

View File

@ -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}', " +

View File

@ -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}'",

View File

@ -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}'" +

View File

@ -29,11 +29,11 @@ namespace NzbDrone.Core.Datastore.Migration
var qualityProfileItemConverter = new EmbeddedDocumentConverter<List<QualityProfileQualityItem>>(new QualityIntConverter());
// Convert 'Allowed' column in QualityProfiles from Json List<object> to Json List<int> (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<DestinationQualityModel036>(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 = ?";

View File

@ -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 (?, ?, ?, ?, ?)";

View File

@ -19,11 +19,11 @@ namespace NzbDrone.Core.Datastore.Migration
{
var config = new Dictionary<string, string>();
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', " +

View File

@ -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<string>("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<MigrationHistoryItem>();
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"];

View File

@ -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 = ?";

View File

@ -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 = ?";

View File

@ -26,12 +26,12 @@ namespace NzbDrone.Core.Datastore.Migration
{
var qualitiesToUpdate = new Dictionary<string, string>();
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 = ?";

View File

@ -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 (?, '[]')";

View File

@ -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;

View File

@ -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<Profile69>();
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<int> 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<List<int>>(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 = ?";

View File

@ -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%'";

View File

@ -45,12 +45,12 @@ namespace NzbDrone.Core.Datastore.Migration
{
var tags = new List<Tag079>();
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<TaggedModel079>();
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));

View File

@ -32,12 +32,12 @@ namespace NzbDrone.Core.Datastore.Migration
var languageConverter = new EmbeddedDocumentConverter<List<Language>>(new LanguageIntConverter());
var profileLanguages = new Dictionary<int, int>();
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<int, int>();
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})";

View File

@ -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())
{

View File

@ -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);

View File

@ -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 = ?";

View File

@ -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'";

View File

@ -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")
{

View File

@ -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 = ?";

View File

@ -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}', " +

View File

@ -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<TableDefinition> ReadDbSchema()
{
IList<TableDefinition> 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<IndexDefinition> 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<IndexDefinition> indexes = new List<IndexDefinition>();

View File

@ -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;

View File

@ -63,7 +63,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
var items = new List<DownloadClientItem>();
long totalRemainingSize = 0;
long globalSpeed = nzbTasks.Where(t => t.Status == DownloadStationTaskStatus.Downloading)
var globalSpeed = nzbTasks.Where(t => t.Status == DownloadStationTaskStatus.Downloading)
.Select(GetDownloadSpeed)
.Sum();

View File

@ -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);
}
}

View File

@ -222,7 +222,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
protected IEnumerable<NzbgetCategory> GetCategories(Dictionary<string, string> config)
{
for (int i = 1; i < 100; i++)
for (var i = 1; i < 100; i++)
{
var name = config.GetValueOrDefault("Category" + i + ".Name");

View File

@ -494,7 +494,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
return null;
}
Dictionary<string, QBittorrentLabel> labels = Proxy.GetLabels(Settings);
var labels = Proxy.GetLabels(Settings);
if (Settings.TvCategory.IsNotNullOrWhiteSpace() && !labels.ContainsKey(Settings.TvCategory))
{

View File

@ -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]);
}

View File

@ -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<DownloadClientItem>();
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)

View File

@ -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")
{

View File

@ -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)

View File

@ -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);
}

View File

@ -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
{

View File

@ -177,7 +177,7 @@ namespace NzbDrone.Core.Extras.Subtitles
var subtitleFiles = new List<SubtitleFile>();
foreach (string file in matchingFiles)
foreach (var file in matchingFiles)
{
var language = LanguageParser.ParseSubtitleLanguage(file);
var extension = Path.GetExtension(file);

View File

@ -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;

View File

@ -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:"))
{

View File

@ -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);

View File

@ -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
{

View File

@ -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<BroadcastheNetTorrents> jsonResponse = new HttpResponse<JsonRpcResponse<BroadcastheNetTorrents>>(indexerResponse.HttpResponse).Resource;
var jsonResponse = new HttpResponse<JsonRpcResponse<BroadcastheNetTorrents>>(indexerResponse.HttpResponse).Resource;
if (jsonResponse.Error != null || jsonResponse.Result == null)
{

View File

@ -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);

View File

@ -109,7 +109,7 @@ namespace NzbDrone.Core.MediaCover
private bool EnsureCovers(Series series)
{
bool updated = false;
var updated = false;
var toResize = new List<Tuple<MediaCover, bool>>();
foreach (var cover in series.Images)

View File

@ -452,7 +452,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual
var imported = new List<ImportResult>();
var importedTrackedDownload = new List<ManuallyImportedFile>();
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);

View File

@ -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))

View File

@ -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)
{

View File

@ -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();

View File

@ -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;

View File

@ -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)));

View File

@ -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();

View File

@ -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;

View File

@ -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))
{

View File

@ -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())
{

View File

@ -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;

View File

@ -571,7 +571,7 @@ namespace NzbDrone.Core.Parser
{
if (series.UseSceneNumbering && sceneSource)
{
List<Episode> episodes = new List<Episode>();
var episodes = new List<Episode>();
if (searchCriteria != null)
{

View File

@ -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)
{

View File

@ -66,8 +66,8 @@ namespace NzbDrone.Core.Qualities
private void InsertMissingDefinitions()
{
List<QualityDefinition> insertList = new List<QualityDefinition>();
List<QualityDefinition> updateList = new List<QualityDefinition>();
var insertList = new List<QualityDefinition>();
var updateList = new List<QualityDefinition>();
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<QualityDefinition> updateList = new List<QualityDefinition>();
var updateList = new List<QualityDefinition>();
var allDefinitions = Quality.DefaultQualityDefinitions.OrderBy(d => d.Weight).ToList();
var existingDefinitions = _repo.All().ToList();

View File

@ -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;

View File

@ -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)
{

View File

@ -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();
}

Some files were not shown because too many files have changed in this diff Show More