mirror of https://github.com/Sonarr/Sonarr
Use 'var' instead of explicit type
This commit is contained in:
parent
281add47de
commit
12374f7f00
|
@ -67,7 +67,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)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using OpenQA.Selenium;
|
using OpenQA.Selenium;
|
||||||
using OpenQA.Selenium.Support.UI;
|
using OpenQA.Selenium.Support.UI;
|
||||||
|
@ -36,7 +36,7 @@ namespace NzbDrone.Automation.Test.PageModel
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IWebElement element = d.FindElement(By.Id("followingBalls"));
|
var element = d.FindElement(By.Id("followingBalls"));
|
||||||
return !element.Displayed;
|
return !element.Displayed;
|
||||||
}
|
}
|
||||||
catch (NoSuchElementException)
|
catch (NoSuchElementException)
|
||||||
|
|
|
@ -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",
|
||||||
() =>
|
() =>
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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>()
|
||||||
|
|
|
@ -799,7 +799,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();
|
||||||
|
@ -833,7 +833,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;
|
||||||
|
|
|
@ -74,18 +74,18 @@ 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);
|
||||||
|
@ -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
|
// 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);
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,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();
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ namespace NzbDrone.Common.Expansive
|
||||||
return source.ExpandInternal(
|
return source.ExpandInternal(
|
||||||
name =>
|
name =>
|
||||||
{
|
{
|
||||||
IDictionary<string, object> modelDict = model.ToDictionary();
|
var modelDict = model.ToDictionary();
|
||||||
if (RequireAllExpansions && !modelDict.ContainsKey(name))
|
if (RequireAllExpansions && !modelDict.ContainsKey(name))
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace NzbDrone.Common.Expansive
|
||||||
{
|
{
|
||||||
// return (Parent == null) ? this : Parent.Root;
|
// return (Parent == null) ? this : Parent.Root;
|
||||||
|
|
||||||
TreeNode<T> node = this;
|
var node = this;
|
||||||
while (node.Parent != null)
|
while (node.Parent != null)
|
||||||
{
|
{
|
||||||
node = node.Parent;
|
node = node.Parent;
|
||||||
|
@ -74,7 +74,7 @@ namespace NzbDrone.Common.Expansive
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
_CallTree = new List<T>();
|
_CallTree = new List<T>();
|
||||||
TreeNode<T> node = this;
|
var node = this;
|
||||||
while (node.Parent != null)
|
while (node.Parent != null)
|
||||||
{
|
{
|
||||||
node = node.Parent;
|
node = node.Parent;
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -254,13 +254,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])
|
||||||
{
|
{
|
||||||
|
|
|
@ -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++)
|
||||||
|
|
|
@ -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())
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
|
|
||||||
namespace NzbDrone.Common.Http.Proxy
|
namespace NzbDrone.Common.Http.Proxy
|
||||||
|
@ -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("*"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace NzbDrone.Common.Instrumentation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (JToken token in json)
|
foreach (var token in json)
|
||||||
{
|
{
|
||||||
Visit(token);
|
Visit(token);
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,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}}";
|
target.Layout = "[${level}] [${threadid}] ${logger}: ${message} ${onexception:inner=${newline}${newline}[v${assembly-version}] ${exception:format=ToString}${newline}}";
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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]))
|
||||||
{
|
{
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -113,7 +113,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);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using FizzWare.NBuilder;
|
using FizzWare.NBuilder;
|
||||||
|
@ -198,7 +198,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];
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,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(Path.Combine("Season 1", expectedOutputs[i]).AsOsAgnostic()).Should().Be(true);
|
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);
|
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);
|
results[i].RelativePath.AsOsAgnostic().PathEquals(Path.Combine("Season 1", expectedOutputs[i]).AsOsAgnostic()).Should().Be(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,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);
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,13 +42,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(System.Text.Encoding.Default.GetBytes(hash));
|
var hashData = hashAlgo.ComputeHash(System.Text.Encoding.Default.GetBytes(hash));
|
||||||
|
|
||||||
|
@ -67,17 +67,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]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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];
|
||||||
|
|
||||||
|
|
|
@ -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 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 } };
|
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);
|
qualityMetLanguageUnmet = fileRepository.Insert(qualityMetLanguageUnmet);
|
||||||
qualityMetLanguageMet = fileRepository.Insert(qualityMetLanguageMet);
|
qualityMetLanguageMet = fileRepository.Insert(qualityMetLanguageMet);
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
|
||||||
.BuildListOfNew()
|
.BuildListOfNew()
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
for (int i = 0; i < _episodeFiles.Count; i++)
|
for (var i = 0; i < _episodeFiles.Count; i++)
|
||||||
{
|
{
|
||||||
_episodes[i].EpisodeFileId = _episodeFiles[i].Id;
|
_episodes[i].EpisodeFileId = _episodeFiles[i].Id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -24,7 +24,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeServiceTests
|
||||||
|
|
||||||
private void GivenEpisodesWithTitles(params string[] titles)
|
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];
|
_episodes[i].Title = titles[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,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;
|
||||||
|
|
|
@ -197,7 +197,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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Reflection;
|
using NzbDrone.Common.Reflection;
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using FluentMigrator;
|
using FluentMigrator;
|
||||||
using NzbDrone.Common.Serializer;
|
using NzbDrone.Common.Serializer;
|
||||||
|
@ -19,28 +19,28 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
|
||||||
private void ConvertSeasons(IDbConnection conn, IDbTransaction tran)
|
private void ConvertSeasons(IDbConnection conn, IDbTransaction tran)
|
||||||
{
|
{
|
||||||
using (IDbCommand allSeriesCmd = conn.CreateCommand())
|
using (var allSeriesCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
allSeriesCmd.Transaction = tran;
|
allSeriesCmd.Transaction = tran;
|
||||||
allSeriesCmd.CommandText = @"SELECT Id FROM Series";
|
allSeriesCmd.CommandText = @"SELECT Id FROM Series";
|
||||||
using (IDataReader allSeriesReader = allSeriesCmd.ExecuteReader())
|
using (var allSeriesReader = allSeriesCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (allSeriesReader.Read())
|
while (allSeriesReader.Read())
|
||||||
{
|
{
|
||||||
int seriesId = allSeriesReader.GetInt32(0);
|
var seriesId = allSeriesReader.GetInt32(0);
|
||||||
var seasons = new List<dynamic>();
|
var seasons = new List<dynamic>();
|
||||||
|
|
||||||
using (IDbCommand seasonsCmd = conn.CreateCommand())
|
using (var seasonsCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
seasonsCmd.Transaction = tran;
|
seasonsCmd.Transaction = tran;
|
||||||
seasonsCmd.CommandText = string.Format(@"SELECT SeasonNumber, Monitored FROM Seasons WHERE SeriesId = {0}", seriesId);
|
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())
|
while (seasonReader.Read())
|
||||||
{
|
{
|
||||||
int seasonNumber = seasonReader.GetInt32(0);
|
var seasonNumber = seasonReader.GetInt32(0);
|
||||||
bool monitored = seasonReader.GetBoolean(1);
|
var monitored = seasonReader.GetBoolean(1);
|
||||||
|
|
||||||
if (seasonNumber == 0)
|
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);
|
var text = string.Format("UPDATE Series SET Seasons = '{0}' WHERE Id = {1}", seasons.ToJson(), seriesId);
|
||||||
|
|
||||||
|
|
|
@ -19,11 +19,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())
|
||||||
{
|
{
|
||||||
var separatorIndex = namingConfigReader.GetOrdinal("Separator");
|
var separatorIndex = namingConfigReader.GetOrdinal("Separator");
|
||||||
var numberStyleIndex = namingConfigReader.GetOrdinal("NumberStyle");
|
var numberStyleIndex = namingConfigReader.GetOrdinal("NumberStyle");
|
||||||
|
@ -96,7 +96,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
dailyEpisodeFormat += qualityFormat;
|
dailyEpisodeFormat += qualityFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (IDbCommand updateCmd = conn.CreateCommand())
|
using (var updateCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
var text = string.Format("UPDATE NamingConfig " +
|
var text = string.Format("UPDATE NamingConfig " +
|
||||||
"SET StandardEpisodeFormat = '{0}', " +
|
"SET StandardEpisodeFormat = '{0}', " +
|
||||||
|
|
|
@ -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,13 +17,13 @@ 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 [Value] FROM Config WHERE [Key] = 'seasonfolderformat'";
|
namingConfigCmd.CommandText = @"SELECT [Value] FROM Config WHERE [Key] = 'seasonfolderformat'";
|
||||||
var seasonFormat = "Season {season}";
|
var seasonFormat = "Season {season}";
|
||||||
|
|
||||||
using (IDataReader namingConfigReader = namingConfigCmd.ExecuteReader())
|
using (var namingConfigReader = namingConfigCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (namingConfigReader.Read())
|
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 " +
|
var text = string.Format("UPDATE NamingConfig " +
|
||||||
"SET SeasonFolderFormat = '{0}'",
|
"SET SeasonFolderFormat = '{0}'",
|
||||||
|
|
|
@ -17,12 +17,12 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
|
||||||
private void UpdatePushoverSettings(IDbConnection conn, IDbTransaction tran)
|
private void UpdatePushoverSettings(IDbConnection conn, IDbTransaction tran)
|
||||||
{
|
{
|
||||||
using (IDbCommand selectCommand = conn.CreateCommand())
|
using (var selectCommand = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
selectCommand.Transaction = tran;
|
selectCommand.Transaction = tran;
|
||||||
selectCommand.CommandText = @"SELECT * FROM Notifications WHERE ConfigContract = 'PushoverSettings'";
|
selectCommand.CommandText = @"SELECT * FROM Notifications WHERE ConfigContract = 'PushoverSettings'";
|
||||||
|
|
||||||
using (IDataReader reader = selectCommand.ExecuteReader())
|
using (var reader = selectCommand.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
settings.Priority = 1;
|
settings.Priority = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (IDbCommand updateCmd = conn.CreateCommand())
|
using (var updateCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
var text = string.Format("UPDATE Notifications " +
|
var text = string.Format("UPDATE Notifications " +
|
||||||
"SET Settings = '{0}'" +
|
"SET Settings = '{0}'" +
|
||||||
|
|
|
@ -29,11 +29,11 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
var qualityProfileItemConverter = new EmbeddedDocumentConverter<List<QualityProfileQualityItem>>(new QualityIntConverter());
|
var qualityProfileItemConverter = new EmbeddedDocumentConverter<List<QualityProfileQualityItem>>(new QualityIntConverter());
|
||||||
|
|
||||||
// Convert 'Allowed' column in QualityProfiles from Json List<object> to Json List<int> (int = Quality)
|
// 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.Transaction = tran;
|
||||||
qualityProfileCmd.CommandText = @"SELECT Id, Allowed FROM QualityProfiles";
|
qualityProfileCmd.CommandText = @"SELECT Id, Allowed FROM QualityProfiles";
|
||||||
using (IDataReader qualityProfileReader = qualityProfileCmd.ExecuteReader())
|
using (var qualityProfileReader = qualityProfileCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (qualityProfileReader.Read())
|
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();
|
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.Transaction = tran;
|
||||||
updateCmd.CommandText = "UPDATE QualityProfiles SET Items = ? WHERE Id = ?";
|
updateCmd.CommandText = "UPDATE QualityProfiles SET Items = ? WHERE Id = ?";
|
||||||
|
@ -72,11 +72,11 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
{
|
{
|
||||||
var qualityModelConverter = new EmbeddedDocumentConverter<DestinationQualityModel036>(new QualityIntConverter());
|
var qualityModelConverter = new EmbeddedDocumentConverter<DestinationQualityModel036>(new QualityIntConverter());
|
||||||
|
|
||||||
using (IDbCommand qualityModelCmd = conn.CreateCommand())
|
using (var qualityModelCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
qualityModelCmd.Transaction = tran;
|
qualityModelCmd.Transaction = tran;
|
||||||
qualityModelCmd.CommandText = @"SELECT Distinct Quality FROM " + tableName;
|
qualityModelCmd.CommandText = @"SELECT Distinct Quality FROM " + tableName;
|
||||||
using (IDataReader qualityModelReader = qualityModelCmd.ExecuteReader())
|
using (var qualityModelReader = qualityModelCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (qualityModelReader.Read())
|
while (qualityModelReader.Read())
|
||||||
{
|
{
|
||||||
|
@ -93,7 +93,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
Proper = sourceQuality.Proper
|
Proper = sourceQuality.Proper
|
||||||
};
|
};
|
||||||
|
|
||||||
using (IDbCommand updateCmd = conn.CreateCommand())
|
using (var updateCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
updateCmd.Transaction = tran;
|
updateCmd.Transaction = tran;
|
||||||
updateCmd.CommandText = "UPDATE " + tableName + " SET Quality = ? WHERE Quality = ?";
|
updateCmd.CommandText = "UPDATE " + tableName + " SET Quality = ? WHERE Quality = ?";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using FluentMigrator;
|
using FluentMigrator;
|
||||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
|
@ -30,11 +30,11 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
private void ConvertQualities(IDbConnection conn, IDbTransaction tran)
|
private void ConvertQualities(IDbConnection conn, IDbTransaction tran)
|
||||||
{
|
{
|
||||||
// Convert QualitySizes to a more generic QualityDefinitions table.
|
// Convert QualitySizes to a more generic QualityDefinitions table.
|
||||||
using (IDbCommand qualitySizeCmd = conn.CreateCommand())
|
using (var qualitySizeCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
qualitySizeCmd.Transaction = tran;
|
qualitySizeCmd.Transaction = tran;
|
||||||
qualitySizeCmd.CommandText = @"SELECT QualityId, MinSize, MaxSize FROM QualitySizes";
|
qualitySizeCmd.CommandText = @"SELECT QualityId, MinSize, MaxSize FROM QualitySizes";
|
||||||
using (IDataReader qualitySizeReader = qualitySizeCmd.ExecuteReader())
|
using (var qualitySizeReader = qualitySizeCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (qualitySizeReader.Read())
|
while (qualitySizeReader.Read())
|
||||||
{
|
{
|
||||||
|
@ -44,7 +44,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
|
||||||
var defaultConfig = Quality.DefaultQualityDefinitions.Single(p => (int)p.Quality == qualityId);
|
var defaultConfig = Quality.DefaultQualityDefinitions.Single(p => (int)p.Quality == qualityId);
|
||||||
|
|
||||||
using (IDbCommand updateCmd = conn.CreateCommand())
|
using (var updateCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
updateCmd.Transaction = tran;
|
updateCmd.Transaction = tran;
|
||||||
updateCmd.CommandText = "INSERT INTO QualityDefinitions (Quality, Title, Weight, MinSize, MaxSize) VALUES (?, ?, ?, ?, ?)";
|
updateCmd.CommandText = "INSERT INTO QualityDefinitions (Quality, Title, Weight, MinSize, MaxSize) VALUES (?, ?, ?, ?, ?)";
|
||||||
|
|
|
@ -19,11 +19,11 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
{
|
{
|
||||||
var config = new Dictionary<string, string>();
|
var config = new Dictionary<string, string>();
|
||||||
|
|
||||||
using (IDbCommand configCmd = conn.CreateCommand())
|
using (var configCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
configCmd.Transaction = tran;
|
configCmd.Transaction = tran;
|
||||||
configCmd.CommandText = @"SELECT * FROM Config";
|
configCmd.CommandText = @"SELECT * FROM Config";
|
||||||
using (IDataReader configReader = configCmd.ExecuteReader())
|
using (var configReader = configCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
var keyIndex = configReader.GetOrdinal("Key");
|
var keyIndex = configReader.GetOrdinal("Key");
|
||||||
var valueIndex = configReader.GetOrdinal("Value");
|
var valueIndex = configReader.GetOrdinal("Value");
|
||||||
|
@ -119,7 +119,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
string configContract,
|
string configContract,
|
||||||
int protocol)
|
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, ?, ?, ?, ?, ?)");
|
var text = string.Format("INSERT INTO DownloadClients (Enable, Name, Implementation, Settings, ConfigContract, Protocol) VALUES (1, ?, ?, ?, ?, ?)");
|
||||||
updateCmd.AddParameter(name);
|
updateCmd.AddParameter(name);
|
||||||
|
@ -136,7 +136,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
|
||||||
private void DeleteOldConfigValues(IDbConnection conn, IDbTransaction tran)
|
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', " +
|
var text = "DELETE FROM Config WHERE [KEY] IN ('nzbgetusername', 'nzbgetpassword', 'nzbgethost', 'nzbgetport', " +
|
||||||
"'nzbgettvcategory', 'nzbgetrecenttvpriority', 'nzbgetoldertvpriority', 'sabhost', 'sabport', " +
|
"'nzbgettvcategory', 'nzbgetrecenttvpriority', 'nzbgetoldertvpriority', 'sabhost', 'sabport', " +
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
|
||||||
private void EnableCompletedDownloadHandlingForNewUsers(IDbConnection conn, IDbTransaction tran)
|
private void EnableCompletedDownloadHandlingForNewUsers(IDbConnection conn, IDbTransaction tran)
|
||||||
{
|
{
|
||||||
using (IDbCommand cmd = conn.CreateCommand())
|
using (var cmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
cmd.Transaction = tran;
|
cmd.Transaction = tran;
|
||||||
cmd.CommandText = @"SELECT Value FROM Config WHERE Key = 'downloadedepisodesfolder'";
|
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)
|
private void ConvertFolderSettings(IDbConnection conn, IDbTransaction tran)
|
||||||
{
|
{
|
||||||
using (IDbCommand downloadClientsCmd = conn.CreateCommand())
|
using (var downloadClientsCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
downloadClientsCmd.Transaction = tran;
|
downloadClientsCmd.Transaction = tran;
|
||||||
downloadClientsCmd.CommandText = @"SELECT Value FROM Config WHERE Key = 'downloadedepisodesfolder'";
|
downloadClientsCmd.CommandText = @"SELECT Value FROM Config WHERE Key = 'downloadedepisodesfolder'";
|
||||||
|
@ -49,7 +49,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
|
||||||
downloadClientsCmd.Transaction = tran;
|
downloadClientsCmd.Transaction = tran;
|
||||||
downloadClientsCmd.CommandText = @"SELECT Id, Implementation, Settings, ConfigContract FROM DownloadClients WHERE ConfigContract = 'FolderSettings'";
|
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())
|
while (downloadClientReader.Read())
|
||||||
{
|
{
|
||||||
|
@ -68,7 +68,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
WatchFolder = downloadedEpisodesFolder
|
WatchFolder = downloadedEpisodesFolder
|
||||||
}.ToJson();
|
}.ToJson();
|
||||||
|
|
||||||
using (IDbCommand updateCmd = conn.CreateCommand())
|
using (var updateCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
updateCmd.Transaction = tran;
|
updateCmd.Transaction = tran;
|
||||||
updateCmd.CommandText = "UPDATE DownloadClients SET Implementation = ?, Settings = ?, ConfigContract = ? WHERE Id = ?";
|
updateCmd.CommandText = "UPDATE DownloadClients SET Implementation = ?, Settings = ?, ConfigContract = ? WHERE Id = ?";
|
||||||
|
@ -87,7 +87,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
NzbFolder = settingsJson.Value<string>("folder")
|
NzbFolder = settingsJson.Value<string>("folder")
|
||||||
}.ToJson();
|
}.ToJson();
|
||||||
|
|
||||||
using (IDbCommand updateCmd = conn.CreateCommand())
|
using (var updateCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
updateCmd.Transaction = tran;
|
updateCmd.Transaction = tran;
|
||||||
updateCmd.CommandText = "UPDATE DownloadClients SET Settings = ?, ConfigContract = ? WHERE Id = ?";
|
updateCmd.CommandText = "UPDATE DownloadClients SET Settings = ?, ConfigContract = ? WHERE Id = ?";
|
||||||
|
@ -100,7 +100,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
using (IDbCommand updateCmd = conn.CreateCommand())
|
using (var updateCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
updateCmd.Transaction = tran;
|
updateCmd.Transaction = tran;
|
||||||
updateCmd.CommandText = "DELETE FROM DownloadClients WHERE Id = ?";
|
updateCmd.CommandText = "DELETE FROM DownloadClients WHERE Id = ?";
|
||||||
|
@ -138,11 +138,11 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
{
|
{
|
||||||
var historyItems = new List<MigrationHistoryItem>();
|
var historyItems = new List<MigrationHistoryItem>();
|
||||||
|
|
||||||
using (IDbCommand historyCmd = conn.CreateCommand())
|
using (var historyCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
historyCmd.Transaction = tran;
|
historyCmd.Transaction = tran;
|
||||||
historyCmd.CommandText = @"SELECT Id, EpisodeId, SeriesId, SourceTitle, Date, Data, EventType FROM History WHERE EventType NOT NULL";
|
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())
|
while (historyRead.Read())
|
||||||
{
|
{
|
||||||
|
@ -176,7 +176,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
{
|
{
|
||||||
var list = historyItemGroup.ToList();
|
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];
|
var grabbedEvent = list[i];
|
||||||
if (grabbedEvent.EventType != MigrationHistoryEventType.Grabbed)
|
if (grabbedEvent.EventType != MigrationHistoryEventType.Grabbed)
|
||||||
|
@ -232,7 +232,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
|
||||||
foreach (var pair in historyItemsToAssociate)
|
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["downloadClient"] = pair.Value.Data["downloadClient"];
|
||||||
pair.Key.Data["downloadClientId"] = pair.Value.Data["downloadClientId"];
|
pair.Key.Data["downloadClientId"] = pair.Value.Data["downloadClientId"];
|
||||||
|
|
|
@ -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, Title FROM Series";
|
getSeriesCmd.CommandText = @"SELECT Id, Title FROM Series";
|
||||||
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 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 Series SET SortTitle = ? WHERE Id = ?";
|
updateCmd.CommandText = "UPDATE Series SET SortTitle = ? WHERE Id = ?";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using FluentMigrator;
|
using FluentMigrator;
|
||||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
|
@ -20,18 +20,18 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
|
||||||
private void UpdateRelativePaths(IDbConnection conn, IDbTransaction tran)
|
private void UpdateRelativePaths(IDbConnection conn, IDbTransaction tran)
|
||||||
{
|
{
|
||||||
using (IDbCommand getSeriesCmd = conn.CreateCommand())
|
using (var getSeriesCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
getSeriesCmd.Transaction = tran;
|
getSeriesCmd.Transaction = tran;
|
||||||
getSeriesCmd.CommandText = @"SELECT Id, Path FROM Series";
|
getSeriesCmd.CommandText = @"SELECT Id, Path FROM Series";
|
||||||
using (IDataReader seriesReader = getSeriesCmd.ExecuteReader())
|
using (var seriesReader = getSeriesCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (seriesReader.Read())
|
while (seriesReader.Read())
|
||||||
{
|
{
|
||||||
var seriesId = seriesReader.GetInt32(0);
|
var seriesId = seriesReader.GetInt32(0);
|
||||||
var seriesPath = seriesReader.GetString(1) + Path.DirectorySeparatorChar;
|
var seriesPath = seriesReader.GetString(1) + Path.DirectorySeparatorChar;
|
||||||
|
|
||||||
using (IDbCommand updateCmd = conn.CreateCommand())
|
using (var updateCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
updateCmd.Transaction = tran;
|
updateCmd.Transaction = tran;
|
||||||
updateCmd.CommandText = "UPDATE EpisodeFiles SET RelativePath = REPLACE(Path, ?, '') WHERE SeriesId = ?";
|
updateCmd.CommandText = "UPDATE EpisodeFiles SET RelativePath = REPLACE(Path, ?, '') WHERE SeriesId = ?";
|
||||||
|
|
|
@ -26,12 +26,12 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
{
|
{
|
||||||
var qualitiesToUpdate = new Dictionary<string, string>();
|
var qualitiesToUpdate = new Dictionary<string, string>();
|
||||||
|
|
||||||
using (IDbCommand qualityModelCmd = conn.CreateCommand())
|
using (var qualityModelCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
qualityModelCmd.Transaction = tran;
|
qualityModelCmd.Transaction = tran;
|
||||||
qualityModelCmd.CommandText = @"SELECT Distinct Quality FROM " + tableName;
|
qualityModelCmd.CommandText = @"SELECT Distinct Quality FROM " + tableName;
|
||||||
|
|
||||||
using (IDataReader qualityModelReader = qualityModelCmd.ExecuteReader())
|
using (var qualityModelReader = qualityModelCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (qualityModelReader.Read())
|
while (qualityModelReader.Read())
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
|
||||||
foreach (var quality in qualitiesToUpdate)
|
foreach (var quality in qualitiesToUpdate)
|
||||||
{
|
{
|
||||||
using (IDbCommand updateCmd = conn.CreateCommand())
|
using (var updateCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
updateCmd.Transaction = tran;
|
updateCmd.Transaction = tran;
|
||||||
updateCmd.CommandText = "UPDATE " + tableName + " SET Quality = ? WHERE Quality = ?";
|
updateCmd.CommandText = "UPDATE " + tableName + " SET Quality = ? WHERE Quality = ?";
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
@ -21,19 +21,19 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
|
||||||
private void ConvertRestrictions(IDbConnection conn, IDbTransaction tran)
|
private void ConvertRestrictions(IDbConnection conn, IDbTransaction tran)
|
||||||
{
|
{
|
||||||
using (IDbCommand getRestictionsCmd = conn.CreateCommand())
|
using (var getRestictionsCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
getRestictionsCmd.Transaction = tran;
|
getRestictionsCmd.Transaction = tran;
|
||||||
getRestictionsCmd.CommandText = @"SELECT [Value] FROM Config WHERE [Key] = 'releaserestrictions'";
|
getRestictionsCmd.CommandText = @"SELECT [Value] FROM Config WHERE [Key] = 'releaserestrictions'";
|
||||||
|
|
||||||
using (IDataReader configReader = getRestictionsCmd.ExecuteReader())
|
using (var configReader = getRestictionsCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (configReader.Read())
|
while (configReader.Read())
|
||||||
{
|
{
|
||||||
var restrictions = configReader.GetString(0);
|
var restrictions = configReader.GetString(0);
|
||||||
restrictions = restrictions.Replace("\n", ",");
|
restrictions = restrictions.Replace("\n", ",");
|
||||||
|
|
||||||
using (IDbCommand insertCmd = conn.CreateCommand())
|
using (var insertCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
insertCmd.Transaction = tran;
|
insertCmd.Transaction = tran;
|
||||||
insertCmd.CommandText = "INSERT INTO Restrictions (Ignored, Tags) VALUES (?, '[]')";
|
insertCmd.CommandText = "INSERT INTO Restrictions (Ignored, Tags) VALUES (?, '[]')";
|
||||||
|
|
|
@ -19,12 +19,12 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
|
||||||
private void ConvertQualityTitle(IDbConnection conn, IDbTransaction tran)
|
private void ConvertQualityTitle(IDbConnection conn, IDbTransaction tran)
|
||||||
{
|
{
|
||||||
using (IDbCommand namingConfigCmd = conn.CreateCommand())
|
using (var namingConfigCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
namingConfigCmd.Transaction = tran;
|
namingConfigCmd.Transaction = tran;
|
||||||
namingConfigCmd.CommandText = @"SELECT StandardEpisodeFormat, DailyEpisodeFormat, AnimeEpisodeFormat FROM NamingConfig LIMIT 1";
|
namingConfigCmd.CommandText = @"SELECT StandardEpisodeFormat, DailyEpisodeFormat, AnimeEpisodeFormat FROM NamingConfig LIMIT 1";
|
||||||
|
|
||||||
using (IDataReader configReader = namingConfigCmd.ExecuteReader())
|
using (var configReader = namingConfigCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (configReader.Read())
|
while (configReader.Read())
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
var newDaily = GetNewFormat(currentDaily);
|
var newDaily = GetNewFormat(currentDaily);
|
||||||
var newAnime = GetNewFormat(currentAnime);
|
var newAnime = GetNewFormat(currentAnime);
|
||||||
|
|
||||||
using (IDbCommand updateCmd = conn.CreateCommand())
|
using (var updateCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
updateCmd.Transaction = tran;
|
updateCmd.Transaction = tran;
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
var tagId = InsertTag(conn, tran, tag);
|
var tagId = InsertTag(conn, tran, tag);
|
||||||
var tags = string.Format("[{0}]", tagId);
|
var tags = string.Format("[{0}]", tagId);
|
||||||
|
|
||||||
using (IDbCommand insertDelayProfileCmd = conn.CreateCommand())
|
using (var insertDelayProfileCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
insertDelayProfileCmd.Transaction = tran;
|
insertDelayProfileCmd.Transaction = tran;
|
||||||
insertDelayProfileCmd.CommandText = "INSERT INTO DelayProfiles (EnableUsenet, EnableTorrent, PreferredProtocol, TorrentDelay, UsenetDelay, [Order], Tags) VALUES (1, 1, 1, 0, ?, ?, ?)";
|
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>();
|
var profiles = new List<Profile69>();
|
||||||
|
|
||||||
using (IDbCommand getProfilesCmd = conn.CreateCommand())
|
using (var getProfilesCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
getProfilesCmd.Transaction = tran;
|
getProfilesCmd.Transaction = tran;
|
||||||
getProfilesCmd.CommandText = @"SELECT Id, GrabDelay FROM Profiles";
|
getProfilesCmd.CommandText = @"SELECT Id, GrabDelay FROM Profiles";
|
||||||
|
|
||||||
using (IDataReader profileReader = getProfilesCmd.ExecuteReader())
|
using (var profileReader = getProfilesCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (profileReader.Read())
|
while (profileReader.Read())
|
||||||
{
|
{
|
||||||
|
@ -106,7 +106,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
|
||||||
private int InsertTag(IDbConnection conn, IDbTransaction tran, string tagLabel)
|
private int InsertTag(IDbConnection conn, IDbTransaction tran, string tagLabel)
|
||||||
{
|
{
|
||||||
using (IDbCommand insertCmd = conn.CreateCommand())
|
using (var insertCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
insertCmd.Transaction = tran;
|
insertCmd.Transaction = tran;
|
||||||
insertCmd.CommandText = @"INSERT INTO Tags (Label) VALUES (?); SELECT last_insert_rowid()";
|
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)
|
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.Transaction = tran;
|
||||||
getSeriesCmd.CommandText = "SELECT Id, Tags FROM Series WHERE ProfileId IN (?)";
|
getSeriesCmd.CommandText = "SELECT Id, Tags FROM Series WHERE ProfileId IN (?)";
|
||||||
getSeriesCmd.AddParameter(string.Join(",", profileIds));
|
getSeriesCmd.AddParameter(string.Join(",", profileIds));
|
||||||
|
|
||||||
using (IDataReader seriesReader = getSeriesCmd.ExecuteReader())
|
using (var seriesReader = getSeriesCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (seriesReader.Read())
|
while (seriesReader.Read())
|
||||||
{
|
{
|
||||||
|
@ -136,7 +136,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
var tags = Json.Deserialize<List<int>>(tagString);
|
var tags = Json.Deserialize<List<int>>(tagString);
|
||||||
tags.Add(tagId);
|
tags.Add(tagId);
|
||||||
|
|
||||||
using (IDbCommand updateSeriesCmd = conn.CreateCommand())
|
using (var updateSeriesCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
updateSeriesCmd.Transaction = tran;
|
updateSeriesCmd.Transaction = tran;
|
||||||
updateSeriesCmd.CommandText = "UPDATE Series SET Tags = ? WHERE Id = ?";
|
updateSeriesCmd.CommandText = "UPDATE Series SET Tags = ? WHERE Id = ?";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using FluentMigrator;
|
using FluentMigrator;
|
||||||
|
@ -22,7 +22,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
|
||||||
private void MoveToColumn(IDbConnection conn, IDbTransaction tran)
|
private void MoveToColumn(IDbConnection conn, IDbTransaction tran)
|
||||||
{
|
{
|
||||||
using (IDbCommand getHistory = conn.CreateCommand())
|
using (var getHistory = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
getHistory.Transaction = tran;
|
getHistory.Transaction = tran;
|
||||||
getHistory.CommandText = @"SELECT Id, Data FROM History WHERE Data LIKE '%downloadClientId%'";
|
getHistory.CommandText = @"SELECT Id, Data FROM History WHERE Data LIKE '%downloadClientId%'";
|
||||||
|
|
|
@ -45,12 +45,12 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
{
|
{
|
||||||
var tags = new List<Tag079>();
|
var tags = new List<Tag079>();
|
||||||
|
|
||||||
using (IDbCommand tagCmd = conn.CreateCommand())
|
using (var tagCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
tagCmd.Transaction = tran;
|
tagCmd.Transaction = tran;
|
||||||
tagCmd.CommandText = @"SELECT Id, Label FROM Tags";
|
tagCmd.CommandText = @"SELECT Id, Label FROM Tags";
|
||||||
|
|
||||||
using (IDataReader tagReader = tagCmd.ExecuteReader())
|
using (var tagReader = tagCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (tagReader.Read())
|
while (tagReader.Read())
|
||||||
{
|
{
|
||||||
|
@ -69,12 +69,12 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
{
|
{
|
||||||
var tagged = new List<TaggedModel079>();
|
var tagged = new List<TaggedModel079>();
|
||||||
|
|
||||||
using (IDbCommand tagCmd = conn.CreateCommand())
|
using (var tagCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
tagCmd.Transaction = tran;
|
tagCmd.Transaction = tran;
|
||||||
tagCmd.CommandText = string.Format("SELECT Id, Tags FROM {0}", table);
|
tagCmd.CommandText = string.Format("SELECT Id, Tags FROM {0}", table);
|
||||||
|
|
||||||
using (IDataReader tagReader = tagCmd.ExecuteReader())
|
using (var tagReader = tagCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (tagReader.Read())
|
while (tagReader.Read())
|
||||||
{
|
{
|
||||||
|
@ -111,7 +111,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
|
||||||
foreach (var model in toUpdate.DistinctBy(m => m.Id))
|
foreach (var model in toUpdate.DistinctBy(m => m.Id))
|
||||||
{
|
{
|
||||||
using (IDbCommand updateCmd = conn.CreateCommand())
|
using (var updateCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
updateCmd.Transaction = tran;
|
updateCmd.Transaction = tran;
|
||||||
updateCmd.CommandText = string.Format(@"UPDATE {0} SET Tags = ? WHERE Id = ?", table);
|
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();
|
var idsToRemove = replacements.Select(r => r.OldId).Distinct();
|
||||||
|
|
||||||
using (IDbCommand removeCmd = conn.CreateCommand())
|
using (var removeCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
removeCmd.Transaction = tran;
|
removeCmd.Transaction = tran;
|
||||||
removeCmd.CommandText = string.Format("DELETE FROM Tags WHERE Id IN ({0})", string.Join(",", idsToRemove));
|
removeCmd.CommandText = string.Format("DELETE FROM Tags WHERE Id IN ({0})", string.Join(",", idsToRemove));
|
||||||
|
|
|
@ -32,12 +32,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);
|
||||||
|
@ -56,11 +56,11 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
}
|
}
|
||||||
|
|
||||||
var seriesLanguages = new Dictionary<int, int>();
|
var seriesLanguages = 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 Series";
|
getSeriesCmd.CommandText = @"SELECT Id, ProfileId FROM Series";
|
||||||
using (IDataReader seriesReader = getSeriesCmd.ExecuteReader())
|
using (var seriesReader = getSeriesCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (seriesReader.Read())
|
while (seriesReader.Read())
|
||||||
{
|
{
|
||||||
|
@ -78,7 +78,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
|
||||||
var seriesIds = group.Select(v => v.ToString()).Join(",");
|
var seriesIds = group.Select(v => v.ToString()).Join(",");
|
||||||
|
|
||||||
using (IDbCommand updateEpisodeFilesCmd = conn.CreateCommand())
|
using (var updateEpisodeFilesCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
updateEpisodeFilesCmd.Transaction = tran;
|
updateEpisodeFilesCmd.Transaction = tran;
|
||||||
updateEpisodeFilesCmd.CommandText = $"UPDATE EpisodeFiles SET Language = ? WHERE SeriesId IN ({seriesIds})";
|
updateEpisodeFilesCmd.CommandText = $"UPDATE EpisodeFiles SET Language = ? WHERE SeriesId IN ({seriesIds})";
|
||||||
|
@ -89,7 +89,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
updateEpisodeFilesCmd.ExecuteNonQuery();
|
updateEpisodeFilesCmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
using (IDbCommand updateHistoryCmd = conn.CreateCommand())
|
using (var updateHistoryCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
updateHistoryCmd.Transaction = tran;
|
updateHistoryCmd.Transaction = tran;
|
||||||
updateHistoryCmd.CommandText = $"UPDATE History SET Language = ? WHERE SeriesId IN ({seriesIds})";
|
updateHistoryCmd.CommandText = $"UPDATE History SET Language = ? WHERE SeriesId IN ({seriesIds})";
|
||||||
|
@ -100,7 +100,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
updateHistoryCmd.ExecuteNonQuery();
|
updateHistoryCmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
using (IDbCommand updateBlacklistCmd = conn.CreateCommand())
|
using (var updateBlacklistCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
updateBlacklistCmd.Transaction = tran;
|
updateBlacklistCmd.Transaction = tran;
|
||||||
updateBlacklistCmd.CommandText = $"UPDATE Blacklist SET Language = ? WHERE SeriesId IN ({seriesIds})";
|
updateBlacklistCmd.CommandText = $"UPDATE Blacklist SET Language = ? WHERE SeriesId IN ({seriesIds})";
|
||||||
|
|
|
@ -33,7 +33,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;
|
||||||
insertNewLanguageProfileCmd.CommandText = "INSERT INTO LanguageProfiles (Id, Name, Cutoff, Languages) VALUES (?, ?, ?, ?)";
|
insertNewLanguageProfileCmd.CommandText = "INSERT INTO LanguageProfiles (Id, Name, Cutoff, Languages) VALUES (?, ?, ?, ?)";
|
||||||
|
@ -47,7 +47,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
insertNewLanguageProfileCmd.ExecuteNonQuery();
|
insertNewLanguageProfileCmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
using (IDbCommand updateSeriesCmd = conn.CreateCommand())
|
using (var updateSeriesCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
foreach (var profileId in profile.ProfileIds)
|
foreach (var profileId in profile.ProfileIds)
|
||||||
{
|
{
|
||||||
|
@ -84,12 +84,12 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
var profiles = GetDefaultLanguageProfiles();
|
var profiles = GetDefaultLanguageProfiles();
|
||||||
var thereAreProfiles = false;
|
var thereAreProfiles = false;
|
||||||
|
|
||||||
using (IDbCommand getProfilesCmd = conn.CreateCommand())
|
using (var getProfilesCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
getProfilesCmd.Transaction = tran;
|
getProfilesCmd.Transaction = tran;
|
||||||
getProfilesCmd.CommandText = @"SELECT Id, Language FROM Profiles";
|
getProfilesCmd.CommandText = @"SELECT Id, Language FROM Profiles";
|
||||||
|
|
||||||
using (IDataReader profileReader = getProfilesCmd.ExecuteReader())
|
using (var profileReader = getProfilesCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (profileReader.Read())
|
while (profileReader.Read())
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,8 +29,8 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
|
||||||
using (var reader = cmd.ExecuteReader())
|
using (var reader = cmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
int nextUsenet = 1;
|
var nextUsenet = 1;
|
||||||
int nextTorrent = 1;
|
var nextTorrent = 1;
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
var id = reader.GetInt32(0);
|
var id = reader.GetInt32(0);
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
{
|
{
|
||||||
var defaultFormat = "Specials";
|
var defaultFormat = "Specials";
|
||||||
|
|
||||||
using (IDbCommand updateCmd = conn.CreateCommand())
|
using (var updateCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
updateCmd.Transaction = tran;
|
updateCmd.Transaction = tran;
|
||||||
updateCmd.CommandText = "UPDATE NamingConfig SET SpecialsFolderFormat = ?";
|
updateCmd.CommandText = "UPDATE NamingConfig SET SpecialsFolderFormat = ?";
|
||||||
|
|
|
@ -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'";
|
||||||
|
@ -31,7 +31,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', ?)";
|
||||||
|
@ -41,7 +41,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'";
|
||||||
|
|
|
@ -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")
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,11 +15,11 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
|
||||||
private void UpdateSortTitles(IDbConnection conn, IDbTransaction tran)
|
private void UpdateSortTitles(IDbConnection conn, IDbTransaction tran)
|
||||||
{
|
{
|
||||||
using (IDbCommand getSeriesCmd = conn.CreateCommand())
|
using (var getSeriesCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
getSeriesCmd.Transaction = tran;
|
getSeriesCmd.Transaction = tran;
|
||||||
getSeriesCmd.CommandText = @"SELECT Id, TvdbId, Title FROM Series";
|
getSeriesCmd.CommandText = @"SELECT Id, TvdbId, Title FROM Series";
|
||||||
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 sortTitle = SeriesTitleNormalizer.Normalize(title, tvdbId);
|
var sortTitle = SeriesTitleNormalizer.Normalize(title, tvdbId);
|
||||||
|
|
||||||
using (IDbCommand updateCmd = conn.CreateCommand())
|
using (var updateCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
updateCmd.Transaction = tran;
|
updateCmd.Transaction = tran;
|
||||||
updateCmd.CommandText = "UPDATE Series SET SortTitle = ? WHERE Id = ?";
|
updateCmd.CommandText = "UPDATE Series SET SortTitle = ? WHERE Id = ?";
|
||||||
|
|
|
@ -182,11 +182,11 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
|
||||||
private void MigrateNamingConfigs(IDbConnection conn, IDbTransaction tran)
|
private void MigrateNamingConfigs(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())
|
||||||
{
|
{
|
||||||
var standardEpisodeFormatIndex = namingConfigReader.GetOrdinal("StandardEpisodeFormat");
|
var standardEpisodeFormatIndex = namingConfigReader.GetOrdinal("StandardEpisodeFormat");
|
||||||
var dailyEpisodeFormatIndex = namingConfigReader.GetOrdinal("DailyEpisodeFormat");
|
var dailyEpisodeFormatIndex = namingConfigReader.GetOrdinal("DailyEpisodeFormat");
|
||||||
|
@ -198,7 +198,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
var dailyEpisodeFormat = NameReplace(namingConfigReader.GetString(dailyEpisodeFormatIndex));
|
var dailyEpisodeFormat = NameReplace(namingConfigReader.GetString(dailyEpisodeFormatIndex));
|
||||||
var animeEpisodeFormat = NameReplace(namingConfigReader.GetString(animeEpisodeFormatIndex));
|
var animeEpisodeFormat = NameReplace(namingConfigReader.GetString(animeEpisodeFormatIndex));
|
||||||
|
|
||||||
using (IDbCommand updateCmd = conn.CreateCommand())
|
using (var updateCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
var text = string.Format("UPDATE NamingConfig " +
|
var text = string.Format("UPDATE NamingConfig " +
|
||||||
"SET StandardEpisodeFormat = '{0}', " +
|
"SET StandardEpisodeFormat = '{0}', " +
|
||||||
|
|
|
@ -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.Model;
|
using FluentMigrator.Model;
|
||||||
|
@ -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>();
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -63,7 +63,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();
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,7 +222,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");
|
||||||
|
|
||||||
|
|
|
@ -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.TvCategory.IsNotNullOrWhiteSpace() && !labels.ContainsKey(Settings.TvCategory))
|
if (Settings.TvCategory.IsNotNullOrWhiteSpace() && !labels.ContainsKey(Settings.TvCategory))
|
||||||
{
|
{
|
||||||
|
|
|
@ -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]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,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.TvCategory.IsNotNullOrWhiteSpace() && torrent.Category != Settings.TvCategory)
|
if (Settings.TvCategory.IsNotNullOrWhiteSpace() && torrent.Category != Settings.TvCategory)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
@ -215,7 +215,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")
|
||||||
{
|
{
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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(localEpisode, episodeFile, file, extension, isReadOnly))
|
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);
|
_extraFileManagers[i].ImportFiles(localEpisode, episodeFile, managedFiles[i], isReadOnly);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -133,7 +133,7 @@ namespace NzbDrone.Core.Extras.Others
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (string file in matchingFiles)
|
foreach (var file in matchingFiles)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -100,17 +100,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;
|
||||||
|
|
|
@ -20,7 +20,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:"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace NzbDrone.Core.ImportLists
|
||||||
|
|
||||||
var pageableRequestChain = pageableRequestChainSelector(generator);
|
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);
|
var pageableRequests = pageableRequestChain.GetTier(i);
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,8 @@ 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(tvdbIdString, out int tvdbId);
|
int.TryParse(tvdbIdString, out var tvdbId);
|
||||||
int.TryParse(tmdbIdString, out int tmdbId);
|
int.TryParse(tmdbIdString, out var tmdbId);
|
||||||
|
|
||||||
series.Add(new ImportListItemInfo
|
series.Add(new ImportListItemInfo
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
@ -43,7 +43,7 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
|
||||||
throw new IndexerException(indexerResponse, "Indexer API returned an internal server error");
|
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)
|
if (jsonResponse.Error != null || jsonResponse.Result == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -132,7 +132,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);
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ namespace NzbDrone.Core.MediaCover
|
||||||
|
|
||||||
private bool EnsureCovers(Series series)
|
private bool EnsureCovers(Series series)
|
||||||
{
|
{
|
||||||
bool updated = false;
|
var updated = false;
|
||||||
var toResize = new List<Tuple<MediaCover, bool>>();
|
var toResize = new List<Tuple<MediaCover, bool>>();
|
||||||
|
|
||||||
foreach (var cover in series.Images)
|
foreach (var cover in series.Images)
|
||||||
|
|
|
@ -452,7 +452,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.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);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Disk;
|
using NzbDrone.Common.Disk;
|
||||||
|
@ -33,7 +33,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
||||||
|
|
||||||
foreach (var workingFolder in _configService.DownloadClientWorkingFolders.Split('|'))
|
foreach (var workingFolder in _configService.DownloadClientWorkingFolders.Split('|'))
|
||||||
{
|
{
|
||||||
DirectoryInfo parent = Directory.GetParent(localEpisode.Path);
|
var parent = Directory.GetParent(localEpisode.Path);
|
||||||
while (parent != null)
|
while (parent != null)
|
||||||
{
|
{
|
||||||
if (parent.Name.StartsWith(workingFolder))
|
if (parent.Name.StartsWith(workingFolder))
|
||||||
|
|
|
@ -84,7 +84,7 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
if (DateTime.TryParse(fileDate + ' ' + fileTime, out var airDate))
|
if (DateTime.TryParse(fileDate + ' ' + fileTime, out var airDate))
|
||||||
{
|
{
|
||||||
// avoiding false +ve checks and set date skewing by not using UTC (Windows)
|
// 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)
|
if (OsInfo.IsNotWindows && airDate < EpochTime)
|
||||||
{
|
{
|
||||||
|
@ -117,7 +117,7 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
|
|
||||||
private bool ChangeFileDateToUtcAirDate(string filePath, DateTime airDateUtc)
|
private bool ChangeFileDateToUtcAirDate(string filePath, DateTime airDateUtc)
|
||||||
{
|
{
|
||||||
DateTime oldLastWrite = _diskProvider.FileGetLastWrite(filePath);
|
var oldLastWrite = _diskProvider.FileGetLastWrite(filePath);
|
||||||
|
|
||||||
if (OsInfo.IsNotWindows && airDateUtc < EpochTime)
|
if (OsInfo.IsNotWindows && airDateUtc < EpochTime)
|
||||||
{
|
{
|
||||||
|
|
|
@ -127,7 +127,7 @@ namespace NzbDrone.Core.Messaging.Commands
|
||||||
{
|
{
|
||||||
_cancellationTokenSource = new CancellationTokenSource();
|
_cancellationTokenSource = new CancellationTokenSource();
|
||||||
|
|
||||||
for (int i = 0; i < THREAD_LIMIT; i++)
|
for (var i = 0; i < THREAD_LIMIT; i++)
|
||||||
{
|
{
|
||||||
var thread = new Thread(ExecuteCommands);
|
var thread = new Thread(ExecuteCommands);
|
||||||
thread.Start();
|
thread.Start();
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
|
@ -35,7 +35,7 @@ namespace NzbDrone.Core.MetadataSource
|
||||||
|
|
||||||
public int Compare(Series x, Series y)
|
public int Compare(Series x, Series 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)));
|
||||||
|
|
|
@ -107,7 +107,7 @@ namespace NzbDrone.Core.Notifications.Xbmc.Model
|
||||||
unchecked
|
unchecked
|
||||||
{
|
{
|
||||||
// Overflow is fine, just wrap
|
// Overflow is fine, just wrap
|
||||||
int hash = 17;
|
var hash = 17;
|
||||||
hash = (hash * 23) + Major.GetHashCode();
|
hash = (hash * 23) + Major.GetHashCode();
|
||||||
hash = (hash * 23) + Minor.GetHashCode();
|
hash = (hash * 23) + Minor.GetHashCode();
|
||||||
hash = (hash * 23) + Patch.GetHashCode();
|
hash = (hash * 23) + Patch.GetHashCode();
|
||||||
|
|
|
@ -460,7 +460,7 @@ namespace NzbDrone.Core.Organizer
|
||||||
{
|
{
|
||||||
var episodeFormats = GetEpisodeFormat(pattern).DistinctBy(v => v.SeasonEpisodePattern).ToList();
|
var episodeFormats = GetEpisodeFormat(pattern).DistinctBy(v => v.SeasonEpisodePattern).ToList();
|
||||||
|
|
||||||
int index = 1;
|
var index = 1;
|
||||||
foreach (var episodeFormat in episodeFormats)
|
foreach (var episodeFormat in episodeFormats)
|
||||||
{
|
{
|
||||||
var seasonEpisodePattern = episodeFormat.SeasonEpisodePattern;
|
var seasonEpisodePattern = episodeFormat.SeasonEpisodePattern;
|
||||||
|
@ -523,7 +523,7 @@ namespace NzbDrone.Core.Organizer
|
||||||
{
|
{
|
||||||
var absoluteEpisodeFormats = GetAbsoluteFormat(pattern).DistinctBy(v => v.AbsoluteEpisodePattern).ToList();
|
var absoluteEpisodeFormats = GetAbsoluteFormat(pattern).DistinctBy(v => v.AbsoluteEpisodePattern).ToList();
|
||||||
|
|
||||||
int index = 1;
|
var index = 1;
|
||||||
foreach (var absoluteEpisodeFormat in absoluteEpisodeFormats)
|
foreach (var absoluteEpisodeFormat in absoluteEpisodeFormats)
|
||||||
{
|
{
|
||||||
if (series.SeriesType != SeriesTypes.Anime || episodes.Any(e => !e.AbsoluteEpisodeNumber.HasValue))
|
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
|
try
|
||||||
{
|
{
|
||||||
|
@ -872,7 +872,7 @@ namespace NzbDrone.Core.Organizer
|
||||||
{
|
{
|
||||||
var pattern = string.Empty;
|
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;
|
var patternToReplace = i == 0 ? basePattern : formatPattern;
|
||||||
|
|
||||||
|
@ -886,7 +886,7 @@ namespace NzbDrone.Core.Organizer
|
||||||
{
|
{
|
||||||
var pattern = string.Empty;
|
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;
|
var patternToReplace = i == 0 ? basePattern : formatPattern;
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,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))
|
||||||
{
|
{
|
||||||
|
|
|
@ -91,7 +91,7 @@ namespace NzbDrone.Core.Parser.Model
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
string episodeString = "[Unknown Episode]";
|
var episodeString = "[Unknown Episode]";
|
||||||
|
|
||||||
if (IsDaily && EpisodeNumbers.Empty())
|
if (IsDaily && EpisodeNumbers.Empty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -905,7 +905,7 @@ namespace NzbDrone.Core.Parser
|
||||||
|
|
||||||
int.TryParse(matchCollection[0].Groups["airyear"].Value, out var airYear);
|
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;
|
ParsedEpisodeInfo result;
|
||||||
|
|
||||||
|
|
|
@ -571,7 +571,7 @@ namespace NzbDrone.Core.Parser
|
||||||
{
|
{
|
||||||
if (series.UseSceneNumbering && sceneSource)
|
if (series.UseSceneNumbering && sceneSource)
|
||||||
{
|
{
|
||||||
List<Episode> episodes = new List<Episode>();
|
var episodes = new List<Episode>();
|
||||||
|
|
||||||
if (searchCriteria != null)
|
if (searchCriteria != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NzbDrone.Common.Cache;
|
using NzbDrone.Common.Cache;
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace NzbDrone.Core.Qualities
|
||||||
unchecked
|
unchecked
|
||||||
{
|
{
|
||||||
// Overflow is fine, just wrap
|
// Overflow is fine, just wrap
|
||||||
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;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NzbDrone.Common.EnsureThat;
|
using NzbDrone.Common.EnsureThat;
|
||||||
using NzbDrone.Core.Profiles.Qualities;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
|
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -148,7 +148,7 @@ namespace NzbDrone.Core.RootFolders
|
||||||
|
|
||||||
if (subFolderDepth > 0)
|
if (subFolderDepth > 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < subFolderDepth; i++)
|
for (var i = 0; i < subFolderDepth; i++)
|
||||||
{
|
{
|
||||||
possibleSeriesFolders = possibleSeriesFolders.SelectMany(_diskProvider.GetDirectories).ToList();
|
possibleSeriesFolders = possibleSeriesFolders.SelectMany(_diskProvider.GetDirectories).ToList();
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue