Inline 'out' variable declarations
This commit is contained in:
parent
909f2ded6b
commit
281add47de
|
@ -47,8 +47,7 @@ namespace NzbDrone.Common.Cache
|
||||||
|
|
||||||
public T Find(string key)
|
public T Find(string key)
|
||||||
{
|
{
|
||||||
CacheItem cacheItem;
|
if (!_store.TryGetValue(key, out var cacheItem))
|
||||||
if (!_store.TryGetValue(key, out cacheItem))
|
|
||||||
{
|
{
|
||||||
return default(T);
|
return default(T);
|
||||||
}
|
}
|
||||||
|
@ -76,8 +75,7 @@ namespace NzbDrone.Common.Cache
|
||||||
|
|
||||||
public void Remove(string key)
|
public void Remove(string key)
|
||||||
{
|
{
|
||||||
CacheItem value;
|
_store.TryRemove(key, out _);
|
||||||
_store.TryRemove(key, out value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Count => _store.Count;
|
public int Count => _store.Count;
|
||||||
|
@ -88,9 +86,7 @@ namespace NzbDrone.Common.Cache
|
||||||
|
|
||||||
lifeTime = lifeTime ?? _defaultLifeTime;
|
lifeTime = lifeTime ?? _defaultLifeTime;
|
||||||
|
|
||||||
CacheItem cacheItem;
|
if (_store.TryGetValue(key, out var cacheItem) && !cacheItem.IsExpired())
|
||||||
|
|
||||||
if (_store.TryGetValue(key, out cacheItem) && !cacheItem.IsExpired())
|
|
||||||
{
|
{
|
||||||
if (_rollingExpiry && lifeTime.HasValue)
|
if (_rollingExpiry && lifeTime.HasValue)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
@ -86,9 +86,7 @@ namespace NzbDrone.Common.Cache
|
||||||
{
|
{
|
||||||
RefreshIfExpired();
|
RefreshIfExpired();
|
||||||
|
|
||||||
TValue result;
|
if (!_items.TryGetValue(key, out var result))
|
||||||
|
|
||||||
if (!_items.TryGetValue(key, out result))
|
|
||||||
{
|
{
|
||||||
throw new KeyNotFoundException(string.Format("Item {0} not found in cache.", key));
|
throw new KeyNotFoundException(string.Format("Item {0} not found in cache.", key));
|
||||||
}
|
}
|
||||||
|
@ -100,9 +98,7 @@ namespace NzbDrone.Common.Cache
|
||||||
{
|
{
|
||||||
RefreshIfExpired();
|
RefreshIfExpired();
|
||||||
|
|
||||||
TValue result;
|
_items.TryGetValue(key, out var result);
|
||||||
|
|
||||||
_items.TryGetValue(key, out result);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -128,8 +124,7 @@ namespace NzbDrone.Common.Cache
|
||||||
|
|
||||||
public void Remove(string key)
|
public void Remove(string key)
|
||||||
{
|
{
|
||||||
TValue item;
|
_items.TryRemove(key, out _);
|
||||||
_items.TryRemove(key, out item);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,7 @@ namespace NzbDrone.Common.Extensions
|
||||||
{
|
{
|
||||||
public static int? ParseInt32(this string source)
|
public static int? ParseInt32(this string source)
|
||||||
{
|
{
|
||||||
int result;
|
if (int.TryParse(source, out var result))
|
||||||
|
|
||||||
if (int.TryParse(source, out result))
|
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -18,9 +16,7 @@ namespace NzbDrone.Common.Extensions
|
||||||
|
|
||||||
public static long? ParseInt64(this string source)
|
public static long? ParseInt64(this string source)
|
||||||
{
|
{
|
||||||
long result;
|
if (long.TryParse(source, out var result))
|
||||||
|
|
||||||
if (long.TryParse(source, out result))
|
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -30,9 +26,7 @@ namespace NzbDrone.Common.Extensions
|
||||||
|
|
||||||
public static double? ParseDouble(this string source)
|
public static double? ParseDouble(this string source)
|
||||||
{
|
{
|
||||||
double result;
|
if (double.TryParse(source.Replace(',', '.'), NumberStyles.Number, CultureInfo.InvariantCulture, out var result))
|
||||||
|
|
||||||
if (double.TryParse(source.Replace(',', '.'), NumberStyles.Number, CultureInfo.InvariantCulture, out result))
|
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,14 +12,12 @@ namespace NzbDrone.Common.Http
|
||||||
if (response.Headers.ContainsKey("Retry-After"))
|
if (response.Headers.ContainsKey("Retry-After"))
|
||||||
{
|
{
|
||||||
var retryAfter = response.Headers["Retry-After"].ToString();
|
var retryAfter = response.Headers["Retry-After"].ToString();
|
||||||
int seconds;
|
|
||||||
DateTime date;
|
|
||||||
|
|
||||||
if (int.TryParse(retryAfter, out seconds))
|
if (int.TryParse(retryAfter, out var seconds))
|
||||||
{
|
{
|
||||||
RetryAfter = TimeSpan.FromSeconds(seconds);
|
RetryAfter = TimeSpan.FromSeconds(seconds);
|
||||||
}
|
}
|
||||||
else if (DateTime.TryParse(retryAfter, out date))
|
else if (DateTime.TryParse(retryAfter, out var date))
|
||||||
{
|
{
|
||||||
RetryAfter = date.ToUniversalTime() - DateTime.UtcNow;
|
RetryAfter = date.ToUniversalTime() - DateTime.UtcNow;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,8 +108,7 @@ namespace NzbDrone.Core.Configuration
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
object currentValue;
|
allWithDefaults.TryGetValue(configValue.Key, out var currentValue);
|
||||||
allWithDefaults.TryGetValue(configValue.Key, out currentValue);
|
|
||||||
if (currentValue == null)
|
if (currentValue == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -57,8 +57,7 @@ namespace NzbDrone.Core.Configuration
|
||||||
|
|
||||||
foreach (var configValue in configValues)
|
foreach (var configValue in configValues)
|
||||||
{
|
{
|
||||||
object currentValue;
|
allWithDefaults.TryGetValue(configValue.Key, out var currentValue);
|
||||||
allWithDefaults.TryGetValue(configValue.Key, out currentValue);
|
|
||||||
if (currentValue == null || configValue.Value == null)
|
if (currentValue == null || configValue.Value == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -397,9 +396,7 @@ namespace NzbDrone.Core.Configuration
|
||||||
|
|
||||||
EnsureCache();
|
EnsureCache();
|
||||||
|
|
||||||
string dbValue;
|
if (_cache.TryGetValue(key, out var dbValue) && dbValue != null && !string.IsNullOrEmpty(dbValue))
|
||||||
|
|
||||||
if (_cache.TryGetValue(key, out dbValue) && dbValue != null && !string.IsNullOrEmpty(dbValue))
|
|
||||||
{
|
{
|
||||||
return dbValue;
|
return dbValue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
@ -49,8 +49,7 @@ namespace NzbDrone.Core.DataAugmentation.Xem
|
||||||
|
|
||||||
return response.Data.Select(d =>
|
return response.Data.Select(d =>
|
||||||
{
|
{
|
||||||
int tvdbId = 0;
|
int.TryParse(d, out var tvdbId);
|
||||||
int.TryParse(d, out tvdbId);
|
|
||||||
|
|
||||||
return tvdbId;
|
return tvdbId;
|
||||||
}).Where(t => t > 0).ToList();
|
}).Where(t => t > 0).ToList();
|
||||||
|
@ -89,8 +88,7 @@ namespace NzbDrone.Core.DataAugmentation.Xem
|
||||||
{
|
{
|
||||||
foreach (var n in name)
|
foreach (var n in name)
|
||||||
{
|
{
|
||||||
int seasonNumber;
|
if (!int.TryParse(n.Value.ToString(), out var seasonNumber))
|
||||||
if (!int.TryParse(n.Value.ToString(), out seasonNumber))
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,9 +82,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
{
|
{
|
||||||
var qualityJson = qualityModelReader.GetString(0);
|
var qualityJson = qualityModelReader.GetString(0);
|
||||||
|
|
||||||
SourceQualityModel036 sourceQuality;
|
if (!Json.TryDeserialize<SourceQualityModel036>(qualityJson, out var sourceQuality))
|
||||||
|
|
||||||
if (!Json.TryDeserialize<SourceQualityModel036>(qualityJson, out sourceQuality))
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -37,9 +37,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
{
|
{
|
||||||
var qualityJson = qualityModelReader.GetString(0);
|
var qualityJson = qualityModelReader.GetString(0);
|
||||||
|
|
||||||
LegacyQualityModel062 quality;
|
if (!Json.TryDeserialize<LegacyQualityModel062>(qualityJson, out var quality))
|
||||||
|
|
||||||
if (!Json.TryDeserialize<LegacyQualityModel062>(qualityJson, out quality))
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,9 +257,8 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||||
protected long GetRemainingSize(DownloadStationTask torrent)
|
protected long GetRemainingSize(DownloadStationTask torrent)
|
||||||
{
|
{
|
||||||
var downloadedString = torrent.Additional.Transfer["size_downloaded"];
|
var downloadedString = torrent.Additional.Transfer["size_downloaded"];
|
||||||
long downloadedSize;
|
|
||||||
|
|
||||||
if (downloadedString.IsNullOrWhiteSpace() || !long.TryParse(downloadedString, out downloadedSize))
|
if (downloadedString.IsNullOrWhiteSpace() || !long.TryParse(downloadedString, out var downloadedSize))
|
||||||
{
|
{
|
||||||
_logger.Debug("Torrent {0} has invalid size_downloaded: {1}", torrent.Title, downloadedString);
|
_logger.Debug("Torrent {0} has invalid size_downloaded: {1}", torrent.Title, downloadedString);
|
||||||
downloadedSize = 0;
|
downloadedSize = 0;
|
||||||
|
@ -271,9 +270,8 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||||
protected TimeSpan? GetRemainingTime(DownloadStationTask torrent)
|
protected TimeSpan? GetRemainingTime(DownloadStationTask torrent)
|
||||||
{
|
{
|
||||||
var speedString = torrent.Additional.Transfer["speed_download"];
|
var speedString = torrent.Additional.Transfer["speed_download"];
|
||||||
long downloadSpeed;
|
|
||||||
|
|
||||||
if (speedString.IsNullOrWhiteSpace() || !long.TryParse(speedString, out downloadSpeed))
|
if (speedString.IsNullOrWhiteSpace() || !long.TryParse(speedString, out var downloadSpeed))
|
||||||
{
|
{
|
||||||
_logger.Debug("Torrent {0} has invalid speed_download: {1}", torrent.Title, speedString);
|
_logger.Debug("Torrent {0} has invalid speed_download: {1}", torrent.Title, speedString);
|
||||||
downloadSpeed = 0;
|
downloadSpeed = 0;
|
||||||
|
|
|
@ -354,9 +354,8 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||||
protected long GetRemainingSize(DownloadStationTask task)
|
protected long GetRemainingSize(DownloadStationTask task)
|
||||||
{
|
{
|
||||||
var downloadedString = task.Additional.Transfer["size_downloaded"];
|
var downloadedString = task.Additional.Transfer["size_downloaded"];
|
||||||
long downloadedSize;
|
|
||||||
|
|
||||||
if (downloadedString.IsNullOrWhiteSpace() || !long.TryParse(downloadedString, out downloadedSize))
|
if (downloadedString.IsNullOrWhiteSpace() || !long.TryParse(downloadedString, out var downloadedSize))
|
||||||
{
|
{
|
||||||
_logger.Debug("Task {0} has invalid size_downloaded: {1}", task.Title, downloadedString);
|
_logger.Debug("Task {0} has invalid size_downloaded: {1}", task.Title, downloadedString);
|
||||||
downloadedSize = 0;
|
downloadedSize = 0;
|
||||||
|
@ -368,9 +367,8 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||||
protected long GetDownloadSpeed(DownloadStationTask task)
|
protected long GetDownloadSpeed(DownloadStationTask task)
|
||||||
{
|
{
|
||||||
var speedString = task.Additional.Transfer["speed_download"];
|
var speedString = task.Additional.Transfer["speed_download"];
|
||||||
long downloadSpeed;
|
|
||||||
|
|
||||||
if (speedString.IsNullOrWhiteSpace() || !long.TryParse(speedString, out downloadSpeed))
|
if (speedString.IsNullOrWhiteSpace() || !long.TryParse(speedString, out var downloadSpeed))
|
||||||
{
|
{
|
||||||
_logger.Debug("Task {0} has invalid speed_download: {1}", task.Title, speedString);
|
_logger.Debug("Task {0} has invalid speed_download: {1}", task.Title, speedString);
|
||||||
downloadSpeed = 0;
|
downloadSpeed = 0;
|
||||||
|
|
|
@ -15,8 +15,7 @@ namespace NzbDrone.Core.Download.Clients.NzbVortex.JsonConverters
|
||||||
{
|
{
|
||||||
var result = reader.Value.ToString().Replace("_", string.Empty);
|
var result = reader.Value.ToString().Replace("_", string.Empty);
|
||||||
|
|
||||||
NzbVortexLoginResultType output;
|
Enum.TryParse(result, true, out NzbVortexLoginResultType output);
|
||||||
Enum.TryParse(result, true, out output);
|
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,7 @@ namespace NzbDrone.Core.Download.Clients.NzbVortex.JsonConverters
|
||||||
{
|
{
|
||||||
var result = reader.Value.ToString().Replace("_", string.Empty);
|
var result = reader.Value.ToString().Replace("_", string.Empty);
|
||||||
|
|
||||||
NzbVortexResultType output;
|
Enum.TryParse(result, true, out NzbVortexResultType output);
|
||||||
Enum.TryParse(result, true, out output);
|
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,9 +112,8 @@ namespace NzbDrone.Core.Download.Clients.NzbVortex
|
||||||
public override void RemoveItem(DownloadClientItem item, bool deleteData)
|
public override void RemoveItem(DownloadClientItem item, bool deleteData)
|
||||||
{
|
{
|
||||||
// Try to find the download by numerical ID, otherwise try by AddUUID
|
// Try to find the download by numerical ID, otherwise try by AddUUID
|
||||||
int id;
|
|
||||||
|
|
||||||
if (int.TryParse(item.DownloadId, out id))
|
if (int.TryParse(item.DownloadId, out var id))
|
||||||
{
|
{
|
||||||
_proxy.Remove(id, deleteData, Settings);
|
_proxy.Remove(id, deleteData, Settings);
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,8 +309,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
|
||||||
var config = _proxy.GetConfig(Settings);
|
var config = _proxy.GetConfig(Settings);
|
||||||
|
|
||||||
var keepHistory = config.GetValueOrDefault("KeepHistory", "7");
|
var keepHistory = config.GetValueOrDefault("KeepHistory", "7");
|
||||||
int value;
|
if (!int.TryParse(keepHistory, NumberStyles.None, CultureInfo.InvariantCulture, out var value) || value == 0)
|
||||||
if (!int.TryParse(keepHistory, NumberStyles.None, CultureInfo.InvariantCulture, out value) || value == 0)
|
|
||||||
{
|
{
|
||||||
return new NzbDroneValidationFailure(string.Empty, "NzbGet setting KeepHistory should be greater than 0")
|
return new NzbDroneValidationFailure(string.Empty, "NzbGet setting KeepHistory should be greater than 0")
|
||||||
{
|
{
|
||||||
|
|
|
@ -165,11 +165,10 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
|
||||||
var queue = GetQueue(settings);
|
var queue = GetQueue(settings);
|
||||||
var history = GetHistory(settings);
|
var history = GetHistory(settings);
|
||||||
|
|
||||||
int nzbId;
|
|
||||||
NzbgetQueueItem queueItem;
|
NzbgetQueueItem queueItem;
|
||||||
NzbgetHistoryItem historyItem;
|
NzbgetHistoryItem historyItem;
|
||||||
|
|
||||||
if (id.Length < 10 && int.TryParse(id, out nzbId))
|
if (id.Length < 10 && int.TryParse(id, out var nzbId))
|
||||||
{
|
{
|
||||||
// Download wasn't grabbed by Sonarr, so the id is the NzbId reported by nzbget.
|
// Download wasn't grabbed by Sonarr, so the id is the NzbId reported by nzbget.
|
||||||
queueItem = queue.SingleOrDefault(h => h.NzbId == nzbId);
|
queueItem = queue.SingleOrDefault(h => h.NzbId == nzbId);
|
||||||
|
|
|
@ -15,8 +15,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd.JsonConverters
|
||||||
{
|
{
|
||||||
var queuePriority = reader.Value.ToString();
|
var queuePriority = reader.Value.ToString();
|
||||||
|
|
||||||
SabnzbdPriority output;
|
Enum.TryParse(queuePriority, out SabnzbdPriority output);
|
||||||
Enum.TryParse(queuePriority, out output);
|
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,9 +51,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
|
||||||
|
|
||||||
request.AddFormUpload("name", filename, nzbData, "application/x-nzb");
|
request.AddFormUpload("name", filename, nzbData, "application/x-nzb");
|
||||||
|
|
||||||
SabnzbdAddResponse response;
|
if (!Json.TryDeserialize<SabnzbdAddResponse>(ProcessRequest(request, settings), out var response))
|
||||||
|
|
||||||
if (!Json.TryDeserialize<SabnzbdAddResponse>(ProcessRequest(request, settings), out response))
|
|
||||||
{
|
{
|
||||||
response = new SabnzbdAddResponse();
|
response = new SabnzbdAddResponse();
|
||||||
response.Status = true;
|
response.Status = true;
|
||||||
|
@ -76,9 +74,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
|
||||||
{
|
{
|
||||||
var request = BuildRequest("version", settings);
|
var request = BuildRequest("version", settings);
|
||||||
|
|
||||||
SabnzbdVersionResponse response;
|
if (!Json.TryDeserialize<SabnzbdVersionResponse>(ProcessRequest(request, settings), out var response))
|
||||||
|
|
||||||
if (!Json.TryDeserialize<SabnzbdVersionResponse>(ProcessRequest(request, settings), out response))
|
|
||||||
{
|
{
|
||||||
response = new SabnzbdVersionResponse();
|
response = new SabnzbdVersionResponse();
|
||||||
}
|
}
|
||||||
|
@ -142,9 +138,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
|
||||||
var request = BuildRequest("retry", settings);
|
var request = BuildRequest("retry", settings);
|
||||||
request.AddQueryParam("value", id);
|
request.AddQueryParam("value", id);
|
||||||
|
|
||||||
SabnzbdRetryResponse response;
|
if (!Json.TryDeserialize<SabnzbdRetryResponse>(ProcessRequest(request, settings), out var response))
|
||||||
|
|
||||||
if (!Json.TryDeserialize<SabnzbdRetryResponse>(ProcessRequest(request, settings), out response))
|
|
||||||
{
|
{
|
||||||
response = new SabnzbdRetryResponse();
|
response = new SabnzbdRetryResponse();
|
||||||
response.Status = true;
|
response.Status = true;
|
||||||
|
@ -215,9 +209,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
|
||||||
|
|
||||||
private void CheckForError(HttpResponse response)
|
private void CheckForError(HttpResponse response)
|
||||||
{
|
{
|
||||||
SabnzbdJsonError result;
|
if (!Json.TryDeserialize<SabnzbdJsonError>(response.Content, out var result))
|
||||||
|
|
||||||
if (!Json.TryDeserialize<SabnzbdJsonError>(response.Content, out result))
|
|
||||||
{
|
{
|
||||||
// Handle plain text responses from SAB
|
// Handle plain text responses from SAB
|
||||||
result = new SabnzbdJsonError();
|
result = new SabnzbdJsonError();
|
||||||
|
|
|
@ -54,8 +54,7 @@ namespace NzbDrone.Core.Download.Clients.Vuze
|
||||||
|
|
||||||
_logger.Debug("Vuze protocol version information: {0}", versionString);
|
_logger.Debug("Vuze protocol version information: {0}", versionString);
|
||||||
|
|
||||||
int version;
|
if (!int.TryParse(versionString, out var version) || version < MINIMUM_SUPPORTED_PROTOCOL_VERSION)
|
||||||
if (!int.TryParse(versionString, out version) || version < MINIMUM_SUPPORTED_PROTOCOL_VERSION)
|
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
return new ValidationFailure(string.Empty, "Protocol version not supported, use Vuze 5.0.0.0 or higher with Vuze Web Remote plugin.");
|
return new ValidationFailure(string.Empty, "Protocol version not supported, use Vuze 5.0.0.0 or higher with Vuze Web Remote plugin.");
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using FluentValidation.Results;
|
using FluentValidation.Results;
|
||||||
|
@ -60,8 +60,7 @@ namespace NzbDrone.Core.Download
|
||||||
|
|
||||||
foreach (var client in clients)
|
foreach (var client in clients)
|
||||||
{
|
{
|
||||||
DownloadClientStatus downloadClientStatus;
|
if (blockedIndexers.TryGetValue(client.Definition.Id, out var downloadClientStatus))
|
||||||
if (blockedIndexers.TryGetValue(client.Definition.Id, out downloadClientStatus))
|
|
||||||
{
|
{
|
||||||
_logger.Debug("Temporarily ignoring download client {0} till {1} due to recent failures.", client.Definition.Name, downloadClientStatus.DisabledTill.Value.ToLocalTime());
|
_logger.Debug("Temporarily ignoring download client {0} till {1} due to recent failures.", client.Definition.Name, downloadClientStatus.DisabledTill.Value.ToLocalTime());
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -210,8 +210,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Roksbox
|
||||||
|
|
||||||
var seasonFolders = GetSeasonFolders(series);
|
var seasonFolders = GetSeasonFolders(series);
|
||||||
|
|
||||||
string seasonFolder;
|
if (!seasonFolders.TryGetValue(season.SeasonNumber, out var seasonFolder))
|
||||||
if (!seasonFolders.TryGetValue(season.SeasonNumber, out seasonFolder))
|
|
||||||
{
|
{
|
||||||
_logger.Trace("Failed to find season folder for series {0}, season {1}.", series.Title, season.SeasonNumber);
|
_logger.Trace("Failed to find season folder for series {0}, season {1}.", series.Title, season.SeasonNumber);
|
||||||
return new List<ImageFileResult>();
|
return new List<ImageFileResult>();
|
||||||
|
@ -278,8 +277,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Roksbox
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int matchedSeason;
|
if (int.TryParse(seasonNumber, out var matchedSeason))
|
||||||
if (int.TryParse(seasonNumber, out matchedSeason))
|
|
||||||
{
|
{
|
||||||
seasonFolderMap[matchedSeason] = folder;
|
seasonFolderMap[matchedSeason] = folder;
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,8 +203,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Wdtv
|
||||||
var seasonFolders = GetSeasonFolders(series);
|
var seasonFolders = GetSeasonFolders(series);
|
||||||
|
|
||||||
// Work out the path to this season - if we don't have a matching path then skip this season.
|
// Work out the path to this season - if we don't have a matching path then skip this season.
|
||||||
string seasonFolder;
|
if (!seasonFolders.TryGetValue(season.SeasonNumber, out var seasonFolder))
|
||||||
if (!seasonFolders.TryGetValue(season.SeasonNumber, out seasonFolder))
|
|
||||||
{
|
{
|
||||||
_logger.Trace("Failed to find season folder for series {0}, season {1}.", series.Title, season.SeasonNumber);
|
_logger.Trace("Failed to find season folder for series {0}, season {1}.", series.Title, season.SeasonNumber);
|
||||||
return new List<ImageFileResult>();
|
return new List<ImageFileResult>();
|
||||||
|
@ -270,8 +269,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Wdtv
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int matchedSeason;
|
if (int.TryParse(seasonNumber, out var matchedSeason))
|
||||||
if (int.TryParse(seasonNumber, out matchedSeason))
|
|
||||||
{
|
{
|
||||||
seasonFolderMap[matchedSeason] = folder;
|
seasonFolderMap[matchedSeason] = folder;
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,13 +94,12 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
|
||||||
metadata.Type = MetadataType.SeasonImage;
|
metadata.Type = MetadataType.SeasonImage;
|
||||||
|
|
||||||
var seasonNumberMatch = seasonMatch.Groups["season"].Value;
|
var seasonNumberMatch = seasonMatch.Groups["season"].Value;
|
||||||
int seasonNumber;
|
|
||||||
|
|
||||||
if (seasonNumberMatch.Contains("specials"))
|
if (seasonNumberMatch.Contains("specials"))
|
||||||
{
|
{
|
||||||
metadata.SeasonNumber = 0;
|
metadata.SeasonNumber = 0;
|
||||||
}
|
}
|
||||||
else if (int.TryParse(seasonNumberMatch, out seasonNumber))
|
else if (int.TryParse(seasonNumberMatch, out var seasonNumber))
|
||||||
{
|
{
|
||||||
metadata.SeasonNumber = seasonNumber;
|
metadata.SeasonNumber = seasonNumber;
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,8 +153,7 @@ namespace NzbDrone.Core.HealthCheck
|
||||||
_isRunningHealthChecksAfterGracePeriod = false;
|
_isRunningHealthChecksAfterGracePeriod = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
IEventDrivenHealthCheck[] checks;
|
if (!_eventDrivenHealthChecks.TryGetValue(message.GetType(), out var checks))
|
||||||
if (!_eventDrivenHealthChecks.TryGetValue(message.GetType(), out checks))
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,8 +61,7 @@ namespace NzbDrone.Core.ImportLists
|
||||||
|
|
||||||
foreach (var importList in importLists)
|
foreach (var importList in importLists)
|
||||||
{
|
{
|
||||||
ImportListStatus blockedImportListStatus;
|
if (blockedImportLists.TryGetValue(importList.Definition.Id, out var blockedImportListStatus))
|
||||||
if (blockedImportLists.TryGetValue(importList.Definition.Id, out blockedImportListStatus))
|
|
||||||
{
|
{
|
||||||
_logger.Debug("Temporarily ignoring import list {0} till {1} due to recent failures.", importList.Definition.Name, blockedImportListStatus.DisabledTill.Value.ToLocalTime());
|
_logger.Debug("Temporarily ignoring import list {0} till {1} due to recent failures.", importList.Definition.Name, blockedImportListStatus.DisabledTill.Value.ToLocalTime());
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -26,10 +26,9 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
|
||||||
var releaseInfo = _indexerStatusService.GetLastRssSyncReleaseInfo(Definition.Id);
|
var releaseInfo = _indexerStatusService.GetLastRssSyncReleaseInfo(Definition.Id);
|
||||||
if (releaseInfo != null)
|
if (releaseInfo != null)
|
||||||
{
|
{
|
||||||
int torrentID;
|
if (int.TryParse(releaseInfo.Guid.Replace("BTN-", string.Empty), out var torrentId))
|
||||||
if (int.TryParse(releaseInfo.Guid.Replace("BTN-", string.Empty), out torrentID))
|
|
||||||
{
|
{
|
||||||
requestGenerator.LastRecentTorrentID = torrentID;
|
requestGenerator.LastRecentTorrentID = torrentId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,8 +88,7 @@ namespace NzbDrone.Core.Indexers
|
||||||
|
|
||||||
foreach (var indexer in indexers)
|
foreach (var indexer in indexers)
|
||||||
{
|
{
|
||||||
IndexerStatus blockedIndexerStatus;
|
if (blockedIndexers.TryGetValue(indexer.Definition.Id, out var blockedIndexerStatus))
|
||||||
if (blockedIndexers.TryGetValue(indexer.Definition.Id, out blockedIndexerStatus))
|
|
||||||
{
|
{
|
||||||
_logger.Debug("Temporarily ignoring indexer {0} till {1} due to recent failures.", indexer.Definition.Name, blockedIndexerStatus.DisabledTill.Value.ToLocalTime());
|
_logger.Debug("Temporarily ignoring indexer {0} till {1} due to recent failures.", indexer.Definition.Name, blockedIndexerStatus.DisabledTill.Value.ToLocalTime());
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -129,10 +129,8 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||||
|
|
||||||
protected override long GetSize(XElement item)
|
protected override long GetSize(XElement item)
|
||||||
{
|
{
|
||||||
long size;
|
|
||||||
|
|
||||||
var sizeString = TryGetNewznabAttribute(item, "size");
|
var sizeString = TryGetNewznabAttribute(item, "size");
|
||||||
if (!sizeString.IsNullOrWhiteSpace() && long.TryParse(sizeString, out size))
|
if (!sizeString.IsNullOrWhiteSpace() && long.TryParse(sizeString, out var size))
|
||||||
{
|
{
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
@ -156,9 +154,8 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||||
protected virtual int GetTvdbId(XElement item)
|
protected virtual int GetTvdbId(XElement item)
|
||||||
{
|
{
|
||||||
var tvdbIdString = TryGetNewznabAttribute(item, "tvdbid");
|
var tvdbIdString = TryGetNewznabAttribute(item, "tvdbid");
|
||||||
int tvdbId;
|
|
||||||
|
|
||||||
if (!tvdbIdString.IsNullOrWhiteSpace() && int.TryParse(tvdbIdString, out tvdbId))
|
if (!tvdbIdString.IsNullOrWhiteSpace() && int.TryParse(tvdbIdString, out var tvdbId))
|
||||||
{
|
{
|
||||||
return tvdbId;
|
return tvdbId;
|
||||||
}
|
}
|
||||||
|
@ -169,9 +166,8 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||||
protected virtual int GetTvRageId(XElement item)
|
protected virtual int GetTvRageId(XElement item)
|
||||||
{
|
{
|
||||||
var tvRageIdString = TryGetNewznabAttribute(item, "rageid");
|
var tvRageIdString = TryGetNewznabAttribute(item, "rageid");
|
||||||
int tvRageId;
|
|
||||||
|
|
||||||
if (!tvRageIdString.IsNullOrWhiteSpace() && int.TryParse(tvRageIdString, out tvRageId))
|
if (!tvRageIdString.IsNullOrWhiteSpace() && int.TryParse(tvRageIdString, out var tvRageId))
|
||||||
{
|
{
|
||||||
return tvRageId;
|
return tvRageId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,10 +120,8 @@ namespace NzbDrone.Core.Indexers.Torznab
|
||||||
|
|
||||||
protected override long GetSize(XElement item)
|
protected override long GetSize(XElement item)
|
||||||
{
|
{
|
||||||
long size;
|
|
||||||
|
|
||||||
var sizeString = TryGetTorznabAttribute(item, "size");
|
var sizeString = TryGetTorznabAttribute(item, "size");
|
||||||
if (!sizeString.IsNullOrWhiteSpace() && long.TryParse(sizeString, out size))
|
if (!sizeString.IsNullOrWhiteSpace() && long.TryParse(sizeString, out var size))
|
||||||
{
|
{
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
@ -153,9 +151,8 @@ namespace NzbDrone.Core.Indexers.Torznab
|
||||||
protected virtual int GetTvdbId(XElement item)
|
protected virtual int GetTvdbId(XElement item)
|
||||||
{
|
{
|
||||||
var tvdbIdString = TryGetTorznabAttribute(item, "tvdbid");
|
var tvdbIdString = TryGetTorznabAttribute(item, "tvdbid");
|
||||||
int tvdbId;
|
|
||||||
|
|
||||||
if (!tvdbIdString.IsNullOrWhiteSpace() && int.TryParse(tvdbIdString, out tvdbId))
|
if (!tvdbIdString.IsNullOrWhiteSpace() && int.TryParse(tvdbIdString, out var tvdbId))
|
||||||
{
|
{
|
||||||
return tvdbId;
|
return tvdbId;
|
||||||
}
|
}
|
||||||
|
@ -166,9 +163,8 @@ namespace NzbDrone.Core.Indexers.Torznab
|
||||||
protected virtual int GetTvRageId(XElement item)
|
protected virtual int GetTvRageId(XElement item)
|
||||||
{
|
{
|
||||||
var tvRageIdString = TryGetTorznabAttribute(item, "rageid");
|
var tvRageIdString = TryGetTorznabAttribute(item, "rageid");
|
||||||
int tvRageId;
|
|
||||||
|
|
||||||
if (!tvRageIdString.IsNullOrWhiteSpace() && int.TryParse(tvRageIdString, out tvRageId))
|
if (!tvRageIdString.IsNullOrWhiteSpace() && int.TryParse(tvRageIdString, out var tvRageId))
|
||||||
{
|
{
|
||||||
return tvRageId;
|
return tvRageId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -39,8 +39,7 @@ namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DateTime result;
|
if (!DateTime.TryParse(dateString, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AssumeUniversal, out var result))
|
||||||
if (!DateTime.TryParse(dateString, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AssumeUniversal, out result))
|
|
||||||
{
|
{
|
||||||
dateString = RemoveTimeZoneRegex.Replace(dateString, "");
|
dateString = RemoveTimeZoneRegex.Replace(dateString, "");
|
||||||
result = DateTime.Parse(dateString, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AssumeUniversal);
|
result = DateTime.Parse(dateString, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AssumeUniversal);
|
||||||
|
|
|
@ -81,9 +81,7 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
|
|
||||||
private bool ChangeFileDateToLocalAirDate(string filePath, string fileDate, string fileTime)
|
private bool ChangeFileDateToLocalAirDate(string filePath, string fileDate, string fileTime)
|
||||||
{
|
{
|
||||||
DateTime airDate;
|
if (DateTime.TryParse(fileDate + ' ' + fileTime, out var airDate))
|
||||||
|
|
||||||
if (DateTime.TryParse(fileDate + ' ' + fileTime, out 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);
|
DateTime oldDateTime = _diskProvider.FileGetLastWrite(filePath);
|
||||||
|
|
|
@ -75,8 +75,7 @@ namespace NzbDrone.Core.Messaging.Events
|
||||||
EventSubscribers<TEvent> subscribers;
|
EventSubscribers<TEvent> subscribers;
|
||||||
lock (_eventSubscribers)
|
lock (_eventSubscribers)
|
||||||
{
|
{
|
||||||
object target;
|
if (!_eventSubscribers.TryGetValue(eventName, out var target))
|
||||||
if (!_eventSubscribers.TryGetValue(eventName, out target))
|
|
||||||
{
|
{
|
||||||
_eventSubscribers[eventName] = target = new EventSubscribers<TEvent>(_serviceFactory);
|
_eventSubscribers[eventName] = target = new EventSubscribers<TEvent>(_serviceFactory);
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,9 +93,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
{
|
{
|
||||||
var slug = lowerTitle.Split(':')[1].Trim();
|
var slug = lowerTitle.Split(':')[1].Trim();
|
||||||
|
|
||||||
int tvdbId;
|
if (slug.IsNullOrWhiteSpace() || slug.Any(char.IsWhiteSpace) || !int.TryParse(slug, out var tvdbId) || tvdbId <= 0)
|
||||||
|
|
||||||
if (slug.IsNullOrWhiteSpace() || slug.Any(char.IsWhiteSpace) || !int.TryParse(slug, out tvdbId) || tvdbId <= 0)
|
|
||||||
{
|
{
|
||||||
return new List<Series>();
|
return new List<Series>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,9 +30,7 @@ namespace NzbDrone.Core.Notifications.Plex.PlexTv
|
||||||
var request = BuildRequest(clientIdentifier);
|
var request = BuildRequest(clientIdentifier);
|
||||||
request.ResourceUrl = $"/api/v2/pins/{pinId}";
|
request.ResourceUrl = $"/api/v2/pins/{pinId}";
|
||||||
|
|
||||||
PlexTvPinResponse response;
|
if (!Json.TryDeserialize<PlexTvPinResponse>(ProcessRequest(request), out var response))
|
||||||
|
|
||||||
if (!Json.TryDeserialize<PlexTvPinResponse>(ProcessRequest(request), out response))
|
|
||||||
{
|
{
|
||||||
response = new PlexTvPinResponse();
|
response = new PlexTvPinResponse();
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,14 +152,13 @@ namespace NzbDrone.Core.Notifications.PushBullet
|
||||||
private HttpRequestBuilder BuildDeviceRequest(string deviceId)
|
private HttpRequestBuilder BuildDeviceRequest(string deviceId)
|
||||||
{
|
{
|
||||||
var requestBuilder = new HttpRequestBuilder(PUSH_URL).Post();
|
var requestBuilder = new HttpRequestBuilder(PUSH_URL).Post();
|
||||||
long integerId;
|
|
||||||
|
|
||||||
if (deviceId.IsNullOrWhiteSpace())
|
if (deviceId.IsNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
return requestBuilder;
|
return requestBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (long.TryParse(deviceId, out integerId))
|
if (long.TryParse(deviceId, out var integerId))
|
||||||
{
|
{
|
||||||
requestBuilder.AddFormParameter("device_id", integerId);
|
requestBuilder.AddFormParameter("device_id", integerId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,8 +67,7 @@ namespace NzbDrone.Core.Notifications.Xbmc
|
||||||
|
|
||||||
var matchingSeries = allSeries.FirstOrDefault(s =>
|
var matchingSeries = allSeries.FirstOrDefault(s =>
|
||||||
{
|
{
|
||||||
var tvdbId = 0;
|
int.TryParse(s.ImdbNumber, out var tvdbId);
|
||||||
int.TryParse(s.ImdbNumber, out tvdbId);
|
|
||||||
|
|
||||||
return tvdbId == series.TvdbId || s.Label == series.Title;
|
return tvdbId == series.TvdbId || s.Label == series.Title;
|
||||||
});
|
});
|
||||||
|
|
|
@ -735,10 +735,8 @@ namespace NzbDrone.Core.Parser
|
||||||
|
|
||||||
public static string CleanSeriesTitle(this string title)
|
public static string CleanSeriesTitle(this string title)
|
||||||
{
|
{
|
||||||
long number = 0;
|
|
||||||
|
|
||||||
// If Title only contains numbers return it as is.
|
// If Title only contains numbers return it as is.
|
||||||
if (long.TryParse(title, out number))
|
if (long.TryParse(title, out _))
|
||||||
{
|
{
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
@ -840,9 +838,8 @@ namespace NzbDrone.Core.Parser
|
||||||
if (matches.Count != 0)
|
if (matches.Count != 0)
|
||||||
{
|
{
|
||||||
var group = matches.OfType<Match>().Last().Groups["releasegroup"].Value;
|
var group = matches.OfType<Match>().Last().Groups["releasegroup"].Value;
|
||||||
int groupIsNumeric;
|
|
||||||
|
|
||||||
if (int.TryParse(group, out groupIsNumeric))
|
if (int.TryParse(group, out _))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -906,8 +903,7 @@ namespace NzbDrone.Core.Parser
|
||||||
var seriesName = matchCollection[0].Groups["title"].Value.Replace('.', ' ').Replace('_', ' ');
|
var seriesName = matchCollection[0].Groups["title"].Value.Replace('.', ' ').Replace('_', ' ');
|
||||||
seriesName = RequestInfoRegex.Replace(seriesName, "").Trim(' ');
|
seriesName = RequestInfoRegex.Replace(seriesName, "").Trim(' ');
|
||||||
|
|
||||||
int airYear;
|
int.TryParse(matchCollection[0].Groups["airyear"].Value, out var airYear);
|
||||||
int.TryParse(matchCollection[0].Groups["airyear"].Value, out airYear);
|
|
||||||
|
|
||||||
int lastSeasonEpisodeStringIndex = matchCollection[0].Groups["title"].EndIndex();
|
int lastSeasonEpisodeStringIndex = matchCollection[0].Groups["title"].EndIndex();
|
||||||
|
|
||||||
|
@ -1009,8 +1005,7 @@ namespace NzbDrone.Core.Parser
|
||||||
|
|
||||||
foreach (Capture seasonCapture in matchCollection[0].Groups["season"].Captures)
|
foreach (Capture seasonCapture in matchCollection[0].Groups["season"].Captures)
|
||||||
{
|
{
|
||||||
int parsedSeason;
|
if (int.TryParse(seasonCapture.Value, out var parsedSeason))
|
||||||
if (int.TryParse(seasonCapture.Value, out parsedSeason))
|
|
||||||
{
|
{
|
||||||
seasons.Add(parsedSeason);
|
seasons.Add(parsedSeason);
|
||||||
|
|
||||||
|
@ -1170,11 +1165,9 @@ namespace NzbDrone.Core.Parser
|
||||||
|
|
||||||
private static int ParseNumber(string value)
|
private static int ParseNumber(string value)
|
||||||
{
|
{
|
||||||
int number;
|
|
||||||
|
|
||||||
var normalized = value.Normalize(NormalizationForm.FormKC);
|
var normalized = value.Normalize(NormalizationForm.FormKC);
|
||||||
|
|
||||||
if (int.TryParse(normalized, out number))
|
if (int.TryParse(normalized, out var number))
|
||||||
{
|
{
|
||||||
return number;
|
return number;
|
||||||
}
|
}
|
||||||
|
@ -1191,11 +1184,9 @@ namespace NzbDrone.Core.Parser
|
||||||
|
|
||||||
private static decimal ParseDecimal(string value)
|
private static decimal ParseDecimal(string value)
|
||||||
{
|
{
|
||||||
decimal number;
|
|
||||||
|
|
||||||
var normalized = value.Normalize(NormalizationForm.FormKC);
|
var normalized = value.Normalize(NormalizationForm.FormKC);
|
||||||
|
|
||||||
if (decimal.TryParse(normalized, NumberStyles.Float, CultureInfo.InvariantCulture, out number))
|
if (decimal.TryParse(normalized, NumberStyles.Float, CultureInfo.InvariantCulture, out var number))
|
||||||
{
|
{
|
||||||
return number;
|
return number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using NzbDrone.Common.Cache;
|
using NzbDrone.Common.Cache;
|
||||||
using NzbDrone.Core.Profiles.Releases.TermMatchers;
|
using NzbDrone.Core.Profiles.Releases.TermMatchers;
|
||||||
|
|
||||||
|
@ -37,8 +36,7 @@ namespace NzbDrone.Core.Profiles.Releases
|
||||||
|
|
||||||
private ITermMatcher CreateMatcherInternal(string term)
|
private ITermMatcher CreateMatcherInternal(string term)
|
||||||
{
|
{
|
||||||
Regex regex;
|
if (PerlRegexFactory.TryCreateRegex(term, out var regex))
|
||||||
if (PerlRegexFactory.TryCreateRegex(term, out regex))
|
|
||||||
{
|
{
|
||||||
return new RegexTermMatcher(regex);
|
return new RegexTermMatcher(regex);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,8 +58,7 @@ namespace NzbDrone.Mono.Test.DiskProviderTests
|
||||||
{
|
{
|
||||||
// Remove Write permissions, we're still owner so we can clean it up, but we'll have to do that explicitly.
|
// Remove Write permissions, we're still owner so we can clean it up, but we'll have to do that explicitly.
|
||||||
|
|
||||||
Stat stat;
|
Syscall.stat(path, out var stat);
|
||||||
Syscall.stat(path, out stat);
|
|
||||||
FilePermissions mode = stat.st_mode;
|
FilePermissions mode = stat.st_mode;
|
||||||
|
|
||||||
if (writable)
|
if (writable)
|
||||||
|
|
|
@ -474,9 +474,7 @@ namespace NzbDrone.Mono.Disk
|
||||||
return UNCHANGED_ID;
|
return UNCHANGED_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint userId;
|
if (uint.TryParse(user, out var userId))
|
||||||
|
|
||||||
if (uint.TryParse(user, out userId))
|
|
||||||
{
|
{
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
@ -498,9 +496,7 @@ namespace NzbDrone.Mono.Disk
|
||||||
return UNCHANGED_ID;
|
return UNCHANGED_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint groupId;
|
if (uint.TryParse(group, out var groupId))
|
||||||
|
|
||||||
if (uint.TryParse(group, out groupId))
|
|
||||||
{
|
{
|
||||||
return groupId;
|
return groupId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using Mono.Unix;
|
using Mono.Unix;
|
||||||
using Mono.Unix.Native;
|
using Mono.Unix.Native;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
@ -83,9 +83,7 @@ namespace NzbDrone.Mono.Disk
|
||||||
|
|
||||||
private bool TryFollowFirstSymbolicLink(ref string path)
|
private bool TryFollowFirstSymbolicLink(ref string path)
|
||||||
{
|
{
|
||||||
string[] dirs;
|
GetPathComponents(path, out var dirs, out var lastIndex);
|
||||||
int lastIndex;
|
|
||||||
GetPathComponents(path, out dirs, out lastIndex);
|
|
||||||
|
|
||||||
if (lastIndex == 0)
|
if (lastIndex == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,8 +23,7 @@ namespace NzbDrone.Test.Common
|
||||||
{
|
{
|
||||||
LogManager.Configuration = new LoggingConfiguration();
|
LogManager.Configuration = new LoggingConfiguration();
|
||||||
|
|
||||||
var logOutput = TestLogOutput.Console;
|
Enum.TryParse<TestLogOutput>(Environment.GetEnvironmentVariable("SONARR_TESTS_LOG_OUTPUT"), out var logOutput);
|
||||||
Enum.TryParse<TestLogOutput>(Environment.GetEnvironmentVariable("SONARR_TESTS_LOG_OUTPUT"), out logOutput);
|
|
||||||
|
|
||||||
RegisterSentryLogger();
|
RegisterSentryLogger();
|
||||||
|
|
||||||
|
|
|
@ -100,8 +100,7 @@ namespace NzbDrone.Update
|
||||||
|
|
||||||
private int ParseProcessId(string arg)
|
private int ParseProcessId(string arg)
|
||||||
{
|
{
|
||||||
int id;
|
if (!int.TryParse(arg, out var id) || id <= 0)
|
||||||
if (!int.TryParse(arg, out id) || id <= 0)
|
|
||||||
{
|
{
|
||||||
throw new ArgumentOutOfRangeException("arg", "Invalid process ID");
|
throw new ArgumentOutOfRangeException("arg", "Invalid process ID");
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,8 +92,7 @@ namespace NzbDrone.Windows.Disk
|
||||||
PropagationFlags.InheritOnly,
|
PropagationFlags.InheritOnly,
|
||||||
controlType);
|
controlType);
|
||||||
|
|
||||||
bool modified;
|
directorySecurity.ModifyAccessRule(AccessControlModification.Add, accessRule, out var modified);
|
||||||
directorySecurity.ModifyAccessRule(AccessControlModification.Add, accessRule, out modified);
|
|
||||||
|
|
||||||
if (modified)
|
if (modified)
|
||||||
{
|
{
|
||||||
|
@ -142,11 +141,7 @@ namespace NzbDrone.Windows.Disk
|
||||||
folderName += '\\';
|
folderName += '\\';
|
||||||
}
|
}
|
||||||
|
|
||||||
ulong free = 0;
|
if (GetDiskFreeSpaceEx(folderName, out var free, out var dummy1, out var dummy2))
|
||||||
ulong dummy1 = 0;
|
|
||||||
ulong dummy2 = 0;
|
|
||||||
|
|
||||||
if (GetDiskFreeSpaceEx(folderName, out free, out dummy1, out dummy2))
|
|
||||||
{
|
{
|
||||||
return (long)free;
|
return (long)free;
|
||||||
}
|
}
|
||||||
|
@ -163,11 +158,7 @@ namespace NzbDrone.Windows.Disk
|
||||||
folderName += '\\';
|
folderName += '\\';
|
||||||
}
|
}
|
||||||
|
|
||||||
ulong total = 0;
|
if (GetDiskFreeSpaceEx(folderName, out var dummy1, out var total, out var dummy2))
|
||||||
ulong dummy1 = 0;
|
|
||||||
ulong dummy2 = 0;
|
|
||||||
|
|
||||||
if (GetDiskFreeSpaceEx(folderName, out dummy1, out total, out dummy2))
|
|
||||||
{
|
{
|
||||||
return (long)total;
|
return (long)total;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,8 +81,7 @@ namespace Sonarr.Http.ClientSchema
|
||||||
{
|
{
|
||||||
lock (_mappings)
|
lock (_mappings)
|
||||||
{
|
{
|
||||||
FieldMapping[] result;
|
if (!_mappings.TryGetValue(type, out var result))
|
||||||
if (!_mappings.TryGetValue(type, out result))
|
|
||||||
{
|
{
|
||||||
result = GetFieldMapping(type, "", v => v);
|
result = GetFieldMapping(type, "", v => v);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue