Use 'var' instead of explicit type

(cherry picked from commit 12374f7f0038e5b25548f5ab3f71122410832393)
This commit is contained in:
Bogdan 2023-05-23 13:52:39 +03:00
parent 8762588ef0
commit c987824174
115 changed files with 257 additions and 258 deletions

View File

@ -68,7 +68,7 @@ namespace NzbDrone.Automation.Test
{ {
try try
{ {
Screenshot image = ((ITakesScreenshot)driver).GetScreenshot(); var image = ((ITakesScreenshot)driver).GetScreenshot();
image.SaveAsFile($"./{name}_test_screenshot.png", ScreenshotImageFormat.Png); image.SaveAsFile($"./{name}_test_screenshot.png", ScreenshotImageFormat.Png);
} }
catch (Exception ex) catch (Exception ex)

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Threading; using System.Threading;
using OpenQA.Selenium; using OpenQA.Selenium;
using OpenQA.Selenium.Remote; using OpenQA.Selenium.Remote;
@ -37,7 +37,7 @@ namespace NzbDrone.Automation.Test.PageModel
{ {
try try
{ {
IWebElement element = d.FindElement(By.ClassName("followingBalls")); var element = d.FindElement(By.ClassName("followingBalls"));
return !element.Displayed; return !element.Displayed;
} }
catch (NoSuchElementException) catch (NoSuchElementException)

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Threading; using System.Threading;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
@ -65,9 +65,9 @@ namespace NzbDrone.Common.Test.CacheTests
[Test] [Test]
public void should_store_null() 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", () => _cachedString.Get("key", () =>
{ {
@ -83,10 +83,10 @@ namespace NzbDrone.Common.Test.CacheTests
[Platform(Exclude = "MacOsX")] [Platform(Exclude = "MacOsX")]
public void should_honor_ttl() public void should_honor_ttl()
{ {
int hitCount = 0; var hitCount = 0;
_cachedString = new Cached<string>(); _cachedString = new Cached<string>();
for (int i = 0; i < 10; i++) for (var i = 0; i < 10; i++)
{ {
_cachedString.Get("key", _cachedString.Get("key",
() => () =>

View File

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
@ -142,7 +142,7 @@ namespace NzbDrone.Common.Test
[Test] [Test]
public void SaveDictionary_should_save_proper_value() public void SaveDictionary_should_save_proper_value()
{ {
int port = 20555; var port = 20555;
var dic = Subject.GetConfigDictionary(); var dic = Subject.GetConfigDictionary();
dic["Port"] = 20555; dic["Port"] = 20555;
@ -155,9 +155,9 @@ namespace NzbDrone.Common.Test
[Test] [Test]
public void SaveDictionary_should_only_save_specified_values() public void SaveDictionary_should_only_save_specified_values()
{ {
int port = 20555; var port = 20555;
int origSslPort = 20551; var origSslPort = 20551;
int sslPort = 20552; var sslPort = 20552;
var dic = Subject.GetConfigDictionary(); var dic = Subject.GetConfigDictionary();
dic["Port"] = port; dic["Port"] = port;

View File

@ -42,7 +42,7 @@ namespace NzbDrone.Common.Test.DiskTests
[Test] [Test]
public void should_not_contain_recycling_bin_for_root_of_drive() public void should_not_contain_recycling_bin_for_root_of_drive()
{ {
string root = @"C:\".AsOsAgnostic(); var root = @"C:\".AsOsAgnostic();
SetupFolders(root); SetupFolders(root);
Mocker.GetMock<IDiskProvider>() Mocker.GetMock<IDiskProvider>()
@ -55,7 +55,7 @@ namespace NzbDrone.Common.Test.DiskTests
[Test] [Test]
public void should_not_contain_system_volume_information() public void should_not_contain_system_volume_information()
{ {
string root = @"C:\".AsOsAgnostic(); var root = @"C:\".AsOsAgnostic();
SetupFolders(root); SetupFolders(root);
Mocker.GetMock<IDiskProvider>() Mocker.GetMock<IDiskProvider>()
@ -68,7 +68,7 @@ namespace NzbDrone.Common.Test.DiskTests
[Test] [Test]
public void should_not_contain_recycling_bin_or_system_volume_information_for_root_of_drive() 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); SetupFolders(root);
Mocker.GetMock<IDiskProvider>() Mocker.GetMock<IDiskProvider>()

View File

@ -786,7 +786,7 @@ namespace NzbDrone.Common.Test.Http
try try
{ {
// the date is bad in the below - should be 13-Jul-2026 // 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") var requestSet = new HttpRequestBuilder($"https://{_httpBinHost}/response-headers")
.AddQueryParam("Set-Cookie", malformedCookie) .AddQueryParam("Set-Cookie", malformedCookie)
.Build(); .Build();
@ -820,7 +820,7 @@ namespace NzbDrone.Common.Test.Http
{ {
try 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); var requestSet = new HttpRequest(url);
requestSet.AllowAutoRedirect = false; requestSet.AllowAutoRedirect = false;

View File

@ -74,17 +74,17 @@ namespace NzbDrone.Common
continue; // Ignore directories continue; // Ignore directories
} }
string entryFileName = zipEntry.Name; var entryFileName = zipEntry.Name;
// to remove the folder from the entry:- entryFileName = Path.GetFileName(entryFileName); // to remove the folder from the entry:- entryFileName = Path.GetFileName(entryFileName);
// Optionally match entrynames against a selection list here to skip as desired. // Optionally match entrynames against a selection list here to skip as desired.
// The unpacked length is available in the zipEntry.Size property. // The unpacked length is available in the zipEntry.Size property.
byte[] buffer = new byte[4096]; // 4K is optimum var buffer = new byte[4096]; // 4K is optimum
Stream zipStream = zipFile.GetInputStream(zipEntry); var zipStream = zipFile.GetInputStream(zipEntry);
// Manipulate the output filename here as desired. // Manipulate the output filename here as desired.
string fullZipToPath = Path.Combine(destination, entryFileName); var fullZipToPath = Path.Combine(destination, entryFileName);
string directoryName = Path.GetDirectoryName(fullZipToPath); var directoryName = Path.GetDirectoryName(fullZipToPath);
if (directoryName.Length > 0) if (directoryName.Length > 0)
{ {
Directory.CreateDirectory(directoryName); Directory.CreateDirectory(directoryName);
@ -93,7 +93,7 @@ namespace NzbDrone.Common
// Unzip file in buffered chunks. This is just as fast as unpacking to a buffer the full size // 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. // of the file, but does not waste memory.
// The "using" will close the stream even if an exception occurs. // 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); StreamUtils.Copy(zipStream, streamWriter, buffer);
} }
@ -106,7 +106,7 @@ namespace NzbDrone.Common
Stream inStream = File.OpenRead(compressedFile); Stream inStream = File.OpenRead(compressedFile);
Stream gzipStream = new GZipInputStream(inStream); Stream gzipStream = new GZipInputStream(inStream);
TarArchive tarArchive = TarArchive.CreateInputTarArchive(gzipStream, null); var tarArchive = TarArchive.CreateInputTarArchive(gzipStream, null);
tarArchive.ExtractContents(destination); tarArchive.ExtractContents(destination);
tarArchive.Close(); tarArchive.Close();

View File

@ -1,4 +1,4 @@
namespace NzbDrone.Common namespace NzbDrone.Common
{ {
public static class ConvertBase32 public static class ConvertBase32
{ {
@ -6,17 +6,17 @@
public static byte[] FromBase32String(string str) public static byte[] FromBase32String(string str)
{ {
int numBytes = str.Length * 5 / 8; var numBytes = str.Length * 5 / 8;
byte[] bytes = new byte[numBytes]; var bytes = new byte[numBytes];
// all UPPERCASE chars // all UPPERCASE chars
str = str.ToUpper(); str = str.ToUpper();
int bitBuffer = 0; var bitBuffer = 0;
int bitBufferCount = 0; var bitBufferCount = 0;
int index = 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]); bitBuffer = (bitBuffer << 5) | ValidChars.IndexOf(str[i]);
bitBufferCount += 5; 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; 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)) if (!string.Equals(leftFragments[i], rightFragments[i], stringComparison))
{ {
@ -372,12 +372,12 @@ namespace NzbDrone.Common.Disk
var newFragments = new List<string>(); var newFragments = new List<string>();
for (int j = i; j < rightFragments.Length; j++) for (var j = i; j < rightFragments.Length; j++)
{ {
newFragments.Add(".."); newFragments.Add("..");
} }
for (int j = i; j < leftFragments.Length; j++) for (var j = i; j < leftFragments.Length; j++)
{ {
newFragments.Add(leftFragments[j]); newFragments.Add(leftFragments[j]);
} }

View File

@ -126,9 +126,9 @@ namespace NzbDrone.Common.Extensions
private static IEnumerable<T> InternalDropLast<T>(IEnumerable<T> source, int n) 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); buffer.Enqueue(x);

View File

@ -21,7 +21,7 @@ namespace NzbDrone.Common.Extensions
return text.Length * costDelete; 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++) for (var i = 1; i < matrix.Length; i++)
{ {
@ -30,13 +30,13 @@ namespace NzbDrone.Common.Extensions
for (var i = 0; i < text.Length; i++) for (var i = 0; i < text.Length; i++)
{ {
int topLeft = matrix[0]; var topLeft = matrix[0];
matrix[0] = matrix[0] + costDelete; matrix[0] = matrix[0] + costDelete;
for (var j = 0; j < other.Length; j++) for (var j = 0; j < other.Length; j++)
{ {
int top = matrix[j]; var top = matrix[j];
int left = matrix[j + 1]; var left = matrix[j + 1];
var sumIns = top + costInsert; var sumIns = top + costInsert;
var sumDel = left + costDelete; var sumDel = left + costDelete;

View File

@ -245,13 +245,13 @@ namespace NzbDrone.Common.Extensions
var firstPath = paths.First(); var firstPath = paths.First();
var length = firstPath.Length; var length = firstPath.Length;
for (int i = 1; i < paths.Count; i++) for (var i = 1; i < paths.Count; i++)
{ {
var path = paths[i]; var path = paths[i];
length = Math.Min(length, path.Length); 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]) if (path[characterIndex] != firstPath[characterIndex])
{ {

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Text; using System.Text;
namespace NzbDrone.Common namespace NzbDrone.Common
@ -7,9 +7,9 @@ namespace NzbDrone.Common
{ {
public static string CalculateCrc(string input) public static string CalculateCrc(string input)
{ {
uint mCrc = 0xffffffff; var mCrc = 0xffffffff;
byte[] bytes = Encoding.UTF8.GetBytes(input); var bytes = Encoding.UTF8.GetBytes(input);
foreach (byte myByte in bytes) foreach (var myByte in bytes)
{ {
mCrc ^= (uint)myByte << 24; mCrc ^= (uint)myByte << 24;
for (var i = 0; i < 8; i++) 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) 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()) if (scheme.IsNotNullOrWhiteSpace())
{ {

View File

@ -31,7 +31,7 @@ namespace NzbDrone.Common.Http.Proxy
if (!string.IsNullOrWhiteSpace(BypassFilter)) if (!string.IsNullOrWhiteSpace(BypassFilter))
{ {
var hostlist = BypassFilter.Split(','); var hostlist = BypassFilter.Split(',');
for (int i = 0; i < hostlist.Length; i++) for (var i = 0; i < hostlist.Length; i++)
{ {
if (hostlist[i].StartsWith("*")) if (hostlist[i].StartsWith("*"))
{ {

View File

@ -1,4 +1,4 @@
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using NzbDrone.Common.Serializer; using NzbDrone.Common.Serializer;
namespace NzbDrone.Common.Instrumentation namespace NzbDrone.Common.Instrumentation
@ -16,7 +16,7 @@ namespace NzbDrone.Common.Instrumentation
} }
} }
foreach (JToken token in json) foreach (var token in json)
{ {
Visit(token); Visit(token);
} }

View File

@ -94,7 +94,7 @@ namespace NzbDrone.Common.Instrumentation
private static void RegisterDebugger() private static void RegisterDebugger()
{ {
DebuggerTarget target = new DebuggerTarget(); var target = new DebuggerTarget();
target.Name = "debuggerLogger"; target.Name = "debuggerLogger";
target.Layout = "[${level}] [${threadid}] ${logger}: ${message} ${onexception:inner=${newline}${newline}[v${assembly-version}] ${exception:format=ToString}${newline}${exception:format=Data}${newline}}"; target.Layout = "[${level}] [${threadid}] ${logger}: ${message} ${onexception:inner=${newline}${newline}[v${assembly-version}] ${exception:format=ToString}${newline}${exception:format=Data}${newline}}";

View File

@ -1,4 +1,4 @@
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
namespace NzbDrone.Common.Serializer namespace NzbDrone.Common.Serializer
{ {
@ -60,7 +60,7 @@ namespace NzbDrone.Common.Serializer
public virtual void Visit(JArray json) public virtual void Visit(JArray json)
{ {
foreach (JToken token in json) foreach (var token in json)
{ {
Visit(token); Visit(token);
} }
@ -72,7 +72,7 @@ namespace NzbDrone.Common.Serializer
public virtual void Visit(JObject json) public virtual void Visit(JObject json)
{ {
foreach (JProperty property in json.Properties()) foreach (var property in json.Properties())
{ {
Visit(property); Visit(property);
} }

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Text; using System.Text;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -42,7 +42,7 @@ namespace NzbDrone.Common.Serializer
var enumText = value.ToString(); var enumText = value.ToString();
var builder = new StringBuilder(enumText.Length + 4); var builder = new StringBuilder(enumText.Length + 4);
builder.Append(char.ToLower(enumText[0])); 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])) if (char.IsUpper(enumText[i]))
{ {

View File

@ -18,7 +18,7 @@ namespace NzbDrone.Common.Serializer
{ {
try try
{ {
Version v = new Version(reader.GetString()); var v = new Version(reader.GetString());
return v; return v;
} }
catch (Exception) catch (Exception)

View File

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

View File

@ -110,7 +110,7 @@ namespace NzbDrone.Console
} }
System.Console.WriteLine("Non-recoverable failure, waiting for user intervention..."); 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); System.Threading.Thread.Sleep(1000);
if (!System.Console.IsInputRedirected && System.Console.KeyAvailable) if (!System.Console.IsInputRedirected && System.Console.KeyAvailable)

View File

@ -197,7 +197,7 @@ namespace NzbDrone.Core.Test.Datastore
Subject.SetFields(_basicList, x => x.Interval); 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]; _basicList[i].LastExecution = executionBackup[i];
} }

View File

@ -79,7 +79,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
VerifySingleItem(DownloadItemStatus.Downloading); VerifySingleItem(DownloadItemStatus.Downloading);
// If we keep changing the file every 20ms we should stay 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); TestLogger.Info("Iteration {0}", i);

View File

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

View File

@ -112,7 +112,7 @@ namespace NzbDrone.Core.Test.Extras.Subtitles
results.Count.Should().Be(expectedOutputs.Length); results.Count.Should().Be(expectedOutputs.Length);
for (int i = 0; i < expectedOutputs.Length; i++) for (var i = 0; i < expectedOutputs.Length; i++)
{ {
results[i].RelativePath.AsOsAgnostic().PathEquals(expectedOutputs[i].AsOsAgnostic()).Should().Be(true); results[i].RelativePath.AsOsAgnostic().PathEquals(expectedOutputs[i].AsOsAgnostic()).Should().Be(true);
} }
@ -141,7 +141,7 @@ namespace NzbDrone.Core.Test.Extras.Subtitles
results.Count.Should().Be(expectedOutputs.Length); results.Count.Should().Be(expectedOutputs.Length);
for (int i = 0; i < expectedOutputs.Length; i++) for (var i = 0; i < expectedOutputs.Length; i++)
{ {
results[i].RelativePath.AsOsAgnostic().PathEquals(expectedOutputs[i].AsOsAgnostic()).Should().Be(true); results[i].RelativePath.AsOsAgnostic().PathEquals(expectedOutputs[i].AsOsAgnostic()).Should().Be(true);
} }

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using FluentAssertions; using FluentAssertions;
@ -57,7 +57,7 @@ namespace NzbDrone.Core.Test
[Test] [Test]
public void ToBestDateTime_DayOfWeek() public void ToBestDateTime_DayOfWeek()
{ {
for (int i = 2; i < 7; i++) for (var i = 2; i < 7; i++)
{ {
var dateTime = DateTime.Today.AddDays(i); var dateTime = DateTime.Today.AddDays(i);

View File

@ -79,7 +79,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
[Test] [Test]
public void should_return_ok_if_not_downloading_to_root_folder() public void should_return_ok_if_not_downloading_to_root_folder()
{ {
string rootFolderPath = "c:\\Test2".AsOsAgnostic(); var rootFolderPath = "c:\\Test2".AsOsAgnostic();
GivenRootFolder(rootFolderPath); GivenRootFolder(rootFolderPath);

View File

@ -211,7 +211,7 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
_capabilities.SupportedMovieSearchParameters = new[] { "q" }; _capabilities.SupportedMovieSearchParameters = new[] { "q" };
_capabilities.TextSearchEngine = "raw"; _capabilities.TextSearchEngine = "raw";
MovieSearchCriteria movieRawSearchCriteria = new MovieSearchCriteria var movieRawSearchCriteria = new MovieSearchCriteria
{ {
Movie = new Movies.Movie { Title = "Some Movie & Title: Words", Year = 2021, TmdbId = 123 }, Movie = new Movies.Movie { Title = "Some Movie & Title: Words", Year = 2021, TmdbId = 123 },
SceneTitles = new List<string> { "Some Movie & Title: Words" } SceneTitles = new List<string> { "Some Movie & Title: Words" }
@ -232,7 +232,7 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
_capabilities.SupportedMovieSearchParameters = new[] { "q" }; _capabilities.SupportedMovieSearchParameters = new[] { "q" };
_capabilities.TextSearchEngine = "sphinx"; _capabilities.TextSearchEngine = "sphinx";
MovieSearchCriteria movieRawSearchCriteria = new MovieSearchCriteria var movieRawSearchCriteria = new MovieSearchCriteria
{ {
Movie = new Movies.Movie { Title = "Some Movie & Title: Words", Year = 2021, TmdbId = 123 }, Movie = new Movies.Movie { Title = "Some Movie & Title: Words", Year = 2021, TmdbId = 123 },
SceneTitles = new List<string> { "Some Movie & Title: Words" } SceneTitles = new List<string> { "Some Movie & Title: Words" }

View File

@ -31,7 +31,7 @@ namespace NzbDrone.Core.Test.IndexerTests.PTPTests
{ {
var authResponse = new PassThePopcornAuthResponse { Result = "Ok" }; var authResponse = new PassThePopcornAuthResponse { Result = "Ok" };
System.IO.StringWriter authStream = new System.IO.StringWriter(); var authStream = new System.IO.StringWriter();
Json.Serialize(authResponse, authStream); Json.Serialize(authResponse, authStream);
var responseJson = ReadAllText(fileName); var responseJson = ReadAllText(fileName);

View File

@ -48,7 +48,7 @@ namespace NzbDrone.Core.Test.InstrumentationTests
public void write_long_log() public void write_long_log()
{ {
var message = string.Empty; var message = string.Empty;
for (int i = 0; i < 100; i++) for (var i = 0; i < 100; i++)
{ {
message += Guid.NewGuid(); message += Guid.NewGuid();
} }

View File

@ -41,7 +41,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Specifications
{ {
_localMovie.Path = paths.First().ToString().AsOsAgnostic(); _localMovie.Path = paths.First().ToString().AsOsAgnostic();
string[] filePaths = paths.Cast<string>().Select(x => x.AsOsAgnostic()).ToArray(); var filePaths = paths.Cast<string>().Select(x => x.AsOsAgnostic()).ToArray();
Mocker.GetMock<IDiskProvider>() Mocker.GetMock<IDiskProvider>()
.Setup(s => s.GetFiles(_localMovie.Path.GetParentPath(), SearchOption.TopDirectoryOnly)) .Setup(s => s.GetFiles(_localMovie.Path.GetParentPath(), SearchOption.TopDirectoryOnly))
@ -69,7 +69,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Specifications
{ {
_localMovie.Path = paths.First().ToString().AsOsAgnostic(); _localMovie.Path = paths.First().ToString().AsOsAgnostic();
string[] filePaths = paths.Cast<string>().Select(x => x.AsOsAgnostic()).ToArray(); var filePaths = paths.Cast<string>().Select(x => x.AsOsAgnostic()).ToArray();
Mocker.GetMock<IDiskProvider>() Mocker.GetMock<IDiskProvider>()
.Setup(s => s.GetFiles(_localMovie.Path.GetParentPath(), SearchOption.TopDirectoryOnly)) .Setup(s => s.GetFiles(_localMovie.Path.GetParentPath(), SearchOption.TopDirectoryOnly))
@ -87,7 +87,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Specifications
{ {
_localMovie.Path = paths.First().ToString().AsOsAgnostic(); _localMovie.Path = paths.First().ToString().AsOsAgnostic();
string[] filePaths = paths.Cast<string>().Select(x => x.AsOsAgnostic()).ToArray(); var filePaths = paths.Cast<string>().Select(x => x.AsOsAgnostic()).ToArray();
Mocker.GetMock<IDiskProvider>() Mocker.GetMock<IDiskProvider>()
.Setup(s => s.GetFiles(_localMovie.Path.GetParentPath(), SearchOption.TopDirectoryOnly)) .Setup(s => s.GetFiles(_localMovie.Path.GetParentPath(), SearchOption.TopDirectoryOnly))
@ -105,7 +105,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Specifications
{ {
_localMovie.Path = paths.First().ToString().AsOsAgnostic(); _localMovie.Path = paths.First().ToString().AsOsAgnostic();
string[] filePaths = paths.Cast<string>().Select(x => x.AsOsAgnostic()).ToArray(); var filePaths = paths.Cast<string>().Select(x => x.AsOsAgnostic()).ToArray();
Mocker.GetMock<IDiskProvider>() Mocker.GetMock<IDiskProvider>()
.Setup(s => s.GetFiles(_localMovie.Path.GetParentPath(), SearchOption.TopDirectoryOnly)) .Setup(s => s.GetFiles(_localMovie.Path.GetParentPath(), SearchOption.TopDirectoryOnly))

View File

@ -40,13 +40,13 @@ namespace NzbDrone.Core.Test.ParserTests
[Test] [Test]
public void should_not_parse_md5() public void should_not_parse_md5()
{ {
string hash = "CRAPPY TEST SEED"; var hash = "CRAPPY TEST SEED";
var hashAlgo = System.Security.Cryptography.MD5.Create(); var hashAlgo = System.Security.Cryptography.MD5.Create();
var repetitions = 100; var repetitions = 100;
var success = 0; var success = 0;
for (int i = 0; i < repetitions; i++) for (var i = 0; i < repetitions; i++)
{ {
var hashData = hashAlgo.ComputeHash(Encoding.Default.GetBytes(hash)); var hashData = hashAlgo.ComputeHash(Encoding.Default.GetBytes(hash));
@ -65,17 +65,17 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase(40)] [TestCase(40)]
public void should_not_parse_random(int length) public void should_not_parse_random(int length)
{ {
string charset = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; var charset = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var hashAlgo = new Random(); var hashAlgo = new Random();
var repetitions = 500; var repetitions = 500;
var success = 0; 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]); hash.Append(charset[hashAlgo.Next() % charset.Length]);
} }

View File

@ -4,7 +4,6 @@ using FluentAssertions.Execution;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Languages; using NzbDrone.Core.Languages;
using NzbDrone.Core.Parser; using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.ParserTests namespace NzbDrone.Core.Test.ParserTests
@ -72,7 +71,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("[sam] Toward the Terra (1980) [BD 1080p TrueHD].mkv", "Toward the Terra", "sam", 1980)] [TestCase("[sam] Toward the Terra (1980) [BD 1080p TrueHD].mkv", "Toward the Terra", "sam", 1980)]
public void should_parse_anime_movie_title(string postTitle, string title, string releaseGroup, int year) public void should_parse_anime_movie_title(string postTitle, string title, string releaseGroup, int year)
{ {
ParsedMovieInfo movie = Parser.Parser.ParseMovieTitle(postTitle); var movie = Parser.Parser.ParseMovieTitle(postTitle);
using (new AssertionScope()) using (new AssertionScope())
{ {
movie.PrimaryMovieTitle.Should().Be(title); movie.PrimaryMovieTitle.Should().Be(title);
@ -89,7 +88,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("[Kulot] Violet Evergarden Gaiden Eien to Jidou Shuki Ningyou [Dual-Audio][BDRip 1920x804 HEVC FLACx2] [91FC62A8].mkv", "Violet Evergarden Gaiden Eien to Jidou Shuki Ningyou", "Kulot")] [TestCase("[Kulot] Violet Evergarden Gaiden Eien to Jidou Shuki Ningyou [Dual-Audio][BDRip 1920x804 HEVC FLACx2] [91FC62A8].mkv", "Violet Evergarden Gaiden Eien to Jidou Shuki Ningyou", "Kulot")]
public void should_parse_anime_movie_title_without_year(string postTitle, string title, string releaseGroup) public void should_parse_anime_movie_title_without_year(string postTitle, string title, string releaseGroup)
{ {
ParsedMovieInfo movie = Parser.Parser.ParseMovieTitle(postTitle); var movie = Parser.Parser.ParseMovieTitle(postTitle);
using (new AssertionScope()) using (new AssertionScope())
{ {
movie.PrimaryMovieTitle.Should().Be(title); movie.PrimaryMovieTitle.Should().Be(title);
@ -127,7 +126,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Kick.Ass.2.2013.German.DTS.DL.720p.BluRay.x264-Pate_", "Kick Ass 2", "", 2013, Description = "underscore at the end")] [TestCase("Kick.Ass.2.2013.German.DTS.DL.720p.BluRay.x264-Pate_", "Kick Ass 2", "", 2013, Description = "underscore at the end")]
public void should_parse_german_movie(string postTitle, string title, string edition, int year) public void should_parse_german_movie(string postTitle, string title, string edition, int year)
{ {
ParsedMovieInfo movie = Parser.Parser.ParseMovieTitle(postTitle); var movie = Parser.Parser.ParseMovieTitle(postTitle);
using (new AssertionScope()) using (new AssertionScope())
{ {
movie.PrimaryMovieTitle.Should().Be(title); movie.PrimaryMovieTitle.Should().Be(title);

View File

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using Newtonsoft.Json; using Newtonsoft.Json;
using NUnit.Framework; using NUnit.Framework;
@ -25,9 +25,9 @@ namespace NzbDrone.Core.Test.ParserTests.RomanNumeralTests
[Order(0)] [Order(0)]
public void should_convert_arabic_numeral_to_roman_numeral([Range(1, 20)] int arabicNumeral) public void should_convert_arabic_numeral_to_roman_numeral([Range(1, 20)] int arabicNumeral)
{ {
RomanNumeral romanNumeral = new RomanNumeral(arabicNumeral); var romanNumeral = new RomanNumeral(arabicNumeral);
string expectedValue = _arabicToRomanNumeralsMapping[arabicNumeral]; var expectedValue = _arabicToRomanNumeralsMapping[arabicNumeral];
Assert.AreEqual(romanNumeral.ToRomanNumeral(), expectedValue); Assert.AreEqual(romanNumeral.ToRomanNumeral(), expectedValue);
} }
@ -36,9 +36,9 @@ namespace NzbDrone.Core.Test.ParserTests.RomanNumeralTests
[Order(1)] [Order(1)]
public void should_convert_roman_numeral_to_arabic_numeral([Range(1, 20)] int arabicNumeral) public void should_convert_roman_numeral_to_arabic_numeral([Range(1, 20)] int arabicNumeral)
{ {
RomanNumeral romanNumeral = new RomanNumeral(_arabicToRomanNumeralsMapping[arabicNumeral]); var romanNumeral = new RomanNumeral(_arabicToRomanNumeralsMapping[arabicNumeral]);
int expectecdValue = arabicNumeral; var expectecdValue = arabicNumeral;
Assert.AreEqual(romanNumeral.ToInt(), expectecdValue); Assert.AreEqual(romanNumeral.ToInt(), expectecdValue);
} }

View File

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
@ -67,7 +67,7 @@ namespace NzbDrone.Core.Test.Profiles.Delay
var moving = _last; var moving = _last;
var result = Subject.Reorder(moving.Id, null).OrderBy(d => d.Order).ToList(); 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]; var delayProfile = result[i];

View File

@ -142,7 +142,7 @@ namespace NzbDrone.Core.Configuration
{ {
const string defaultValue = "*"; const string defaultValue = "*";
string bindAddress = GetValue("BindAddress", defaultValue); var bindAddress = GetValue("BindAddress", defaultValue);
if (string.IsNullOrWhiteSpace(bindAddress)) if (string.IsNullOrWhiteSpace(bindAddress))
{ {
return defaultValue; return defaultValue;

View File

@ -203,7 +203,7 @@ namespace NzbDrone.Core.Datastore
using (var conn = _database.OpenConnection()) using (var conn = _database.OpenConnection())
{ {
using (IDbTransaction tran = conn.BeginTransaction(IsolationLevel.ReadCommitted)) using (var tran = conn.BeginTransaction(IsolationLevel.ReadCommitted))
{ {
foreach (var model in models) foreach (var model in models)
{ {

View File

@ -18,7 +18,7 @@ namespace NzbDrone.Core.Datastore.Converters
} }
string contract; string contract;
using (JsonDocument body = JsonDocument.Parse(stringValue)) using (var body = JsonDocument.Parse(stringValue))
{ {
contract = body.RootElement.GetProperty("name").GetString(); contract = body.RootElement.GetProperty("name").GetString();
} }

View File

@ -1,4 +1,4 @@
using System.Data; using System.Data;
using FluentMigrator; using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework; using NzbDrone.Core.Datastore.Migration.Framework;
@ -17,11 +17,11 @@ namespace NzbDrone.Core.Datastore.Migration
private void ConvertConfig(IDbConnection conn, IDbTransaction tran) private void ConvertConfig(IDbConnection conn, IDbTransaction tran)
{ {
using (IDbCommand namingConfigCmd = conn.CreateCommand()) using (var namingConfigCmd = conn.CreateCommand())
{ {
namingConfigCmd.Transaction = tran; namingConfigCmd.Transaction = tran;
namingConfigCmd.CommandText = @"SELECT * FROM ""NamingConfig"" LIMIT 1"; namingConfigCmd.CommandText = @"SELECT * FROM ""NamingConfig"" LIMIT 1";
using (IDataReader namingConfigReader = namingConfigCmd.ExecuteReader()) using (var namingConfigReader = namingConfigCmd.ExecuteReader())
{ {
while (namingConfigReader.Read()) while (namingConfigReader.Read())
{ {
@ -36,7 +36,7 @@ namespace NzbDrone.Core.Datastore.Migration
var movieFolderFormat = string.Format("{0} {1}", movieTitlePattern, movieYearPattern); var movieFolderFormat = string.Format("{0} {1}", movieTitlePattern, movieYearPattern);
using (IDbCommand updateCmd = conn.CreateCommand()) using (var updateCmd = conn.CreateCommand())
{ {
var text = string.Format("UPDATE \"NamingConfig\" " + var text = string.Format("UPDATE \"NamingConfig\" " +
"SET \"StandardMovieFormat\" = '{0}', " + "SET \"StandardMovieFormat\" = '{0}', " +

View File

@ -1,4 +1,4 @@
using System.Data; using System.Data;
using FluentMigrator; using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework; using NzbDrone.Core.Datastore.Migration.Framework;
@ -15,11 +15,11 @@ namespace NzbDrone.Core.Datastore.Migration
private void SetSortTitles(IDbConnection conn, IDbTransaction tran) private void SetSortTitles(IDbConnection conn, IDbTransaction tran)
{ {
using (IDbCommand getSeriesCmd = conn.CreateCommand()) using (var getSeriesCmd = conn.CreateCommand())
{ {
getSeriesCmd.Transaction = tran; getSeriesCmd.Transaction = tran;
getSeriesCmd.CommandText = @"SELECT ""Id"", ""Title"" FROM ""Movies"""; getSeriesCmd.CommandText = @"SELECT ""Id"", ""Title"" FROM ""Movies""";
using (IDataReader seriesReader = getSeriesCmd.ExecuteReader()) using (var seriesReader = getSeriesCmd.ExecuteReader())
{ {
while (seriesReader.Read()) while (seriesReader.Read())
{ {
@ -28,7 +28,7 @@ namespace NzbDrone.Core.Datastore.Migration
var sortTitle = Parser.Parser.NormalizeTitle(title).ToLower(); var sortTitle = Parser.Parser.NormalizeTitle(title).ToLower();
using (IDbCommand updateCmd = conn.CreateCommand()) using (var updateCmd = conn.CreateCommand())
{ {
updateCmd.Transaction = tran; updateCmd.Transaction = tran;
updateCmd.CommandText = "UPDATE \"Movies\" SET \"SortTitle\" = ? WHERE \"Id\" = ?"; updateCmd.CommandText = "UPDATE \"Movies\" SET \"SortTitle\" = ? WHERE \"Id\" = ?";

View File

@ -1,4 +1,4 @@
using System.Data; using System.Data;
using FluentMigrator; using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework; using NzbDrone.Core.Datastore.Migration.Framework;
@ -14,11 +14,11 @@ namespace NzbDrone.Core.Datastore.Migration
private void SetSortTitles(IDbConnection conn, IDbTransaction tran) private void SetSortTitles(IDbConnection conn, IDbTransaction tran)
{ {
using (IDbCommand getSeriesCmd = conn.CreateCommand()) using (var getSeriesCmd = conn.CreateCommand())
{ {
getSeriesCmd.Transaction = tran; getSeriesCmd.Transaction = tran;
getSeriesCmd.CommandText = @"SELECT ""Id"", ""Title"" FROM ""Movies"""; getSeriesCmd.CommandText = @"SELECT ""Id"", ""Title"" FROM ""Movies""";
using (IDataReader seriesReader = getSeriesCmd.ExecuteReader()) using (var seriesReader = getSeriesCmd.ExecuteReader())
{ {
while (seriesReader.Read()) while (seriesReader.Read())
{ {
@ -27,7 +27,7 @@ namespace NzbDrone.Core.Datastore.Migration
var sortTitle = Parser.Parser.NormalizeTitle(title).ToLower(); var sortTitle = Parser.Parser.NormalizeTitle(title).ToLower();
using (IDbCommand updateCmd = conn.CreateCommand()) using (var updateCmd = conn.CreateCommand())
{ {
updateCmd.Transaction = tran; updateCmd.Transaction = tran;
updateCmd.CommandText = "UPDATE \"Movies\" SET \"SortTitle\" = ? WHERE \"Id\" = ?"; updateCmd.CommandText = "UPDATE \"Movies\" SET \"SortTitle\" = ? WHERE \"Id\" = ?";

View File

@ -1,4 +1,4 @@
using System.Data; using System.Data;
using FluentMigrator; using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework; using NzbDrone.Core.Datastore.Migration.Framework;
@ -16,11 +16,11 @@ namespace NzbDrone.Core.Datastore.Migration
private void SetSortTitles(IDbConnection conn, IDbTransaction tran) private void SetSortTitles(IDbConnection conn, IDbTransaction tran)
{ {
using (IDbCommand getSeriesCmd = conn.CreateCommand()) using (var getSeriesCmd = conn.CreateCommand())
{ {
getSeriesCmd.Transaction = tran; getSeriesCmd.Transaction = tran;
getSeriesCmd.CommandText = @"SELECT ""Id"", ""RelativePath"" FROM ""MovieFiles"""; getSeriesCmd.CommandText = @"SELECT ""Id"", ""RelativePath"" FROM ""MovieFiles""";
using (IDataReader seriesReader = getSeriesCmd.ExecuteReader()) using (var seriesReader = getSeriesCmd.ExecuteReader())
{ {
while (seriesReader.Read()) while (seriesReader.Read())
{ {
@ -36,7 +36,7 @@ namespace NzbDrone.Core.Datastore.Migration
edition = result.Edition ?? Parser.Parser.ParseEdition(result.SimpleReleaseTitle); edition = result.Edition ?? Parser.Parser.ParseEdition(result.SimpleReleaseTitle);
} }
using (IDbCommand updateCmd = conn.CreateCommand()) using (var updateCmd = conn.CreateCommand())
{ {
updateCmd.Transaction = tran; updateCmd.Transaction = tran;
updateCmd.CommandText = "UPDATE \"MovieFiles\" SET \"Edition\" = ? WHERE \"Id\" = ?"; updateCmd.CommandText = "UPDATE \"MovieFiles\" SET \"Edition\" = ? WHERE \"Id\" = ?";

View File

@ -1,4 +1,4 @@
using System.Data; using System.Data;
using FluentMigrator; using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework; using NzbDrone.Core.Datastore.Migration.Framework;
@ -14,11 +14,11 @@ namespace NzbDrone.Core.Datastore.Migration
private void SetTitleSlug(IDbConnection conn, IDbTransaction tran) private void SetTitleSlug(IDbConnection conn, IDbTransaction tran)
{ {
using (IDbCommand getSeriesCmd = conn.CreateCommand()) using (var getSeriesCmd = conn.CreateCommand())
{ {
getSeriesCmd.Transaction = tran; getSeriesCmd.Transaction = tran;
getSeriesCmd.CommandText = @"SELECT ""Id"", ""Title"", ""Year"", ""TmdbId"" FROM ""Movies"""; getSeriesCmd.CommandText = @"SELECT ""Id"", ""Title"", ""Year"", ""TmdbId"" FROM ""Movies""";
using (IDataReader seriesReader = getSeriesCmd.ExecuteReader()) using (var seriesReader = getSeriesCmd.ExecuteReader())
{ {
while (seriesReader.Read()) while (seriesReader.Read())
{ {
@ -29,7 +29,7 @@ namespace NzbDrone.Core.Datastore.Migration
var titleSlug = Parser.Parser.ToUrlSlug(title + "-" + tmdbId); var titleSlug = Parser.Parser.ToUrlSlug(title + "-" + tmdbId);
using (IDbCommand updateCmd = conn.CreateCommand()) using (var updateCmd = conn.CreateCommand())
{ {
updateCmd.Transaction = tran; updateCmd.Transaction = tran;
updateCmd.CommandText = "UPDATE \"Movies\" SET \"TitleSlug\" = ? WHERE \"Id\" = ?"; updateCmd.CommandText = "UPDATE \"Movies\" SET \"TitleSlug\" = ? WHERE \"Id\" = ?";

View File

@ -1,4 +1,4 @@
using System.Data; using System.Data;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using FluentMigrator; using FluentMigrator;
@ -16,18 +16,18 @@ namespace NzbDrone.Core.Datastore.Migration
private void SetTitleSlug(IDbConnection conn, IDbTransaction tran) private void SetTitleSlug(IDbConnection conn, IDbTransaction tran)
{ {
using (IDbCommand getSeriesCmd = conn.CreateCommand()) using (var getSeriesCmd = conn.CreateCommand())
{ {
getSeriesCmd.Transaction = tran; getSeriesCmd.Transaction = tran;
getSeriesCmd.CommandText = @"SELECT ""Id"", ""Value"" FROM ""Config"" WHERE ""Key"" = 'filedate'"; getSeriesCmd.CommandText = @"SELECT ""Id"", ""Value"" FROM ""Config"" WHERE ""Key"" = 'filedate'";
using (IDataReader seriesReader = getSeriesCmd.ExecuteReader()) using (var seriesReader = getSeriesCmd.ExecuteReader())
{ {
while (seriesReader.Read()) while (seriesReader.Read())
{ {
var id = seriesReader.GetInt32(0); var id = seriesReader.GetInt32(0);
var value = seriesReader.GetString(1); var value = seriesReader.GetString(1);
using (IDbCommand updateCmd = conn.CreateCommand()) using (var updateCmd = conn.CreateCommand())
{ {
updateCmd.Transaction = tran; updateCmd.Transaction = tran;
updateCmd.CommandText = "UPDATE \"Config\" SET \"Value\" = 'Release' WHERE \"Id\" = ?"; updateCmd.CommandText = "UPDATE \"Config\" SET \"Value\" = 'Release' WHERE \"Id\" = ?";

View File

@ -14,7 +14,7 @@ namespace NzbDrone.Core.Datastore.Migration
private void DeleteUniqueIndex(IDbConnection conn, IDbTransaction tran) private void DeleteUniqueIndex(IDbConnection conn, IDbTransaction tran)
{ {
using (IDbCommand getSeriesCmd = conn.CreateCommand()) using (var getSeriesCmd = conn.CreateCommand())
{ {
getSeriesCmd.Transaction = tran; getSeriesCmd.Transaction = tran;
getSeriesCmd.CommandText = @"DROP INDEX ""IX_Movies_ImdbId"""; getSeriesCmd.CommandText = @"DROP INDEX ""IX_Movies_ImdbId""";

View File

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using FluentMigrator; using FluentMigrator;
@ -193,8 +193,8 @@ namespace NzbDrone.Core.Datastore.Migration
{ {
while (definitionsReader.Read()) while (definitionsReader.Read())
{ {
int id = definitionsReader.GetInt32(0); var id = definitionsReader.GetInt32(0);
int quality = definitionsReader.GetInt32(1); var quality = definitionsReader.GetInt32(1);
definitions.Add(new QualityDefinition125 { Id = id, Quality = quality }); definitions.Add(new QualityDefinition125 { Id = id, Quality = quality });
} }
} }

View File

@ -1,4 +1,4 @@
using System.Data; using System.Data;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -26,12 +26,12 @@ namespace NzbDrone.Core.Datastore.Migration
private void AddExisting(IDbConnection conn, IDbTransaction tran) private void AddExisting(IDbConnection conn, IDbTransaction tran)
{ {
using (IDbCommand getSeriesCmd = conn.CreateCommand()) using (var getSeriesCmd = conn.CreateCommand())
{ {
getSeriesCmd.Transaction = tran; getSeriesCmd.Transaction = tran;
getSeriesCmd.CommandText = @"SELECT ""Key"", ""Value"" FROM ""Config"" WHERE ""Key"" = 'importexclusions'"; getSeriesCmd.CommandText = @"SELECT ""Key"", ""Value"" FROM ""Config"" WHERE ""Key"" = 'importexclusions'";
TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; var textInfo = new CultureInfo("en-US", false).TextInfo;
using (IDataReader seriesReader = getSeriesCmd.ExecuteReader()) using (var seriesReader = getSeriesCmd.ExecuteReader())
{ {
while (seriesReader.Read()) while (seriesReader.Read())
{ {
@ -45,7 +45,7 @@ namespace NzbDrone.Core.Datastore.Migration
textInfo.ToTitleCase(string.Join(" ", x.Split('-').DropLast(1)))); textInfo.ToTitleCase(string.Join(" ", x.Split('-').DropLast(1))));
}).ToList(); }).ToList();
using (IDbCommand updateCmd = conn.CreateCommand()) using (var updateCmd = conn.CreateCommand())
{ {
updateCmd.Transaction = tran; updateCmd.Transaction = tran;
updateCmd.CommandText = "INSERT INTO \"ImportExclusions\" (tmdbid, MovieTitle) VALUES " + string.Join(", ", importExclusions); updateCmd.CommandText = "INSERT INTO \"ImportExclusions\" (tmdbid, MovieTitle) VALUES " + string.Join(", ", importExclusions);

View File

@ -38,12 +38,12 @@ namespace NzbDrone.Core.Datastore.Migration
var languageConverter = new EmbeddedDocumentConverter<List<Language>>(new LanguageIntConverter()); var languageConverter = new EmbeddedDocumentConverter<List<Language>>(new LanguageIntConverter());
var profileLanguages = new Dictionary<int, int>(); var profileLanguages = new Dictionary<int, int>();
using (IDbCommand getProfileCmd = conn.CreateCommand()) using (var getProfileCmd = conn.CreateCommand())
{ {
getProfileCmd.Transaction = tran; getProfileCmd.Transaction = tran;
getProfileCmd.CommandText = "SELECT \"Id\", \"Language\" FROM \"Profiles\""; getProfileCmd.CommandText = "SELECT \"Id\", \"Language\" FROM \"Profiles\"";
IDataReader profilesReader = getProfileCmd.ExecuteReader(); var profilesReader = getProfileCmd.ExecuteReader();
while (profilesReader.Read()) while (profilesReader.Read())
{ {
var profileId = profilesReader.GetInt32(0); var profileId = profilesReader.GetInt32(0);
@ -65,11 +65,11 @@ namespace NzbDrone.Core.Datastore.Migration
var movieLanguages = new Dictionary<int, int>(); var movieLanguages = new Dictionary<int, int>();
using (IDbCommand getSeriesCmd = conn.CreateCommand()) using (var getSeriesCmd = conn.CreateCommand())
{ {
getSeriesCmd.Transaction = tran; getSeriesCmd.Transaction = tran;
getSeriesCmd.CommandText = @"SELECT ""Id"", ""ProfileId"" FROM ""Movies"""; getSeriesCmd.CommandText = @"SELECT ""Id"", ""ProfileId"" FROM ""Movies""";
using (IDataReader moviesReader = getSeriesCmd.ExecuteReader()) using (var moviesReader = getSeriesCmd.ExecuteReader())
{ {
while (moviesReader.Read()) while (moviesReader.Read())
{ {
@ -86,11 +86,11 @@ namespace NzbDrone.Core.Datastore.Migration
var movieFileLanguages = new Dictionary<int, List<Language>>(); var movieFileLanguages = new Dictionary<int, List<Language>>();
var releaseLanguages = new Dictionary<string, List<Language>>(); var releaseLanguages = new Dictionary<string, List<Language>>();
using (IDbCommand getSeriesCmd = conn.CreateCommand()) using (var getSeriesCmd = conn.CreateCommand())
{ {
getSeriesCmd.Transaction = tran; getSeriesCmd.Transaction = tran;
getSeriesCmd.CommandText = @"SELECT ""Id"", ""MovieId"", ""SceneName"", ""MediaInfo"" FROM ""MovieFiles"""; getSeriesCmd.CommandText = @"SELECT ""Id"", ""MovieId"", ""SceneName"", ""MediaInfo"" FROM ""MovieFiles""";
using (IDataReader movieFilesReader = getSeriesCmd.ExecuteReader()) using (var movieFilesReader = getSeriesCmd.ExecuteReader())
{ {
while (movieFilesReader.Read()) while (movieFilesReader.Read())
{ {
@ -136,11 +136,11 @@ namespace NzbDrone.Core.Datastore.Migration
var historyLanguages = new Dictionary<int, List<Language>>(); var historyLanguages = new Dictionary<int, List<Language>>();
using (IDbCommand getSeriesCmd = conn.CreateCommand()) using (var getSeriesCmd = conn.CreateCommand())
{ {
getSeriesCmd.Transaction = tran; getSeriesCmd.Transaction = tran;
getSeriesCmd.CommandText = @"SELECT ""Id"", ""SourceTitle"", ""MovieId"" FROM ""History"""; getSeriesCmd.CommandText = @"SELECT ""Id"", ""SourceTitle"", ""MovieId"" FROM ""History""";
using (IDataReader historyReader = getSeriesCmd.ExecuteReader()) using (var historyReader = getSeriesCmd.ExecuteReader())
{ {
while (historyReader.Read()) while (historyReader.Read())
{ {
@ -173,11 +173,11 @@ namespace NzbDrone.Core.Datastore.Migration
var blacklistLanguages = new Dictionary<int, List<Language>>(); var blacklistLanguages = new Dictionary<int, List<Language>>();
using (IDbCommand getSeriesCmd = conn.CreateCommand()) using (var getSeriesCmd = conn.CreateCommand())
{ {
getSeriesCmd.Transaction = tran; getSeriesCmd.Transaction = tran;
getSeriesCmd.CommandText = @"SELECT ""Id"", ""SourceTitle"", ""MovieId"" FROM ""Blacklist"""; getSeriesCmd.CommandText = @"SELECT ""Id"", ""SourceTitle"", ""MovieId"" FROM ""Blacklist""";
using (IDataReader blacklistReader = getSeriesCmd.ExecuteReader()) using (var blacklistReader = getSeriesCmd.ExecuteReader())
{ {
while (blacklistReader.Read()) while (blacklistReader.Read())
{ {
@ -209,7 +209,7 @@ namespace NzbDrone.Core.Datastore.Migration
var movieFileIds = group.Select(v => v.ToString()).Join(","); var movieFileIds = group.Select(v => v.ToString()).Join(",");
using (IDbCommand updateMovieFilesCmd = conn.CreateCommand()) using (var updateMovieFilesCmd = conn.CreateCommand())
{ {
updateMovieFilesCmd.Transaction = tran; updateMovieFilesCmd.Transaction = tran;
if (conn.GetType().FullName == "Npgsql.NpgsqlConnection") if (conn.GetType().FullName == "Npgsql.NpgsqlConnection")
@ -235,7 +235,7 @@ namespace NzbDrone.Core.Datastore.Migration
var historyIds = group.Select(v => v.ToString()).Join(","); var historyIds = group.Select(v => v.ToString()).Join(",");
using (IDbCommand updateHistoryCmd = conn.CreateCommand()) using (var updateHistoryCmd = conn.CreateCommand())
{ {
updateHistoryCmd.Transaction = tran; updateHistoryCmd.Transaction = tran;
if (conn.GetType().FullName == "Npgsql.NpgsqlConnection") if (conn.GetType().FullName == "Npgsql.NpgsqlConnection")
@ -261,7 +261,7 @@ namespace NzbDrone.Core.Datastore.Migration
var blacklistIds = group.Select(v => v.ToString()).Join(","); var blacklistIds = group.Select(v => v.ToString()).Join(",");
using (IDbCommand updateBlacklistCmd = conn.CreateCommand()) using (var updateBlacklistCmd = conn.CreateCommand())
{ {
updateBlacklistCmd.Transaction = tran; updateBlacklistCmd.Transaction = tran;
if (conn.GetType().FullName == "Npgsql.NpgsqlConnection") if (conn.GetType().FullName == "Npgsql.NpgsqlConnection")

View File

@ -77,7 +77,7 @@ namespace NzbDrone.Core.Datastore.Migration
foreach (var profile in profiles.OrderBy(p => p.Id)) foreach (var profile in profiles.OrderBy(p => p.Id))
{ {
using (IDbCommand insertNewLanguageProfileCmd = conn.CreateCommand()) using (var insertNewLanguageProfileCmd = conn.CreateCommand())
{ {
insertNewLanguageProfileCmd.Transaction = tran; insertNewLanguageProfileCmd.Transaction = tran;

View File

@ -17,7 +17,7 @@ namespace NzbDrone.Core.Datastore.Migration
private void ConvertFileChmodToFolderChmod(IDbConnection conn, IDbTransaction tran) private void ConvertFileChmodToFolderChmod(IDbConnection conn, IDbTransaction tran)
{ {
using (IDbCommand getFileChmodCmd = conn.CreateCommand()) using (var getFileChmodCmd = conn.CreateCommand())
{ {
getFileChmodCmd.Transaction = tran; getFileChmodCmd.Transaction = tran;
getFileChmodCmd.CommandText = @"SELECT ""Value"" FROM ""Config"" WHERE ""Key"" = 'filechmod'"; getFileChmodCmd.CommandText = @"SELECT ""Value"" FROM ""Config"" WHERE ""Key"" = 'filechmod'";
@ -32,7 +32,7 @@ namespace NzbDrone.Core.Datastore.Migration
var folderChmodNum = fileChmodNum | ((fileChmodNum & 0x124) >> 2); var folderChmodNum = fileChmodNum | ((fileChmodNum & 0x124) >> 2);
var folderChmod = Convert.ToString(folderChmodNum, 8).PadLeft(3, '0'); var folderChmod = Convert.ToString(folderChmodNum, 8).PadLeft(3, '0');
using (IDbCommand insertCmd = conn.CreateCommand()) using (var insertCmd = conn.CreateCommand())
{ {
insertCmd.Transaction = tran; insertCmd.Transaction = tran;
insertCmd.CommandText = "INSERT INTO \"Config\" (\"Key\", \"Value\") VALUES ('chmodfolder', ?)"; insertCmd.CommandText = "INSERT INTO \"Config\" (\"Key\", \"Value\") VALUES ('chmodfolder', ?)";
@ -42,7 +42,7 @@ namespace NzbDrone.Core.Datastore.Migration
} }
} }
using (IDbCommand deleteCmd = conn.CreateCommand()) using (var deleteCmd = conn.CreateCommand())
{ {
deleteCmd.Transaction = tran; deleteCmd.Transaction = tran;
deleteCmd.CommandText = "DELETE FROM \"Config\" WHERE \"Key\" = 'filechmod'"; 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 tokens = mediaInfoLanguages.Split('/', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries).ToList();
var cultures = CultureInfo.GetCultures(CultureTypes.NeutralCultures); 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") if (tokens[i] == "Swedis")
{ {

View File

@ -45,10 +45,10 @@ namespace NzbDrone.Core.Datastore.Migration
return; return;
} }
foreach (NotificationEntity201 notification in discordSlackNotifications) foreach (var notification in discordSlackNotifications)
{ {
SlackNotificationSettings201 settings = JsonSerializer.Deserialize<SlackNotificationSettings201>(notification.Settings, _serializerSettings); var settings = JsonSerializer.Deserialize<SlackNotificationSettings201>(notification.Settings, _serializerSettings);
DiscordNotificationSettings201 discordSettings = new DiscordNotificationSettings201 var discordSettings = new DiscordNotificationSettings201
{ {
Avatar = settings.Icon, Avatar = settings.Icon,
GrabFields = new List<int> { 0, 1, 2, 3, 5, 6, 7, 8, 9 }, GrabFields = new List<int> { 0, 1, 2, 3, 5, 6, 7, 8, 9 },

View File

@ -60,7 +60,7 @@ namespace NzbDrone.Core.Datastore.Migration
{ {
while (definitionsReader.Read()) while (definitionsReader.Read())
{ {
string path = definitionsReader.GetString(0); var path = definitionsReader.GetString(0);
rootPaths.Add(path); rootPaths.Add(path);
} }
} }

View File

@ -201,7 +201,7 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
public virtual IList<TableDefinition> ReadDbSchema() public virtual IList<TableDefinition> ReadDbSchema()
{ {
IList<TableDefinition> tables = ReadTables(); var tables = ReadTables();
foreach (var table in tables) foreach (var table in tables)
{ {
table.Indexes = ReadIndexes(table.SchemaName, table.Name); 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) 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); 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>(); IList<IndexDefinition> indexes = new List<IndexDefinition>();

View File

@ -203,7 +203,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge
private JsonRpcRequestBuilder BuildRequest(DelugeSettings settings) 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); var requestBuilder = new JsonRpcRequestBuilder(url);
requestBuilder.LogResponseContent = true; requestBuilder.LogResponseContent = true;

View File

@ -39,7 +39,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation.Proxies
else else
{ {
_logger.Trace("No directory configured in settings; falling back to client default destination folder."); _logger.Trace("No directory configured in settings; falling back to client default destination folder.");
string defaultDestination = _defaultDestinationProxy.GetDefaultDestination(settings); var defaultDestination = _defaultDestinationProxy.GetDefaultDestination(settings);
if (defaultDestination.IsNotNullOrWhiteSpace()) if (defaultDestination.IsNotNullOrWhiteSpace())
{ {
@ -72,7 +72,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation.Proxies
else else
{ {
_logger.Trace("No directory configured in settings; falling back to client default destination folder."); _logger.Trace("No directory configured in settings; falling back to client default destination folder.");
string defaultDestination = _defaultDestinationProxy.GetDefaultDestination(settings); var defaultDestination = _defaultDestinationProxy.GetDefaultDestination(settings);
if (defaultDestination.IsNotNullOrWhiteSpace()) if (defaultDestination.IsNotNullOrWhiteSpace())
{ {

View File

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

View File

@ -1,4 +1,4 @@
namespace NzbDrone.Core.Download.Clients.FreeboxDownload namespace NzbDrone.Core.Download.Clients.FreeboxDownload
{ {
public static class EncodingForBase64 public static class EncodingForBase64
{ {
@ -9,7 +9,7 @@
return null; return null;
} }
byte[] textAsBytes = System.Text.Encoding.UTF8.GetBytes(text); var textAsBytes = System.Text.Encoding.UTF8.GetBytes(text);
return System.Convert.ToBase64String(textAsBytes); return System.Convert.ToBase64String(textAsBytes);
} }
@ -20,7 +20,7 @@
return null; return null;
} }
byte[] textAsBytes = System.Convert.FromBase64String(encodedText); var textAsBytes = System.Convert.FromBase64String(encodedText);
return System.Text.Encoding.UTF8.GetString(textAsBytes); return System.Text.Encoding.UTF8.GetString(textAsBytes);
} }
} }

View File

@ -226,7 +226,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
protected IEnumerable<NzbgetCategory> GetCategories(Dictionary<string, string> config) 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"); var name = config.GetValueOrDefault("Category" + i + ".Name");

View File

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

View File

@ -14,7 +14,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd.JsonConverters
var stringArray = (string[])value; var stringArray = (string[])value;
writer.WriteStartArray(); writer.WriteStartArray();
for (int i = 0; i < stringArray.Length; i++) for (var i = 0; i < stringArray.Length; i++)
{ {
writer.WriteValue(stringArray[i]); writer.WriteValue(stringArray[i]);
} }

View File

@ -119,7 +119,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
_logger.Debug("Retrieved metadata of {0} torrents in client", torrents.Count); _logger.Debug("Retrieved metadata of {0} torrents in client", torrents.Count);
var items = new List<DownloadClientItem>(); var items = new List<DownloadClientItem>();
foreach (RTorrentTorrent torrent in torrents) foreach (var torrent in torrents)
{ {
// Don't concern ourselves with categories other than specified // Don't concern ourselves with categories other than specified
if (Settings.MovieCategory.IsNotNullOrWhiteSpace() && torrent.Category != Settings.MovieCategory) if (Settings.MovieCategory.IsNotNullOrWhiteSpace() && torrent.Category != Settings.MovieCategory)

View File

@ -217,7 +217,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
{ {
var config = _proxy.GetConfig(Settings); var config = _proxy.GetConfig(Settings);
OsPath destDir = new OsPath(null); var destDir = new OsPath(null);
if (config.GetValueOrDefault("dir_active_download_flag") == "true") 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) public static long ElementAsLong(this XElement element, XName name)
{ {
var el = element.Element(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) public static int ElementAsInt(this XElement element, XName name)
{ {
var el = element.Element(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) public static int GetIntResponse(this XDocument document)

View File

@ -83,7 +83,7 @@ namespace NzbDrone.Core.Extras
continue; continue;
} }
for (int i = 0; i < _extraFileManagers.Count; i++) for (var i = 0; i < _extraFileManagers.Count; i++)
{ {
if (_extraFileManagers[i].CanImportFile(localMovie, movieFile, file, extension, isReadOnly)) if (_extraFileManagers[i].CanImportFile(localMovie, movieFile, file, extension, isReadOnly))
{ {
@ -93,7 +93,7 @@ namespace NzbDrone.Core.Extras
} }
} }
for (int i = 0; i < _extraFileManagers.Count; i++) for (var i = 0; i < _extraFileManagers.Count; i++)
{ {
_extraFileManagers[i].ImportFiles(localMovie, movieFile, managedFiles[i], isReadOnly); _extraFileManagers[i].ImportFiles(localMovie, movieFile, managedFiles[i], isReadOnly);
} }

View File

@ -133,7 +133,7 @@ namespace NzbDrone.Core.Extras.Others
} }
} }
foreach (string file in matchingFiles) foreach (var file in matchingFiles)
{ {
try try
{ {

View File

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

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -95,17 +95,17 @@ namespace NzbDrone.Core
} }
var cs = s.ToCharArray(); var cs = s.ToCharArray();
int length = 0; var length = 0;
int i = 0; var i = 0;
while (i < cs.Length) while (i < cs.Length)
{ {
int charSize = 1; var charSize = 1;
if (i < (cs.Length - 1) && char.IsSurrogate(cs[i])) if (i < (cs.Length - 1) && char.IsSurrogate(cs[i]))
{ {
charSize = 2; charSize = 2;
} }
int byteSize = Encoding.UTF8.GetByteCount(cs, i, charSize); var byteSize = Encoding.UTF8.GetByteCount(cs, i, charSize);
if ((byteSize + length) <= maxLength) if ((byteSize + length) <= maxLength)
{ {
i = i + charSize; i = i + charSize;

View File

@ -22,7 +22,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
} }
var message = _deploymentInfoProvider.PackageGlobalMessage; var message = _deploymentInfoProvider.PackageGlobalMessage;
HealthCheckResult result = HealthCheckResult.Notice; var result = HealthCheckResult.Notice;
if (message.StartsWith("Error:")) if (message.StartsWith("Error:"))
{ {

View File

@ -35,7 +35,7 @@ namespace NzbDrone.Core.ImportLists.CouchPotato
foreach (var item in responseData) foreach (var item in responseData)
{ {
int tmdbid = item.info?.tmdb_id ?? 0; var tmdbid = item.info?.tmdb_id ?? 0;
// Fix weird error reported by Madmanali93 // Fix weird error reported by Madmanali93
if (item.type != null && item.releases != null) if (item.type != null && item.releases != null)
@ -54,7 +54,7 @@ namespace NzbDrone.Core.ImportLists.CouchPotato
{ {
// snatched,missing,available,downloaded // snatched,missing,available,downloaded
// done,seeding // done,seeding
bool isCompleted = item.releases.Any(rel => (rel.status == "done" || rel.status == "seeding")); var isCompleted = item.releases.Any(rel => (rel.status == "done" || rel.status == "seeding"));
if (!isCompleted) if (!isCompleted)
{ {
movies.AddIfNotNull(new ImportListMovie() movies.AddIfNotNull(new ImportListMovie()

View File

@ -68,7 +68,7 @@ namespace NzbDrone.Core.ImportLists
var importListLocal = importList; var importListLocal = importList;
var blockedLists = _importListStatusService.GetBlockedProviders().ToDictionary(v => v.ProviderId, v => v); var blockedLists = _importListStatusService.GetBlockedProviders().ToDictionary(v => v.ProviderId, v => v);
if (blockedLists.TryGetValue(importList.Definition.Id, out ImportListStatus blockedListStatus)) if (blockedLists.TryGetValue(importList.Definition.Id, out var blockedListStatus))
{ {
_logger.Debug("Temporarily ignoring list {0} till {1} due to recent failures.", importList.Definition.Name, blockedListStatus.DisabledTill.Value.ToLocalTime()); _logger.Debug("Temporarily ignoring list {0} till {1} due to recent failures.", importList.Definition.Name, blockedListStatus.DisabledTill.Value.ToLocalTime());
result.AnyFailure |= true; // Ensure we don't clean if a list is down result.AnyFailure |= true; // Ensure we don't clean if a list is down

View File

@ -54,7 +54,7 @@ namespace NzbDrone.Core.ImportLists
try try
{ {
for (int i = 0; i < pageableRequestChain.Tiers; i++) for (var i = 0; i < pageableRequestChain.Tiers; i++)
{ {
var pageableRequests = pageableRequestChain.GetTier(i); var pageableRequests = pageableRequestChain.GetTier(i);
foreach (var pageableRequest in pageableRequests) foreach (var pageableRequest in pageableRequests)

View File

@ -36,7 +36,7 @@ namespace NzbDrone.Core.ImportLists.Plex
var tmdbIdString = FindGuid(item.Guids, "tmdb"); var tmdbIdString = FindGuid(item.Guids, "tmdb");
var imdbId = FindGuid(item.Guids, "imdb"); var imdbId = FindGuid(item.Guids, "imdb");
int.TryParse(tmdbIdString, out int tmdbId); int.TryParse(tmdbIdString, out var tmdbId);
movies.AddIfNotNull(new ImportListMovie() movies.AddIfNotNull(new ImportListMovie()
{ {

View File

@ -68,7 +68,7 @@ namespace NzbDrone.Core.IndexerSearch
}; };
pagingSpec.FilterExpressions.Add(v => v.Monitored == true); pagingSpec.FilterExpressions.Add(v => v.Monitored == true);
List<Movie> movies = _movieService.MoviesWithoutFiles(pagingSpec).Records.ToList(); var movies = _movieService.MoviesWithoutFiles(pagingSpec).Records.ToList();
var queue = _queueService.GetQueue().Where(q => q.Movie != null).Select(q => q.Movie.Id); var queue = _queueService.GetQueue().Where(q => q.Movie != null).Select(q => q.Movie.Id);
var missing = movies.Where(e => !queue.Contains(e.Id)).ToList(); var missing = movies.Where(e => !queue.Contains(e.Id)).ToList();
@ -88,7 +88,7 @@ namespace NzbDrone.Core.IndexerSearch
pagingSpec.FilterExpressions.Add(v => v.Monitored == true); pagingSpec.FilterExpressions.Add(v => v.Monitored == true);
List<Movie> movies = _movieCutoffService.MoviesWhereCutoffUnmet(pagingSpec).Records.ToList(); var movies = _movieCutoffService.MoviesWhereCutoffUnmet(pagingSpec).Records.ToList();
var queue = _queueService.GetQueue().Where(q => q.Movie != null).Select(q => q.Movie.Id); var queue = _queueService.GetQueue().Where(q => q.Movie != null).Select(q => q.Movie.Id);
var missing = movies.Where(e => !queue.Contains(e.Id)).ToList(); var missing = movies.Where(e => !queue.Contains(e.Id)).ToList();

View File

@ -113,7 +113,7 @@ namespace NzbDrone.Core.Indexers
lastReleaseInfo = _indexerStatusService.GetLastRssSyncReleaseInfo(Definition.Id); 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); var pageableRequests = pageableRequestChain.GetTier(i);

View File

@ -184,7 +184,7 @@ namespace NzbDrone.Core.Languages
return Unknown; return Unknown;
} }
Language language = All.FirstOrDefault(v => v.Id == id); var language = All.FirstOrDefault(v => v.Id == id);
if (language == null) if (language == null)
{ {

View File

@ -147,7 +147,7 @@ namespace NzbDrone.Core.MediaCover
private bool EnsureCovers(Movie movie) private bool EnsureCovers(Movie movie)
{ {
bool updated = false; var updated = false;
var toResize = new List<Tuple<MediaCover, bool>>(); var toResize = new List<Tuple<MediaCover, bool>>();
foreach (var cover in movie.MovieMetadata.Value.Images) foreach (var cover in movie.MovieMetadata.Value.Images)

View File

@ -329,7 +329,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Manual
var imported = new List<ImportResult>(); var imported = new List<ImportResult>();
var importedTrackedDownload = new List<ManuallyImportedFile>(); 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); _logger.ProgressTrace("Processing file {0} of {1}", i + 1, message.Files.Count);

View File

@ -33,7 +33,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Specifications
foreach (var workingFolder in _configService.DownloadClientWorkingFolders.Split('|')) foreach (var workingFolder in _configService.DownloadClientWorkingFolders.Split('|'))
{ {
DirectoryInfo parent = Directory.GetParent(localMovie.Path); var parent = Directory.GetParent(localMovie.Path);
while (parent != null) while (parent != null)
{ {
if (parent.Name.StartsWith(workingFolder)) if (parent.Name.StartsWith(workingFolder))

View File

@ -125,8 +125,8 @@ namespace NzbDrone.Core.Messaging.Commands
_cancellationTokenSource = new CancellationTokenSource(); _cancellationTokenSource = new CancellationTokenSource();
var envLimit = Environment.GetEnvironmentVariable("THREAD_LIMIT") ?? $"{THREAD_LIMIT}"; var envLimit = Environment.GetEnvironmentVariable("THREAD_LIMIT") ?? $"{THREAD_LIMIT}";
int threadLimit = THREAD_LIMIT; var threadLimit = THREAD_LIMIT;
if (int.TryParse(envLimit, out int parsedLimit)) if (int.TryParse(envLimit, out var parsedLimit))
{ {
threadLimit = parsedLimit; threadLimit = parsedLimit;
} }
@ -136,7 +136,7 @@ namespace NzbDrone.Core.Messaging.Commands
_logger.Info("Starting {} threads for tasks.", threadLimit); _logger.Info("Starting {} threads for tasks.", threadLimit);
for (int i = 0; i < threadLimit + 1; i++) for (var i = 0; i < threadLimit + 1; i++)
{ {
var thread = new Thread(ExecuteCommands); var thread = new Thread(ExecuteCommands);
thread.Start(); 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) 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.LastExecutionTime = lastExecutionTime;
command.LastStartTime = lastStartTime; command.LastStartTime = lastStartTime;
command.Trigger = trigger; command.Trigger = trigger;

View File

@ -35,7 +35,7 @@ namespace NzbDrone.Core.MetadataSource
public int Compare(Movie x, Movie y) public int Compare(Movie x, Movie y)
{ {
int result = 0; var result = 0;
// Prefer exact matches // Prefer exact matches
result = Compare(x, y, s => CleanPunctuation(s.Title).Equals(CleanPunctuation(SearchQuery))); result = Compare(x, y, s => CleanPunctuation(s.Title).Equals(CleanPunctuation(SearchQuery)));

View File

@ -427,7 +427,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
{ {
var slug = lowerTitle.Split(':')[1].Trim(); var slug = lowerTitle.Split(':')[1].Trim();
string imdbid = slug; var imdbid = slug;
if (slug.IsNullOrWhiteSpace() || slug.Any(char.IsWhiteSpace)) if (slug.IsNullOrWhiteSpace() || slug.Any(char.IsWhiteSpace))
{ {
@ -449,7 +449,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
{ {
var slug = lowerTitle.Split(':')[1].Trim(); var slug = lowerTitle.Split(':')[1].Trim();
int tmdbid = -1; var tmdbid = -1;
if (slug.IsNullOrWhiteSpace() || slug.Any(char.IsWhiteSpace) || !int.TryParse(slug, out tmdbid)) if (slug.IsNullOrWhiteSpace() || slug.Any(char.IsWhiteSpace) || !int.TryParse(slug, out tmdbid))
{ {

View File

@ -70,7 +70,7 @@ namespace NzbDrone.Core.Movies.AlternativeTitles
public List<AlternativeTitle> UpdateTitles(List<AlternativeTitle> titles, MovieMetadata movieMetadata) public List<AlternativeTitle> UpdateTitles(List<AlternativeTitle> titles, MovieMetadata movieMetadata)
{ {
int movieMetadataId = movieMetadata.Id; var movieMetadataId = movieMetadata.Id;
// First update the movie ids so we can correlate them later. // First update the movie ids so we can correlate them later.
titles.ForEach(t => t.MovieMetadataId = movieMetadataId); titles.ForEach(t => t.MovieMetadataId = movieMetadataId);

View File

@ -59,7 +59,7 @@ namespace NzbDrone.Core.Movies.Credits
public List<Credit> UpdateCredits(List<Credit> credits, MovieMetadata movieMetadata) public List<Credit> UpdateCredits(List<Credit> credits, MovieMetadata movieMetadata)
{ {
int movieMetadataId = movieMetadata.Id; var movieMetadataId = movieMetadata.Id;
// First update the movie ids so we can correlate them later. // First update the movie ids so we can correlate them later.
credits.ForEach(t => t.MovieMetadataId = movieMetadataId); credits.ForEach(t => t.MovieMetadataId = movieMetadataId);

View File

@ -88,7 +88,7 @@ namespace NzbDrone.Core.Movies
var existingMetadata = FindById(data.Select(x => x.TmdbId).ToList()); var existingMetadata = FindById(data.Select(x => x.TmdbId).ToList());
var updateMetadataList = new List<MovieMetadata>(); var updateMetadataList = new List<MovieMetadata>();
var addMetadataList = new List<MovieMetadata>(); var addMetadataList = new List<MovieMetadata>();
int upToDateMetadataCount = 0; var upToDateMetadataCount = 0;
foreach (var meta in data) foreach (var meta in data)
{ {

View File

@ -43,7 +43,7 @@ namespace NzbDrone.Core.Movies.Translations
public List<MovieTranslation> UpdateTranslations(List<MovieTranslation> translations, MovieMetadata movieMetadata) public List<MovieTranslation> UpdateTranslations(List<MovieTranslation> translations, MovieMetadata movieMetadata)
{ {
int movieMetadataId = movieMetadata.Id; var movieMetadataId = movieMetadata.Id;
// First update the movie ids so we can correlate them later // First update the movie ids so we can correlate them later
translations.ForEach(t => t.MovieMetadataId = movieMetadataId); translations.ForEach(t => t.MovieMetadataId = movieMetadataId);

View File

@ -247,7 +247,7 @@ namespace NzbDrone.Core.Notifications.Discord
{ {
var attachments = new List<Embed>(); var attachments = new List<Embed>();
foreach (RenamedMovieFile renamedFile in renamedFiles) foreach (var renamedFile in renamedFiles)
{ {
attachments.Add(new Embed attachments.Add(new Embed
{ {

View File

@ -300,7 +300,7 @@ namespace NzbDrone.Core.Notifications
public void Handle(MoviesDeletedEvent message) public void Handle(MoviesDeletedEvent message)
{ {
foreach (Movie movie in message.Movies) foreach (var movie in message.Movies)
{ {
var deleteMessage = new MovieDeleteMessage(movie, message.DeleteFiles); var deleteMessage = new MovieDeleteMessage(movie, message.DeleteFiles);

View File

@ -60,7 +60,7 @@ namespace NzbDrone.Core.Notifications.Slack
{ {
var attachments = new List<Attachment>(); var attachments = new List<Attachment>();
foreach (RenamedMovieFile renamedFile in renamedFiles) foreach (var renamedFile in renamedFiles)
{ {
attachments.Add(new Attachment attachments.Add(new Attachment
{ {

View File

@ -224,11 +224,11 @@ namespace NzbDrone.Core.Organizer
{ {
var colonReplacementFormat = colonReplacement.GetFormatString(); var colonReplacementFormat = colonReplacement.GetFormatString();
string result = name; var result = name;
string[] badCharacters = { "\\", "/", "<", ">", "?", "*", ":", "|", "\"" }; string[] badCharacters = { "\\", "/", "<", ">", "?", "*", ":", "|", "\"" };
string[] goodCharacters = { "+", "+", "", "", "!", "-", colonReplacementFormat, "", "" }; string[] goodCharacters = { "+", "+", "", "", "!", "-", colonReplacementFormat, "", "" };
for (int i = 0; i < badCharacters.Length; i++) for (var i = 0; i < badCharacters.Length; i++)
{ {
result = result.Replace(badCharacters[i], replace ? goodCharacters[i] : string.Empty); result = result.Replace(badCharacters[i], replace ? goodCharacters[i] : string.Empty);
} }
@ -414,7 +414,7 @@ namespace NzbDrone.Core.Organizer
} }
} }
for (int i = 0; i < tokens.Count; i++) for (var i = 0; i < tokens.Count; i++)
{ {
try try
{ {

View File

@ -393,7 +393,7 @@ namespace NzbDrone.Core.Parser
return isoLanguage?.Language ?? Language.Unknown; return isoLanguage?.Language ?? Language.Unknown;
} }
foreach (Language language in Language.All) foreach (var language in Language.All)
{ {
if (simpleFilename.EndsWith(language.ToString(), StringComparison.OrdinalIgnoreCase)) if (simpleFilename.EndsWith(language.ToString(), StringComparison.OrdinalIgnoreCase))
{ {

View File

@ -437,7 +437,7 @@ namespace NzbDrone.Core.Parser
value = Regex.Replace(value, @"\s", "-", RegexOptions.Compiled); value = Regex.Replace(value, @"\s", "-", RegexOptions.Compiled);
// Should invalid characters be replaced with dash or empty string? // Should invalid characters be replaced with dash or empty string?
string replaceCharacter = invalidDashReplacement ? "-" : string.Empty; var replaceCharacter = invalidDashReplacement ? "-" : string.Empty;
// Remove invalid chars // Remove invalid chars
value = Regex.Replace(value, @"[^a-z0-9\s-_]", replaceCharacter, RegexOptions.Compiled); value = Regex.Replace(value, @"[^a-z0-9\s-_]", replaceCharacter, RegexOptions.Compiled);
@ -593,9 +593,9 @@ namespace NzbDrone.Core.Parser
var parts = movieName.Split('.'); var parts = movieName.Split('.');
movieName = ""; movieName = "";
int n = 0; var n = 0;
bool previousAcronym = false; var previousAcronym = false;
string nextPart = ""; var nextPart = "";
foreach (var part in parts) foreach (var part in parts)
{ {
if (parts.Length >= n + 2) if (parts.Length >= n + 2)

View File

@ -95,9 +95,9 @@ namespace NzbDrone.Core.Parser.RomanNumerals
} }
text = text.ToUpper(); text = text.ToUpper();
int len = 0; var len = 0;
for (int i = 0; i < 3; i++) for (var i = 0; i < 3; i++)
{ {
if (text.StartsWith(Thousands[i])) if (text.StartsWith(Thousands[i]))
{ {
@ -113,7 +113,7 @@ namespace NzbDrone.Core.Parser.RomanNumerals
len = 0; len = 0;
} }
for (int i = 0; i < 9; i++) for (var i = 0; i < 9; i++)
{ {
if (text.StartsWith(Hundreds[i])) if (text.StartsWith(Hundreds[i]))
{ {
@ -129,7 +129,7 @@ namespace NzbDrone.Core.Parser.RomanNumerals
len = 0; len = 0;
} }
for (int i = 0; i < 9; i++) for (var i = 0; i < 9; i++)
{ {
if (text.StartsWith(Tens[i])) if (text.StartsWith(Tens[i]))
{ {
@ -145,7 +145,7 @@ namespace NzbDrone.Core.Parser.RomanNumerals
len = 0; len = 0;
} }
for (int i = 0; i < 9; i++) for (var i = 0; i < 9; i++)
{ {
if (text.StartsWith(Units[i])) if (text.StartsWith(Units[i]))
{ {

View File

@ -26,32 +26,32 @@ namespace NzbDrone.Core.Parser.RomanNumerals
_arabicRomanNumeralsMapping = new HashSet<ArabicRomanNumeral>(); _arabicRomanNumeralsMapping = new HashSet<ArabicRomanNumeral>();
_simpleArabicNumeralMappings = new Dictionary<SimpleArabicNumeral, SimpleRomanNumeral>(); _simpleArabicNumeralMappings = new Dictionary<SimpleArabicNumeral, SimpleRomanNumeral>();
foreach (int arabicNumeral in Enumerable.Range(1, DICTIONARY_PREPOPULATION_SIZE + 1)) foreach (var arabicNumeral in Enumerable.Range(1, DICTIONARY_PREPOPULATION_SIZE + 1))
{ {
GenerateRomanNumerals(arabicNumeral, out var romanNumeralAsString, out var arabicNumeralAsString); GenerateRomanNumerals(arabicNumeral, out var romanNumeralAsString, out var arabicNumeralAsString);
ArabicRomanNumeral arm = new ArabicRomanNumeral(arabicNumeral, arabicNumeralAsString, romanNumeralAsString); var arm = new ArabicRomanNumeral(arabicNumeral, arabicNumeralAsString, romanNumeralAsString);
_arabicRomanNumeralsMapping.Add(arm); _arabicRomanNumeralsMapping.Add(arm);
SimpleArabicNumeral sam = new SimpleArabicNumeral(arabicNumeral); var sam = new SimpleArabicNumeral(arabicNumeral);
SimpleRomanNumeral srm = new SimpleRomanNumeral(romanNumeralAsString); var srm = new SimpleRomanNumeral(romanNumeralAsString);
_simpleArabicNumeralMappings.Add(sam, srm); _simpleArabicNumeralMappings.Add(sam, srm);
} }
} }
private static void GenerateRomanNumerals(int arabicNumeral, out string romanNumeral, out string arabicNumeralAsString) private static void GenerateRomanNumerals(int arabicNumeral, out string romanNumeral, out string arabicNumeralAsString)
{ {
RomanNumeral romanNumeralObject = new RomanNumeral(arabicNumeral); var romanNumeralObject = new RomanNumeral(arabicNumeral);
romanNumeral = romanNumeralObject.ToRomanNumeral(); romanNumeral = romanNumeralObject.ToRomanNumeral();
arabicNumeralAsString = Convert.ToString(arabicNumeral); arabicNumeralAsString = Convert.ToString(arabicNumeral);
} }
private static HashSet<ArabicRomanNumeral> GenerateAdditionalMappings(int offset, int length) private static HashSet<ArabicRomanNumeral> GenerateAdditionalMappings(int offset, int length)
{ {
HashSet<ArabicRomanNumeral> additionalArabicRomanNumerals = new HashSet<ArabicRomanNumeral>(); var additionalArabicRomanNumerals = new HashSet<ArabicRomanNumeral>();
foreach (int arabicNumeral in Enumerable.Range(offset, length)) foreach (var arabicNumeral in Enumerable.Range(offset, length))
{ {
GenerateRomanNumerals(arabicNumeral, out var romanNumeral, out var arabicNumeralAsString); GenerateRomanNumerals(arabicNumeral, out var romanNumeral, out var arabicNumeralAsString);
ArabicRomanNumeral arm = new ArabicRomanNumeral(arabicNumeral, arabicNumeralAsString, romanNumeral); var arm = new ArabicRomanNumeral(arabicNumeral, arabicNumeralAsString, romanNumeral);
additionalArabicRomanNumerals.Add(arm); additionalArabicRomanNumerals.Add(arm);
} }
@ -78,7 +78,7 @@ namespace NzbDrone.Core.Parser.RomanNumerals
return new HashSet<ArabicRomanNumeral>(_arabicRomanNumeralsMapping.Take(upToArabicNumber)); return new HashSet<ArabicRomanNumeral>(_arabicRomanNumeralsMapping.Take(upToArabicNumber));
} }
HashSet<ArabicRomanNumeral> largerMapping = GenerateAdditionalMappings(DICTIONARY_PREPOPULATION_SIZE + 1, upToArabicNumber); var largerMapping = GenerateAdditionalMappings(DICTIONARY_PREPOPULATION_SIZE + 1, upToArabicNumber);
_arabicRomanNumeralsMapping = (HashSet<ArabicRomanNumeral>)_arabicRomanNumeralsMapping.Union(largerMapping); _arabicRomanNumeralsMapping = (HashSet<ArabicRomanNumeral>)_arabicRomanNumeralsMapping.Union(largerMapping);
} }
@ -123,12 +123,12 @@ namespace NzbDrone.Core.Parser.RomanNumerals
private static Dictionary<SimpleArabicNumeral, SimpleRomanNumeral> GenerateAdditionalSimpleNumerals(int offset, private static Dictionary<SimpleArabicNumeral, SimpleRomanNumeral> GenerateAdditionalSimpleNumerals(int offset,
int length) int length)
{ {
Dictionary<SimpleArabicNumeral, SimpleRomanNumeral> moreNumerals = new Dictionary<SimpleArabicNumeral, SimpleRomanNumeral>(); var moreNumerals = new Dictionary<SimpleArabicNumeral, SimpleRomanNumeral>();
foreach (int arabicNumeral in Enumerable.Range(offset, length)) foreach (var arabicNumeral in Enumerable.Range(offset, length))
{ {
GenerateRomanNumerals(arabicNumeral, out var romanNumeral, out _); GenerateRomanNumerals(arabicNumeral, out var romanNumeral, out _);
SimpleArabicNumeral san = new SimpleArabicNumeral(arabicNumeral); var san = new SimpleArabicNumeral(arabicNumeral);
SimpleRomanNumeral srn = new SimpleRomanNumeral(romanNumeral); var srn = new SimpleRomanNumeral(romanNumeral);
moreNumerals.Add(san, srn); moreNumerals.Add(san, srn);
} }

View File

@ -53,7 +53,7 @@ namespace NzbDrone.Core.Profiles.Delay
var all = All().OrderBy(d => d.Order).ToList(); 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) if (all[i].Id == 1)
{ {

View File

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

View File

@ -43,7 +43,7 @@ namespace NzbDrone.Core.Qualities
// Overflow is fine, just wrap // Overflow is fine, just wrap
unchecked unchecked
{ {
int hash = 17; var hash = 17;
hash = (hash * 23) + Revision.GetHashCode(); hash = (hash * 23) + Revision.GetHashCode();
hash = (hash * 23) + Quality.GetHashCode(); hash = (hash * 23) + Quality.GetHashCode();
return hash; return hash;

View File

@ -44,7 +44,7 @@ namespace NzbDrone.Core.Qualities
public int Compare(QualityModel left, QualityModel right, bool respectGroupOrder) 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) if (result == 0)
{ {

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