mirror of
https://github.com/Radarr/Radarr
synced 2026-01-26 01:12:11 +01:00
refactor: make methods static where instance data not used (S2325)
~243 methods converted to static where they don't access instance data. Fixed call sites that needed to use type name instead of instance.
This commit is contained in:
parent
aa748bfaa6
commit
b5bcb14d75
174 changed files with 247 additions and 247 deletions
|
|
@ -922,7 +922,7 @@ private void WithMockMount(string root)
|
|||
.Returns(mock.Object);
|
||||
}
|
||||
|
||||
private void VerifyCopyFolder(string source, string destination)
|
||||
private static void VerifyCopyFolder(string source, string destination)
|
||||
{
|
||||
var sourceFiles = Directory.GetFileSystemEntries(source, "*", SearchOption.AllDirectories).Select(v => v.Substring(source.Length + 1)).ToArray();
|
||||
var destFiles = Directory.GetFileSystemEntries(destination, "*", SearchOption.AllDirectories).Select(v => v.Substring(destination.Length + 1)).ToArray();
|
||||
|
|
@ -930,7 +930,7 @@ private void VerifyCopyFolder(string source, string destination)
|
|||
CollectionAssert.AreEquivalent(sourceFiles, destFiles);
|
||||
}
|
||||
|
||||
private void VerifyMoveFolder(string source, string from, string destination)
|
||||
private static void VerifyMoveFolder(string source, string from, string destination)
|
||||
{
|
||||
Directory.Exists(from).Should().BeFalse();
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public void Setup()
|
|||
_subject = new SentryTarget("https://aaaaaaaaaaaaaaaaaaaaaaaaaa@sentry.io/111111", Mocker.GetMock<IAppFolderInfo>().Object);
|
||||
}
|
||||
|
||||
private LogEventInfo GivenLogEvent(LogLevel level, Exception ex, string message)
|
||||
private static LogEventInfo GivenLogEvent(LogLevel level, Exception ex, string message)
|
||||
{
|
||||
return LogEventInfo.Create(level, "SentryTest", ex, CultureInfo.InvariantCulture, message);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public class PathExtensionFixture : TestBase
|
|||
{
|
||||
private string _parent = @"C:\Test".AsOsAgnostic();
|
||||
|
||||
private IAppFolderInfo GetIAppDirectoryInfo()
|
||||
private static IAppFolderInfo GetIAppDirectoryInfo()
|
||||
{
|
||||
var fakeEnvironment = new Mock<IAppFolderInfo>();
|
||||
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ private void ExtractZip(string compressedFile, string destination)
|
|||
}
|
||||
}
|
||||
|
||||
private void ExtractTgz(string compressedFile, string destination)
|
||||
private static void ExtractTgz(string compressedFile, string destination)
|
||||
{
|
||||
Stream inStream = File.OpenRead(compressedFile);
|
||||
Stream gzipStream = new GZipInputStream(inStream);
|
||||
|
|
|
|||
|
|
@ -539,7 +539,7 @@ public virtual IMount GetMount(string path)
|
|||
}
|
||||
}
|
||||
|
||||
protected List<DriveInfo> GetDriveInfoMounts()
|
||||
protected static List<DriveInfo> GetDriveInfoMounts()
|
||||
{
|
||||
return DriveInfo.GetDrives()
|
||||
.Where(d => d.IsReady)
|
||||
|
|
|
|||
|
|
@ -464,7 +464,7 @@ private void RollbackCopy(string sourcePath, string targetPath)
|
|||
}
|
||||
}
|
||||
|
||||
private void WaitForIO()
|
||||
private static void WaitForIO()
|
||||
{
|
||||
// This delay is intended to give the IO stack a bit of time to recover, this is especially required if remote NAS devices are involved.
|
||||
Thread.Sleep(3000);
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ public HttpResponse<T> Post<T>(HttpRequest request)
|
|||
return Task.Run(() => PostAsync<T>(request)).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
private void CheckResponseContentType(HttpResponse response)
|
||||
private static void CheckResponseContentType(HttpResponse response)
|
||||
{
|
||||
if (response.Headers.ContentType != null && response.Headers.ContentType.Contains("text/html"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ protected override void Apply(HttpRequest request)
|
|||
}
|
||||
}
|
||||
|
||||
private void ConvertParameter(object value, out object data, out string summary)
|
||||
private static void ConvertParameter(object value, out object data, out string summary)
|
||||
{
|
||||
if (value is byte[])
|
||||
{
|
||||
|
|
@ -92,7 +92,7 @@ private void ConvertParameter(object value, out object data, out string summary)
|
|||
}
|
||||
}
|
||||
|
||||
public string CreateNextId()
|
||||
public static string CreateNextId()
|
||||
{
|
||||
return Guid.NewGuid().ToString().Substring(0, 8);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ private IWebProxy CreateWebProxy(HttpProxySettings proxySettings)
|
|||
}
|
||||
}
|
||||
|
||||
private Uri GetProxyUri(HttpProxySettings proxySettings)
|
||||
private static Uri GetProxyUri(HttpProxySettings proxySettings)
|
||||
{
|
||||
switch (proxySettings.Type)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public override void Visit(JProperty property)
|
|||
}
|
||||
}
|
||||
|
||||
private JValue CleanseValue(JValue value)
|
||||
private static JValue CleanseValue(JValue value)
|
||||
{
|
||||
var text = value.Value<string>();
|
||||
var cleansed = CleanseLogMessage.Cleanse(text);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public void Initialize()
|
|||
var sentryTarget = LogManager.Configuration.AllTargets.OfType<SentryTarget>().FirstOrDefault();
|
||||
if (sentryTarget != null)
|
||||
{
|
||||
sentryTarget.UpdateScope(_osInfo);
|
||||
SentryTarget.UpdateScope(_osInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ public void InitializeScope()
|
|||
});
|
||||
}
|
||||
|
||||
public void UpdateScope(IOsInfo osInfo)
|
||||
public static void UpdateScope(IOsInfo osInfo)
|
||||
{
|
||||
SentrySdk.ConfigureScope(scope =>
|
||||
{
|
||||
|
|
@ -183,7 +183,7 @@ public void UpdateScope(IOsInfo osInfo)
|
|||
});
|
||||
}
|
||||
|
||||
public void UpdateScope(Version databaseVersion, int migration, string updateBranch, IPlatformInfo platformInfo)
|
||||
public static void UpdateScope(Version databaseVersion, int migration, string updateBranch, IPlatformInfo platformInfo)
|
||||
{
|
||||
SentrySdk.ConfigureScope(scope =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ private void ShouldHaveAddedDefaultFormat(IDirectDataMapper db)
|
|||
}
|
||||
}
|
||||
|
||||
private List<Profile147> QueryItems(IDirectDataMapper db)
|
||||
private static List<Profile147> QueryItems(IDirectDataMapper db)
|
||||
{
|
||||
var test = db.Query("SELECT * FROM \"Profiles\"");
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public void should_correctly_convert_multiple_formats()
|
|||
convertedTags2.Should().BeEquivalentTo("E_NRXRQ_Director");
|
||||
}
|
||||
|
||||
private List<CustomFormatTest149> QueryItems(IDirectDataMapper db)
|
||||
private static List<CustomFormatTest149> QueryItems(IDirectDataMapper db)
|
||||
{
|
||||
var items = db.Query<CustomFormatTest149>("SELECT \"Name\", \"FormatTags\" FROM \"CustomFormats\"");
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public void should_correctly_convert_format_tag(string original, string converte
|
|||
convertedTags.First().Should().BeEquivalentTo(converted);
|
||||
}
|
||||
|
||||
private List<regex_required_tagsFixture.CustomFormatTest149> QueryItems(IDirectDataMapper db)
|
||||
private static List<regex_required_tagsFixture.CustomFormatTest149> QueryItems(IDirectDataMapper db)
|
||||
{
|
||||
var items = db.Query<regex_required_tagsFixture.CustomFormatTest149>("SELECT \"Name\", \"FormatTags\" FROM \"CustomFormats\"");
|
||||
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ namespace NzbDrone.Core.Test.Datastore.Migration
|
|||
[TestFixture]
|
||||
public class add_webrip_qualitesFixture : MigrationTest<add_webrip_qualites>
|
||||
{
|
||||
private string GenerateQualityJson(int quality, bool allowed)
|
||||
private static string GenerateQualityJson(int quality, bool allowed)
|
||||
{
|
||||
return $"{{ \"quality\": {quality}, \"allowed\": {allowed.ToString().ToLowerInvariant()} }}";
|
||||
}
|
||||
|
||||
private string GenerateQualityGroupJson(int quality, bool allowed, string groupname, int group)
|
||||
private static string GenerateQualityGroupJson(int quality, bool allowed, string groupname, int group)
|
||||
{
|
||||
return $"{{\"id\": {group}, \"name\": \"{groupname}\", \"items\": [ {{ \"quality\": {quality}, \"allowed\": {allowed.ToString().ToLowerInvariant()} }} ] }}";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ public void should_convert_custom_format_row_with_two_specs()
|
|||
json.Should().Contain($"\"name\": \"Edition 1\"");
|
||||
}
|
||||
|
||||
private void ValidateFormatTag(string json, string type, bool required, bool negated)
|
||||
private static void ValidateFormatTag(string json, string type, bool required, bool negated)
|
||||
{
|
||||
json.Should().Contain($"\"type\": \"{type}\"");
|
||||
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@ public void MapTables()
|
|||
Mocker.Resolve<DbFactory>();
|
||||
}
|
||||
|
||||
private WhereBuilderPostgres Where(Expression<Func<Movie, bool>> filter)
|
||||
private static WhereBuilderPostgres Where(Expression<Func<Movie, bool>> filter)
|
||||
{
|
||||
return new WhereBuilderPostgres(filter, true, 0);
|
||||
}
|
||||
|
||||
private WhereBuilderPostgres WhereMeta(Expression<Func<MovieMetadata, bool>> filter)
|
||||
private static WhereBuilderPostgres WhereMeta(Expression<Func<MovieMetadata, bool>> filter)
|
||||
{
|
||||
return new WhereBuilderPostgres(filter, true, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@ public void MapTables()
|
|||
Mocker.Resolve<DbFactory>();
|
||||
}
|
||||
|
||||
private WhereBuilderSqlite Where(Expression<Func<Movie, bool>> filter)
|
||||
private static WhereBuilderSqlite Where(Expression<Func<Movie, bool>> filter)
|
||||
{
|
||||
return new WhereBuilderSqlite(filter, true, 0);
|
||||
}
|
||||
|
||||
private WhereBuilderSqlite WhereMeta(Expression<Func<MovieMetadata, bool>> filter)
|
||||
private static WhereBuilderSqlite WhereMeta(Expression<Func<MovieMetadata, bool>> filter)
|
||||
{
|
||||
return new WhereBuilderSqlite(filter, true, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public void SetUp()
|
|||
.Returns<List<DownloadDecision>>(v => v);
|
||||
}
|
||||
|
||||
private Movie GetMovie(int id)
|
||||
private static Movie GetMovie(int id)
|
||||
{
|
||||
return Builder<Movie>.CreateNew()
|
||||
.With(e => e.Id = id)
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ protected Dictionary<string, object> MapToDictionary(DataRow dataRow)
|
|||
return item;
|
||||
}
|
||||
|
||||
protected T MapToObject<T>(DataRow dataRow)
|
||||
protected static T MapToObject<T>(DataRow dataRow)
|
||||
where T : new()
|
||||
{
|
||||
var item = new T();
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace NzbDrone.Core.Test.Http
|
|||
[Platform(Exclude = "MacOsX")]
|
||||
public class HttpProxySettingsProviderFixture : TestBase<HttpProxySettingsProvider>
|
||||
{
|
||||
private HttpProxySettings GetProxySettings()
|
||||
private static HttpProxySettings GetProxySettings()
|
||||
{
|
||||
return new HttpProxySettings(ProxyType.Socks5, "localhost", 8080, "*.httpbin.org,google.com,172.16.0.0/12", true, null, null);
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ public void should_bypass_proxy(string url)
|
|||
{
|
||||
var settings = GetProxySettings();
|
||||
|
||||
Subject.ShouldProxyBeBypassed(settings, new HttpUri(url)).Should().BeTrue();
|
||||
HttpProxySettingsProvider.ShouldProxyBeBypassed(settings, new HttpUri(url)).Should().BeTrue();
|
||||
}
|
||||
|
||||
[TestCase("http://bing.com/get")]
|
||||
|
|
@ -33,7 +33,7 @@ public void should_not_bypass_proxy(string url)
|
|||
{
|
||||
var settings = GetProxySettings();
|
||||
|
||||
Subject.ShouldProxyBeBypassed(settings, new HttpUri(url)).Should().BeFalse();
|
||||
HttpProxySettingsProvider.ShouldProxyBeBypassed(settings, new HttpUri(url)).Should().BeFalse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace NzbDrone.Core.Test.ImportList.CouchPotato
|
|||
{
|
||||
public class CouchPotatoTest : CoreTest<CouchPotatoParser>
|
||||
{
|
||||
private ImportListResponse CreateResponse(string url, string content)
|
||||
private static ImportListResponse CreateResponse(string url, string content)
|
||||
{
|
||||
var httpRequest = new HttpRequest(url);
|
||||
var httpResponse = new HttpResponse(httpRequest, new HttpHeader(), Encoding.UTF8.GetBytes(content));
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace NzbDrone.Core.Test.ImportList.Plex
|
|||
[TestFixture]
|
||||
public class PlexParserFixture : CoreTest<PlexParser>
|
||||
{
|
||||
private ImportListResponse CreateResponse(string url, string content)
|
||||
private static ImportListResponse CreateResponse(string url, string content)
|
||||
{
|
||||
var httpRequest = new HttpRequest(url);
|
||||
var httpResponse = new HttpResponse(httpRequest, new HttpHeader(), Encoding.UTF8.GetBytes(content));
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace NzbDrone.Core.Test.ImportList
|
|||
{
|
||||
public class RSSImportTest : CoreTest<RSSImportParser>
|
||||
{
|
||||
private ImportListResponse CreateResponse(string url, string content)
|
||||
private static ImportListResponse CreateResponse(string url, string content)
|
||||
{
|
||||
var httpRequest = new HttpRequest(url);
|
||||
var httpResponse = new HttpResponse(httpRequest, new HttpHeader(), Encoding.UTF8.GetBytes(content));
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public void should_not_parse_size(string sizeString)
|
|||
result.Should().Be(0);
|
||||
}
|
||||
|
||||
private IndexerResponse CreateResponse(string url, string content)
|
||||
private static IndexerResponse CreateResponse(string url, string content)
|
||||
{
|
||||
var httpRequest = new HttpRequest(url);
|
||||
var httpResponse = new HttpResponse(httpRequest, new HttpHeader(), Encoding.UTF8.GetBytes(content));
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ private void ValidateTorrentResult(IList<ReleaseInfo> reports, bool hasSize = fa
|
|||
}
|
||||
}
|
||||
|
||||
private void ValidateResult(IList<ReleaseInfo> reports, bool hasSize = false, bool hasInfoUrl = false)
|
||||
private static void ValidateResult(IList<ReleaseInfo> reports, bool hasSize = false, bool hasInfoUrl = false)
|
||||
{
|
||||
reports.Should().NotBeEmpty();
|
||||
reports.Should().OnlyContain(c => c.Title.IsNotNullOrWhiteSpace());
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public List<ValidationFailure> TestPublic()
|
|||
/// <summary>
|
||||
/// Code to quickly debug unit tests
|
||||
/// </summary>
|
||||
private void SetupNLog()
|
||||
private static void SetupNLog()
|
||||
{
|
||||
// Step 1. Create configuration object
|
||||
var config = new LoggingConfiguration();
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace NzbDrone.Core.Test.Messaging.Commands
|
|||
[TestFixture]
|
||||
public class CommandEqualityComparerFixture
|
||||
{
|
||||
private string GivenRandomPath()
|
||||
private static string GivenRandomPath()
|
||||
{
|
||||
return Path.Combine(@"C:\Tesst\", Guid.NewGuid().ToString()).AsOsAgnostic();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public void should_be_able_to_get_movie_detail(int tmdbId, string title)
|
|||
details.Title.Should().Be(title);
|
||||
}
|
||||
|
||||
private void ValidateMovie(MovieMetadata movie)
|
||||
private static void ValidateMovie(MovieMetadata movie)
|
||||
{
|
||||
movie.Should().NotBeNull();
|
||||
movie.Title.Should().NotBeNullOrWhiteSpace();
|
||||
|
|
|
|||
|
|
@ -515,7 +515,7 @@ public void should_be_able_to_parse_repack(string title, bool isRepack, int vers
|
|||
result.Revision.IsRepack.Should().Be(isRepack);
|
||||
}
|
||||
|
||||
private void ParseAndVerifyQuality(string title, QualitySource source, bool proper, Resolution resolution, Modifier modifier = Modifier.NONE)
|
||||
private static void ParseAndVerifyQuality(string title, QualitySource source, bool proper, Resolution resolution, Modifier modifier = Modifier.NONE)
|
||||
{
|
||||
var result = QualityParser.ParseQuality(title);
|
||||
if (resolution != Resolution.Unknown)
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ private User SetUserHashedPassword(User user, string password)
|
|||
return user;
|
||||
}
|
||||
|
||||
private byte[] GenerateSalt()
|
||||
private static byte[] GenerateSalt()
|
||||
{
|
||||
var salt = new byte[SALT_SIZE];
|
||||
RandomNumberGenerator.Create().GetBytes(salt);
|
||||
|
|
@ -141,7 +141,7 @@ private byte[] GenerateSalt()
|
|||
return salt;
|
||||
}
|
||||
|
||||
private string GetHashedPassword(string password, byte[] salt, int iterations)
|
||||
private static string GetHashedPassword(string password, byte[] salt, int iterations)
|
||||
{
|
||||
return Convert.ToBase64String(KeyDerivation.Pbkdf2(
|
||||
password: password,
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ private bool SameTorrent(Blocklist item, TorrentInfo release)
|
|||
return HasSameIndexer(item, release.Indexer);
|
||||
}
|
||||
|
||||
private bool HasSameIndexer(Blocklist item, string indexer)
|
||||
private static bool HasSameIndexer(Blocklist item, string indexer)
|
||||
{
|
||||
if (item.Indexer.IsNullOrWhiteSpace())
|
||||
{
|
||||
|
|
@ -149,7 +149,7 @@ private bool HasSameIndexer(Blocklist item, string indexer)
|
|||
return item.Indexer.Equals(indexer, StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
private bool HasSamePublishedDate(Blocklist item, DateTime publishedDate)
|
||||
private static bool HasSamePublishedDate(Blocklist item, DateTime publishedDate)
|
||||
{
|
||||
if (!item.PublishedDate.HasValue)
|
||||
{
|
||||
|
|
@ -160,7 +160,7 @@ private bool HasSamePublishedDate(Blocklist item, DateTime publishedDate)
|
|||
item.PublishedDate.Value.AddMinutes(2) >= publishedDate;
|
||||
}
|
||||
|
||||
private bool HasSameSize(Blocklist item, long size)
|
||||
private static bool HasSameSize(Blocklist item, long size)
|
||||
{
|
||||
if (!item.Size.HasValue)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -477,7 +477,7 @@ private void SaveConfigFile(XDocument xDoc)
|
|||
}
|
||||
}
|
||||
|
||||
private string GenerateApiKey()
|
||||
private static string GenerateApiKey()
|
||||
{
|
||||
return Guid.NewGuid().ToString().Replace("-", "");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -433,7 +433,7 @@ public virtual PagingSpec<TModel> GetPaged(PagingSpec<TModel> pagingSpec)
|
|||
return pagingSpec;
|
||||
}
|
||||
|
||||
protected void AddFilters(SqlBuilder builder, PagingSpec<TModel> pagingSpec)
|
||||
protected static void AddFilters(SqlBuilder builder, PagingSpec<TModel> pagingSpec)
|
||||
{
|
||||
var filters = pagingSpec.FilterExpressions;
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public override List<IAutoTaggingSpecification> Read(ref Utf8JsonReader reader,
|
|||
}
|
||||
|
||||
// Helper function for validating where you are in the JSON
|
||||
private void ValidateToken(Utf8JsonReader reader, JsonTokenType tokenType)
|
||||
private static void ValidateToken(Utf8JsonReader reader, JsonTokenType tokenType)
|
||||
{
|
||||
if (reader.TokenType != tokenType)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ public override List<ICustomFormatSpecification> Read(ref Utf8JsonReader reader,
|
|||
}
|
||||
|
||||
// Helper function for validating where you are in the JSON
|
||||
private void ValidateToken(Utf8JsonReader reader, JsonTokenType tokenType)
|
||||
private static void ValidateToken(Utf8JsonReader reader, JsonTokenType tokenType)
|
||||
{
|
||||
if (reader.TokenType != tokenType)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ protected virtual Expression VisitLamda(LambdaExpression lambdaExpression)
|
|||
return lambdaExpression;
|
||||
}
|
||||
|
||||
private Expression VisitParameter(ParameterExpression expression)
|
||||
private static Expression VisitParameter(ParameterExpression expression)
|
||||
{
|
||||
return expression;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ protected override void MainDbUpgrade()
|
|||
Execute.WithConnection(ConvertConfig);
|
||||
}
|
||||
|
||||
private void ConvertConfig(IDbConnection conn, IDbTransaction tran)
|
||||
private static void ConvertConfig(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
using (var namingConfigCmd = conn.CreateCommand())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ protected override void MainDbUpgrade()
|
|||
Execute.WithConnection(SetSortTitles);
|
||||
}
|
||||
|
||||
private void SetSortTitles(IDbConnection conn, IDbTransaction tran)
|
||||
private static void SetSortTitles(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
using (var getSeriesCmd = conn.CreateCommand())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ protected override void MainDbUpgrade()
|
|||
Execute.WithConnection(SetSortTitles);
|
||||
}
|
||||
|
||||
private void SetSortTitles(IDbConnection conn, IDbTransaction tran)
|
||||
private static void SetSortTitles(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
using (var getSeriesCmd = conn.CreateCommand())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ protected override void MainDbUpgrade()
|
|||
// Execute.WithConnection(SetSortTitles);
|
||||
}
|
||||
|
||||
private void SetSortTitles(IDbConnection conn, IDbTransaction tran)
|
||||
private static void SetSortTitles(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
using (var getSeriesCmd = conn.CreateCommand())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ protected override void MainDbUpgrade()
|
|||
Execute.WithConnection(SetTitleSlug);
|
||||
}
|
||||
|
||||
private void SetTitleSlug(IDbConnection conn, IDbTransaction tran)
|
||||
private static void SetTitleSlug(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
using (var getSeriesCmd = conn.CreateCommand())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ protected override void MainDbUpgrade()
|
|||
Execute.WithConnection(SetTitleSlug);
|
||||
}
|
||||
|
||||
private void SetTitleSlug(IDbConnection conn, IDbTransaction tran)
|
||||
private static void SetTitleSlug(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
using (var getSeriesCmd = conn.CreateCommand())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ protected override void MainDbUpgrade()
|
|||
Execute.WithConnection(DeleteUniqueIndex);
|
||||
}
|
||||
|
||||
private void DeleteUniqueIndex(IDbConnection conn, IDbTransaction tran)
|
||||
private static void DeleteUniqueIndex(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
using (var getSeriesCmd = conn.CreateCommand())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ protected override void MainDbUpgrade()
|
|||
Execute.WithConnection(ConvertProfile);
|
||||
}
|
||||
|
||||
private void ConvertProfile(IDbConnection conn, IDbTransaction tran)
|
||||
private static void ConvertProfile(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
var updater = new ProfileUpdater125(conn, tran);
|
||||
updater.SplitQualityAppend(0, 27); // TELECINE AFTER Unknown
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ protected override void MainDbUpgrade()
|
|||
Execute.WithConnection(ConvertProfile);
|
||||
}
|
||||
|
||||
private void ConvertProfile(IDbConnection conn, IDbTransaction tran)
|
||||
private static void ConvertProfile(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
var updater = new ProfileUpdater125(conn, tran);
|
||||
updater.SplitQualityAppend(19, 31); // Remux2160p AFTER Bluray2160p
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ protected override void MainDbUpgrade()
|
|||
Execute.WithConnection(AddExisting);
|
||||
}
|
||||
|
||||
private void AddExisting(IDbConnection conn, IDbTransaction tran)
|
||||
private static void AddExisting(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
using (var getSeriesCmd = conn.CreateCommand())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ protected override void MainDbUpgrade()
|
|||
Execute.WithConnection(RenameUrlToBaseUrl);
|
||||
}
|
||||
|
||||
private void RenameUrlToBaseUrl(IDbConnection conn, IDbTransaction tran)
|
||||
private static void RenameUrlToBaseUrl(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
using (var cmd = conn.CreateCommand())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ protected override void MainDbUpgrade()
|
|||
Alter.Table("AlternativeTitles").AlterColumn("CleanTitle").AsString().Unique();
|
||||
}
|
||||
|
||||
private void RemoveDuplicateAlternateTitles(IDbConnection conn, IDbTransaction tran)
|
||||
private static void RemoveDuplicateAlternateTitles(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
using (var cmd = conn.CreateCommand())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ protected override void MainDbUpgrade()
|
|||
Execute.WithConnection(ConvertExistingFormatTags);
|
||||
}
|
||||
|
||||
private void ConvertExistingFormatTags(IDbConnection conn, IDbTransaction tran)
|
||||
private static void ConvertExistingFormatTags(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
var updater = new CustomFormatUpdater149(conn, tran);
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ protected override void MainDbUpgrade()
|
|||
Execute.WithConnection(ConvertExistingFormatTags);
|
||||
}
|
||||
|
||||
private void ConvertExistingFormatTags(IDbConnection conn, IDbTransaction tran)
|
||||
private static void ConvertExistingFormatTags(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
var updater = new CustomFormatUpdater149(conn, tran);
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ protected override void MainDbUpgrade()
|
|||
Execute.WithConnection(InitPriorityForBackwardCompatibility);
|
||||
}
|
||||
|
||||
private void InitPriorityForBackwardCompatibility(IDbConnection conn, IDbTransaction tran)
|
||||
private static void InitPriorityForBackwardCompatibility(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
var downloadClients = conn.Query<DownloadClients156>($"SELECT \"Id\", \"Implementation\" FROM \"DownloadClients\" WHERE \"Enable\"");
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ protected override void MainDbUpgrade()
|
|||
Execute.WithConnection(ConvertProfile);
|
||||
}
|
||||
|
||||
private void ConvertProfile(IDbConnection conn, IDbTransaction tran)
|
||||
private static void ConvertProfile(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
var updater = new ProfileUpdater159(conn, tran);
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ private void FixPendingReleases(IDbConnection conn, IDbTransaction tran)
|
|||
conn.Execute(sql, newRows, transaction: tran);
|
||||
}
|
||||
|
||||
private void RemoveCustomFormatFromQuality(IDbConnection conn, IDbTransaction tran, string table)
|
||||
private static void RemoveCustomFormatFromQuality(IDbConnection conn, IDbTransaction tran, string table)
|
||||
{
|
||||
var rows = conn.Query<QualityRow>($"SELECT \"Id\", \"Quality\" from \"{table}\"");
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ private ICustomFormatSpecification InitializeSpecification(Match match)
|
|||
}
|
||||
}
|
||||
|
||||
private Resolution ParseResolution(string value)
|
||||
private static Resolution ParseResolution(string value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
|
|
@ -133,7 +133,7 @@ private Resolution ParseResolution(string value)
|
|||
}
|
||||
}
|
||||
|
||||
private QualitySource ParseSource(string value)
|
||||
private static QualitySource ParseSource(string value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
|
|
@ -158,7 +158,7 @@ private QualitySource ParseSource(string value)
|
|||
}
|
||||
}
|
||||
|
||||
private Modifier ParseModifier(string value)
|
||||
private static Modifier ParseModifier(string value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
|
|
@ -177,7 +177,7 @@ private Modifier ParseModifier(string value)
|
|||
}
|
||||
}
|
||||
|
||||
private IndexerFlags ParseIndexerFlag(string value)
|
||||
private static IndexerFlags ParseIndexerFlag(string value)
|
||||
{
|
||||
var flagValues = Enum.GetValues(typeof(IndexerFlags));
|
||||
|
||||
|
|
@ -203,7 +203,7 @@ private IndexerFlags ParseIndexerFlag(string value)
|
|||
return (min, max);
|
||||
}
|
||||
|
||||
private string ParseString(string value, bool isRegex)
|
||||
private static string ParseString(string value, bool isRegex)
|
||||
{
|
||||
return isRegex ? value : Regex.Escape(value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ protected override void MainDbUpgrade()
|
|||
{ 9, 4 } // MovieHistoryType.DownloadIgnored -> DownloadHistoryType.DownloadIgnored
|
||||
};
|
||||
|
||||
private void InitialImportedDownloadHistory(IDbConnection conn, IDbTransaction tran)
|
||||
private static void InitialImportedDownloadHistory(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
using (var cmd = conn.CreateCommand())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ private void FixMovies(IDbConnection conn, IDbTransaction tran)
|
|||
}
|
||||
}
|
||||
|
||||
private List<int> GetProfileIds(IDbConnection conn)
|
||||
private static List<int> GetProfileIds(IDbConnection conn)
|
||||
{
|
||||
return conn.Query<QualityProfile180>("SELECT \"Id\" From \"Profiles\"").Select(p => p.Id).ToList();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ protected override void MainDbUpgrade()
|
|||
Delete.Column("PreferredTags").FromTable("Profiles");
|
||||
}
|
||||
|
||||
private void SetMetadataFileExtension(IDbConnection conn, IDbTransaction tran)
|
||||
private static void SetMetadataFileExtension(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
using (var cmd = conn.CreateCommand())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ protected override void MainDbUpgrade()
|
|||
Alter.Table("Movies").AlterColumn("TmdbId").AsInt32().Unique();
|
||||
}
|
||||
|
||||
private void FixMovies(IDbConnection conn, IDbTransaction tran)
|
||||
private static void FixMovies(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
var movieRows = conn.Query<MovieEntity185>($"SELECT \"Id\", \"TmdbId\", \"Added\", \"LastInfoSync\", \"MovieFileId\" FROM \"Movies\"");
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ protected override void MainDbUpgrade()
|
|||
Execute.WithConnection(ConvertFileChmodToFolderChmod);
|
||||
}
|
||||
|
||||
private void ConvertFileChmodToFolderChmod(IDbConnection conn, IDbTransaction tran)
|
||||
private static void ConvertFileChmodToFolderChmod(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
using (var getFileChmodCmd = conn.CreateCommand())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ private void MigrateVideoCodec(MediaInfo198 mediaInfo, MediaInfo199 m, string sc
|
|||
}
|
||||
}
|
||||
|
||||
private void MigrateVideoCodecLegacy(MediaInfo198 mediaInfo, MediaInfo199 m, string sceneName)
|
||||
private static void MigrateVideoCodecLegacy(MediaInfo198 mediaInfo, MediaInfo199 m, string sceneName)
|
||||
{
|
||||
var videoCodec = mediaInfo.VideoCodec;
|
||||
|
||||
|
|
@ -335,7 +335,7 @@ private void MigrateVideoCodecLegacy(MediaInfo198 mediaInfo, MediaInfo199 m, str
|
|||
}
|
||||
}
|
||||
|
||||
private HdrFormat MigrateHdrFormat(MediaInfo198 mediaInfo)
|
||||
private static HdrFormat MigrateHdrFormat(MediaInfo198 mediaInfo)
|
||||
{
|
||||
if (mediaInfo.VideoHdrFormatCompatibility.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
|
|
@ -531,7 +531,7 @@ private void MigrateAudioCodec(MediaInfo198 mediaInfo, MediaInfo199 m)
|
|||
}
|
||||
}
|
||||
|
||||
private void MigrateAudioCodecLegacy(MediaInfo198 mediaInfo, MediaInfo199 m)
|
||||
private static void MigrateAudioCodecLegacy(MediaInfo198 mediaInfo, MediaInfo199 m)
|
||||
{
|
||||
var audioFormat = mediaInfo.AudioFormat;
|
||||
|
||||
|
|
@ -617,7 +617,7 @@ private void MigrateAudioChannelPositions(MediaInfo198 mediaInfo, MediaInfo199 m
|
|||
m.AudioChannelPositions = audioChannels.ToString();
|
||||
}
|
||||
|
||||
private decimal? FormatAudioChannelsFromAudioChannelPositions(MediaInfo198 mediaInfo)
|
||||
private static decimal? FormatAudioChannelsFromAudioChannelPositions(MediaInfo198 mediaInfo)
|
||||
{
|
||||
var audioChannelPositions = mediaInfo.AudioChannelPositions;
|
||||
|
||||
|
|
@ -676,7 +676,7 @@ private void MigrateAudioChannelPositions(MediaInfo198 mediaInfo, MediaInfo199 m
|
|||
return null;
|
||||
}
|
||||
|
||||
private decimal? FormatAudioChannelsFromAudioChannelPositionsText(MediaInfo198 mediaInfo)
|
||||
private static decimal? FormatAudioChannelsFromAudioChannelPositionsText(MediaInfo198 mediaInfo)
|
||||
{
|
||||
var audioChannelPositionsTextContainer = mediaInfo.AudioChannelPositionsTextContainer;
|
||||
var audioChannelPositionsTextStream = mediaInfo.AudioChannelPositionsTextStream;
|
||||
|
|
@ -706,7 +706,7 @@ private void MigrateAudioChannelPositions(MediaInfo198 mediaInfo, MediaInfo199 m
|
|||
return null;
|
||||
}
|
||||
|
||||
private decimal? FormatAudioChannelsFromAudioChannels(MediaInfo198 mediaInfo)
|
||||
private static decimal? FormatAudioChannelsFromAudioChannels(MediaInfo198 mediaInfo)
|
||||
{
|
||||
var audioChannelsContainer = mediaInfo.AudioChannelsContainer;
|
||||
var audioChannelsStream = mediaInfo.AudioChannelsStream;
|
||||
|
|
@ -742,7 +742,7 @@ private void MigrateAudioChannelPositions(MediaInfo198 mediaInfo, MediaInfo199 m
|
|||
return null;
|
||||
}
|
||||
|
||||
private List<string> MigrateLanguages(string mediaInfoLanguages)
|
||||
private static List<string> MigrateLanguages(string mediaInfoLanguages)
|
||||
{
|
||||
var languages = new List<string>();
|
||||
|
||||
|
|
@ -788,12 +788,12 @@ private List<string> MigrateLanguages(string mediaInfoLanguages)
|
|||
return languages;
|
||||
}
|
||||
|
||||
private string MigratePrimaries(string primary)
|
||||
private static string MigratePrimaries(string primary)
|
||||
{
|
||||
return primary.IsNotNullOrWhiteSpace() ? primary.Replace("BT.", "bt") : primary;
|
||||
}
|
||||
|
||||
private string MigrateTransferCharacteristics(string transferCharacteristics)
|
||||
private static string MigrateTransferCharacteristics(string transferCharacteristics)
|
||||
{
|
||||
if (transferCharacteristics == "PQ")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ protected override void MainDbUpgrade()
|
|||
Execute.WithConnection(MoveRemoveSettings);
|
||||
}
|
||||
|
||||
private void MoveRemoveSettings(IDbConnection conn, IDbTransaction tran)
|
||||
private static void MoveRemoveSettings(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
var removeCompletedDownloads = false;
|
||||
var removeFailedDownloads = true;
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ protected override Expression VisitConstant(ConstantExpression expression)
|
|||
return expression;
|
||||
}
|
||||
|
||||
private bool TryGetConstantValue(Expression expression, out object result)
|
||||
private static bool TryGetConstantValue(Expression expression, out object result)
|
||||
{
|
||||
result = null;
|
||||
|
||||
|
|
@ -207,7 +207,7 @@ private bool TryGetRightValue(Expression expression, out object value)
|
|||
return false;
|
||||
}
|
||||
|
||||
private object GetFieldValue(object entity, MemberInfo member)
|
||||
private static object GetFieldValue(object entity, MemberInfo member)
|
||||
{
|
||||
if (member.MemberType == MemberTypes.Field)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ protected override Expression VisitConstant(ConstantExpression expression)
|
|||
return expression;
|
||||
}
|
||||
|
||||
private bool TryGetConstantValue(Expression expression, out object result)
|
||||
private static bool TryGetConstantValue(Expression expression, out object result)
|
||||
{
|
||||
result = null;
|
||||
|
||||
|
|
@ -207,7 +207,7 @@ private bool TryGetRightValue(Expression expression, out object value)
|
|||
return false;
|
||||
}
|
||||
|
||||
private object GetFieldValue(object entity, MemberInfo member)
|
||||
private static object GetFieldValue(object entity, MemberInfo member)
|
||||
{
|
||||
if (member.MemberType == MemberTypes.Field)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public int Compare(DownloadDecision x, DownloadDecision y)
|
|||
return comparers.Select(comparer => comparer(x, y)).FirstOrDefault(result => result != 0);
|
||||
}
|
||||
|
||||
private int CompareBy<TSubject, TValue>(TSubject left, TSubject right, Func<TSubject, TValue> funcValue)
|
||||
private static int CompareBy<TSubject, TValue>(TSubject left, TSubject right, Func<TSubject, TValue> funcValue)
|
||||
where TValue : IComparable<TValue>
|
||||
{
|
||||
var leftValue = funcValue(left);
|
||||
|
|
@ -58,7 +58,7 @@ private int CompareByReverse<TSubject, TValue>(TSubject left, TSubject right, Fu
|
|||
return CompareBy(left, right, funcValue) * -1;
|
||||
}
|
||||
|
||||
private int CompareAll(params int[] comparers)
|
||||
private static int CompareAll(params int[] comparers)
|
||||
{
|
||||
return comparers.Select(comparer => comparer).FirstOrDefault(result => result != 0);
|
||||
}
|
||||
|
|
@ -186,7 +186,7 @@ private int CompareSize(DownloadDecision x, DownloadDecision y)
|
|||
return sizeCompare;
|
||||
}
|
||||
|
||||
private int ScoreFlags(IndexerFlags flags)
|
||||
private static int ScoreFlags(IndexerFlags flags)
|
||||
{
|
||||
var flagValues = Enum.GetValues(typeof(IndexerFlags));
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ public bool QualityCutoffNotMet(QualityProfile profile, QualityModel currentQual
|
|||
return false;
|
||||
}
|
||||
|
||||
private bool CustomFormatCutoffNotMet(QualityProfile profile, List<CustomFormat> currentFormats)
|
||||
private static bool CustomFormatCutoffNotMet(QualityProfile profile, List<CustomFormat> currentFormats)
|
||||
{
|
||||
var score = profile.CalculateCustomFormatScore(currentFormats);
|
||||
var cutoff = profile.UpgradeAllowed ? profile.CutoffFormatScore : profile.MinFormatScore;
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ private ValidationFailure TestConnection()
|
|||
return null;
|
||||
}
|
||||
|
||||
private string GetOutputPath(Aria2Status torrent)
|
||||
private static string GetOutputPath(Aria2Status torrent)
|
||||
{
|
||||
if (torrent.Files.Length == 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ public bool RemoveCompletedTorrent(Aria2Settings settings, string gid)
|
|||
return result == "OK";
|
||||
}
|
||||
|
||||
private string GetToken(Aria2Settings settings)
|
||||
private static string GetToken(Aria2Settings settings)
|
||||
{
|
||||
return $"token:{settings?.SecretToken}";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ private JsonRpcResponse<TResult> ExecuteRequest<TResult>(JsonRpcRequestBuilder r
|
|||
}
|
||||
}
|
||||
|
||||
private void VerifyResponse<TResult>(JsonRpcResponse<TResult> response)
|
||||
private static void VerifyResponse<TResult>(JsonRpcResponse<TResult> response)
|
||||
{
|
||||
if (response.Error != null)
|
||||
{
|
||||
|
|
@ -368,7 +368,7 @@ private void ConnectDaemon(JsonRpcRequestBuilder requestBuilder)
|
|||
throw new DownloadClientException("Failed to connect to Deluge daemon.");
|
||||
}
|
||||
|
||||
private DelugeTorrent[] GetTorrents(DelugeUpdateUIResult result)
|
||||
private static DelugeTorrent[] GetTorrents(DelugeUpdateUIResult result)
|
||||
{
|
||||
if (result.Torrents == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public DiskStationProxyBase(DiskStationApi apiType,
|
|||
_apiName = apiName;
|
||||
}
|
||||
|
||||
private string GenerateSessionCacheKey(DownloadStationSettings settings)
|
||||
private static string GenerateSessionCacheKey(DownloadStationSettings settings)
|
||||
{
|
||||
return $"{settings.Username}@{settings.Host}:{settings.Port}";
|
||||
}
|
||||
|
|
@ -201,7 +201,7 @@ private HttpRequestBuilder BuildRequest(DownloadStationSettings settings, DiskSt
|
|||
return requestBuilder;
|
||||
}
|
||||
|
||||
private string GenerateInfoCacheKey(DownloadStationSettings settings, DiskStationApi api)
|
||||
private static string GenerateInfoCacheKey(DownloadStationSettings settings, DiskStationApi api)
|
||||
{
|
||||
return $"{settings.Host}:{settings.Port}->{api}";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ protected override void Test(List<ValidationFailure> failures)
|
|||
failures.AddIfNotNull(TestGetTorrents());
|
||||
}
|
||||
|
||||
protected bool IsFinished(DownloadStationTask torrent)
|
||||
protected static bool IsFinished(DownloadStationTask torrent)
|
||||
{
|
||||
return torrent.Status == DownloadStationTaskStatus.Finished;
|
||||
}
|
||||
|
|
@ -293,7 +293,7 @@ protected long GetRemainingSize(DownloadStationTask torrent)
|
|||
return TimeSpan.FromSeconds(remainingSize / downloadSpeed);
|
||||
}
|
||||
|
||||
protected double? GetSeedRatio(DownloadStationTask torrent)
|
||||
protected static double? GetSeedRatio(DownloadStationTask torrent)
|
||||
{
|
||||
var downloaded = torrent.Additional.Transfer["size_downloaded"].ParseInt64();
|
||||
var uploaded = torrent.Additional.Transfer["size_uploaded"].ParseInt64();
|
||||
|
|
@ -427,12 +427,12 @@ protected ValidationFailure TestGetTorrents()
|
|||
}
|
||||
}
|
||||
|
||||
protected string ParseDownloadId(string id)
|
||||
protected static string ParseDownloadId(string id)
|
||||
{
|
||||
return id.Split(':')[1];
|
||||
}
|
||||
|
||||
protected string CreateDownloadId(string id, string hashedSerialNumber)
|
||||
protected static string CreateDownloadId(string id, string hashedSerialNumber)
|
||||
{
|
||||
return $"{hashedSerialNumber}:{id}";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -382,7 +382,7 @@ protected long GetDownloadSpeed(DownloadStationTask task)
|
|||
return Math.Max(downloadSpeed, 0);
|
||||
}
|
||||
|
||||
protected TimeSpan? GetRemainingTime(long remainingSize, long downloadSpeed)
|
||||
protected static TimeSpan? GetRemainingTime(long remainingSize, long downloadSpeed)
|
||||
{
|
||||
if (downloadSpeed > 0)
|
||||
{
|
||||
|
|
@ -407,12 +407,12 @@ protected ValidationFailure TestGetNZB()
|
|||
}
|
||||
}
|
||||
|
||||
protected string ParseDownloadId(string id)
|
||||
protected static string ParseDownloadId(string id)
|
||||
{
|
||||
return id.Split(':')[1];
|
||||
}
|
||||
|
||||
protected string CreateDownloadId(string id, string hashedSerialNumber)
|
||||
protected static string CreateDownloadId(string id, string hashedSerialNumber)
|
||||
{
|
||||
return $"{hashedSerialNumber}:{id}";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public FloodProxy(IHttpClient httpClient, ICacheManager cacheManager, Logger log
|
|||
_authCookieCache = cacheManager.GetCache<Dictionary<string, string>>(GetType(), "authCookies");
|
||||
}
|
||||
|
||||
private string BuildUrl(FloodSettings settings)
|
||||
private static string BuildUrl(FloodSettings settings)
|
||||
{
|
||||
return $"{(settings.UseSsl ? "https://" : "http://")}{settings.Host}:{settings.Port}/{settings.UrlBase}";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ private bool ToBeQueuedFirst(RemoteMovie remoteMovie)
|
|||
return false;
|
||||
}
|
||||
|
||||
private double? GetSeedRatio(RemoteMovie remoteMovie)
|
||||
private static double? GetSeedRatio(RemoteMovie remoteMovie)
|
||||
{
|
||||
if (remoteMovie.SeedConfiguration == null || remoteMovie.SeedConfiguration.Ratio == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ private HadoukenTorrent MapTorrent(object[] item)
|
|||
return torrent;
|
||||
}
|
||||
|
||||
private HadoukenTorrentState ParseState(int state)
|
||||
private static HadoukenTorrentState ParseState(int state)
|
||||
{
|
||||
if ((state & 1) == 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ public List<NzbVortexFile> GetFiles(int id, NzbVortexSettings settings)
|
|||
return response.Files;
|
||||
}
|
||||
|
||||
private HttpRequestBuilder BuildRequest(NzbVortexSettings settings)
|
||||
private static HttpRequestBuilder BuildRequest(NzbVortexSettings settings)
|
||||
{
|
||||
var baseUrl = HttpRequestBuilder.BuildBaseUrl(true, settings.Host, settings.Port, settings.UrlBase);
|
||||
baseUrl = HttpUri.CombinePath(baseUrl, "api");
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@ private ValidationFailure TestSettings()
|
|||
// Javascript doesn't support 64 bit integers natively so json officially doesn't either.
|
||||
// NzbGet api thus sends it in two 32 bit chunks. Here we join the two chunks back together.
|
||||
// Simplified decimal example: "42" splits into "4" and "2". To join them I shift (<<) the "4" 1 digit to the left = "40". combine it with "2". which becomes "42" again.
|
||||
private long MakeInt64(uint high, uint low)
|
||||
private static long MakeInt64(uint high, uint low)
|
||||
{
|
||||
long result = high;
|
||||
|
||||
|
|
|
|||
|
|
@ -409,7 +409,7 @@ public override DownloadClientInfo GetStatus()
|
|||
};
|
||||
}
|
||||
|
||||
private bool RemovesCompletedDownloads(QBittorrentPreferences config)
|
||||
private static bool RemovesCompletedDownloads(QBittorrentPreferences config)
|
||||
{
|
||||
var minimumRetention = 60 * 24 * 14; // 14 days in minutes
|
||||
return (config.MaxRatioEnabled || (config.MaxSeedingTimeEnabled && config.MaxSeedingTime < minimumRetention)) && (config.MaxRatioAction == QBittorrentMaxRatioAction.Remove || config.MaxRatioAction == QBittorrentMaxRatioAction.DeleteFiles);
|
||||
|
|
@ -610,7 +610,7 @@ private ValidationFailure TestGetTorrents()
|
|||
return null;
|
||||
}
|
||||
|
||||
protected TimeSpan? GetRemainingTime(QBittorrentTorrent torrent)
|
||||
protected static TimeSpan? GetRemainingTime(QBittorrentTorrent torrent)
|
||||
{
|
||||
if (torrent.Eta < 0 || torrent.Eta > 365 * 24 * 3600)
|
||||
{
|
||||
|
|
@ -715,7 +715,7 @@ protected bool HasReachedSeedingTimeLimit(QBittorrentTorrent torrent, QBittorren
|
|||
return false;
|
||||
}
|
||||
|
||||
protected bool HasReachedInactiveSeedingTimeLimit(QBittorrentTorrent torrent, QBittorrentPreferences config)
|
||||
protected static bool HasReachedInactiveSeedingTimeLimit(QBittorrentTorrent torrent, QBittorrentPreferences config)
|
||||
{
|
||||
long inactiveSeedingTimeLimit;
|
||||
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ public Dictionary<string, QBittorrentLabel> GetLabels(QBittorrentSettings settin
|
|||
return Json.Deserialize<Dictionary<string, QBittorrentLabel>>(ProcessRequest(request, settings));
|
||||
}
|
||||
|
||||
private void AddTorrentSeedingFormParameters(HttpRequestBuilder request, TorrentSeedConfiguration seedConfiguration, bool always = false)
|
||||
private static void AddTorrentSeedingFormParameters(HttpRequestBuilder request, TorrentSeedConfiguration seedConfiguration, bool always = false)
|
||||
{
|
||||
var ratioLimit = seedConfiguration.Ratio.HasValue ? seedConfiguration.Ratio : -2;
|
||||
var seedingTimeLimit = seedConfiguration.SeedTime.HasValue ? (long)seedConfiguration.SeedTime.Value.TotalMinutes : -2;
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ private bool HasVersion(int major, int minor, int patch = 0)
|
|||
return true;
|
||||
}
|
||||
|
||||
private Version ParseVersion(string version)
|
||||
private static Version ParseVersion(string version)
|
||||
{
|
||||
if (version.IsNullOrWhiteSpace())
|
||||
{
|
||||
|
|
@ -520,7 +520,7 @@ private ValidationFailure TestCategory()
|
|||
return null;
|
||||
}
|
||||
|
||||
private bool ContainsCategory(IEnumerable<string> categories, string category)
|
||||
private static bool ContainsCategory(IEnumerable<string> categories, string category)
|
||||
{
|
||||
if (categories == null || categories.Empty())
|
||||
{
|
||||
|
|
@ -535,7 +535,7 @@ private bool ContainsCategory(IEnumerable<string> categories, string category)
|
|||
return categories.Contains(category);
|
||||
}
|
||||
|
||||
private bool RemovesCompletedDownloads(SabnzbdConfig config)
|
||||
private static bool RemovesCompletedDownloads(SabnzbdConfig config)
|
||||
{
|
||||
var retention = config.Misc.history_retention;
|
||||
var option = config.Misc.history_retention_option;
|
||||
|
|
@ -573,7 +573,7 @@ private bool RemovesCompletedDownloads(SabnzbdConfig config)
|
|||
return retention != "0";
|
||||
}
|
||||
|
||||
private bool ValidatePath(DownloadClientItem downloadClientItem)
|
||||
private static bool ValidatePath(DownloadClientItem downloadClientItem)
|
||||
{
|
||||
var downloadItemOutputPath = downloadClientItem.OutputPath;
|
||||
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ private string ProcessRequest(HttpRequestBuilder requestBuilder, SabnzbdSettings
|
|||
return response.Content;
|
||||
}
|
||||
|
||||
private void CheckForError(HttpResponse response)
|
||||
private static void CheckForError(HttpResponse response)
|
||||
{
|
||||
if (!Json.TryDeserialize<SabnzbdJsonError>(response.Content, out var result))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ public override IEnumerable<DownloadClientItem> GetItems()
|
|||
return items;
|
||||
}
|
||||
|
||||
protected bool HasReachedSeedLimit(TransmissionTorrent torrent, double? ratio, Lazy<TransmissionConfig> config)
|
||||
protected static bool HasReachedSeedLimit(TransmissionTorrent torrent, double? ratio, Lazy<TransmissionConfig> config)
|
||||
{
|
||||
var isStopped = torrent.Status == TransmissionTorrentStatus.Stopped;
|
||||
var isSeeding = torrent.Status == TransmissionTorrentStatus.Seeding;
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ private TransmissionResponse GetTorrentStatus(IEnumerable<string> hashStrings, T
|
|||
return result;
|
||||
}
|
||||
|
||||
private string GetBaseUrl(TransmissionSettings settings)
|
||||
private static string GetBaseUrl(TransmissionSettings settings)
|
||||
{
|
||||
return HttpRequestBuilder.BuildBaseUrl(settings.UseSsl, settings.Host, settings.Port, settings.UrlBase);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ public bool HasHashTorrent(string hash, RTorrentSettings settings)
|
|||
}
|
||||
}
|
||||
|
||||
private string[] GetCommands(string label, RTorrentPriority priority, string directory)
|
||||
private static string[] GetCommands(string label, RTorrentPriority priority, string directory)
|
||||
{
|
||||
var result = new List<string>();
|
||||
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ public void SetState(string hash, UTorrentState state, UTorrentSettings settings
|
|||
ProcessRequest(requestBuilder, settings);
|
||||
}
|
||||
|
||||
private HttpRequestBuilder BuildRequest(UTorrentSettings settings)
|
||||
private static HttpRequestBuilder BuildRequest(UTorrentSettings settings)
|
||||
{
|
||||
var requestBuilder = new HttpRequestBuilder(settings.UseSsl, settings.Host, settings.Port, settings.UrlBase)
|
||||
.Resource("/gui/")
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ private void SetImportItem(TrackedDownload trackedDownload)
|
|||
trackedDownload.ImportItem = _provideImportItemService.ProvideImportItem(trackedDownload.DownloadItem, trackedDownload.ImportItem);
|
||||
}
|
||||
|
||||
private bool ValidatePath(TrackedDownload trackedDownload)
|
||||
private static bool ValidatePath(TrackedDownload trackedDownload)
|
||||
{
|
||||
var downloadItemOutputPath = trackedDownload.ImportItem.OutputPath;
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ private string ExtractArchivesInFolder(string folderPath)
|
|||
return folderPath;
|
||||
}
|
||||
|
||||
private bool IsPartOfMultiVolumeArchive(string path)
|
||||
private static bool IsPartOfMultiVolumeArchive(string path)
|
||||
{
|
||||
var extension = Path.GetExtension(path);
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ private void DeleteArchiveWithParts(string archivePath)
|
|||
_diskProvider.DeleteFile(archivePath);
|
||||
}
|
||||
|
||||
private bool IsArchivePartFile(string filePath, string baseName)
|
||||
private static bool IsArchivePartFile(string filePath, string baseName)
|
||||
{
|
||||
var fileName = Path.GetFileNameWithoutExtension(filePath);
|
||||
var extension = Path.GetExtension(filePath);
|
||||
|
|
|
|||
|
|
@ -450,7 +450,7 @@ private PendingRelease FindPendingRelease(int queueId)
|
|||
return GetPendingReleases().First(p => queueId == GetQueueId(p, p.RemoteMovie.Movie));
|
||||
}
|
||||
|
||||
private int GetQueueId(PendingRelease pendingRelease, Movie movie)
|
||||
private static int GetQueueId(PendingRelease pendingRelease, Movie movie)
|
||||
{
|
||||
return HashConverter.GetHashInt31(string.Format("pending-{0}-movie{1}", pendingRelease.Id, movie?.Id ?? 0));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,13 +158,13 @@ internal List<DownloadDecision> GetQualifiedReports(IEnumerable<DownloadDecision
|
|||
return decisions.Where(IsQualifiedReport).ToList();
|
||||
}
|
||||
|
||||
internal bool IsQualifiedReport(DownloadDecision decision)
|
||||
internal static bool IsQualifiedReport(DownloadDecision decision)
|
||||
{
|
||||
// Process both approved and temporarily rejected
|
||||
return (decision.Approved || decision.TemporarilyRejected) && decision.RemoteMovie.Movie != null;
|
||||
}
|
||||
|
||||
private bool IsMovieProcessed(List<DownloadDecision> decisions, DownloadDecision report)
|
||||
private static bool IsMovieProcessed(List<DownloadDecision> decisions, DownloadDecision report)
|
||||
{
|
||||
var movieId = report.RemoteMovie.Movie.Id;
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public virtual ImportExistingExtraFileFilterResult<TExtraFile> FilterAndClean(Mo
|
|||
return Filter(movie, filesOnDisk, importedFiles, movieFiles);
|
||||
}
|
||||
|
||||
private ImportExistingExtraFileFilterResult<TExtraFile> Filter(Movie movie, List<string> filesOnDisk, List<string> importedFiles, List<TExtraFile> movieFiles)
|
||||
private static ImportExistingExtraFileFilterResult<TExtraFile> Filter(Movie movie, List<string> filesOnDisk, List<string> importedFiles, List<TExtraFile> movieFiles)
|
||||
{
|
||||
var previouslyImported = movieFiles.IntersectBy(s => Path.Combine(movie.Path, s.RelativePath), filesOnDisk, f => f, PathEqualityComparer.Instance).ToList();
|
||||
var filteredFiles = filesOnDisk.Except(previouslyImported.Select(f => Path.Combine(movie.Path, f.RelativePath)).ToList(), PathEqualityComparer.Instance)
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ public override List<ImageFileResult> MovieImages(Movie movie)
|
|||
return new List<ImageFileResult>();
|
||||
}
|
||||
|
||||
private IEnumerable<ImageFileResult> ProcessMovieImages(Movie movie)
|
||||
private static IEnumerable<ImageFileResult> ProcessMovieImages(Movie movie)
|
||||
{
|
||||
return new List<ImageFileResult>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,12 +149,12 @@ public override List<ImageFileResult> MovieImages(Movie movie)
|
|||
return new List<ImageFileResult> { new ImageFileResult(destination, source) };
|
||||
}
|
||||
|
||||
private string GetMovieFileMetadataFilename(string movieFilePath)
|
||||
private static string GetMovieFileMetadataFilename(string movieFilePath)
|
||||
{
|
||||
return Path.ChangeExtension(movieFilePath, "xml");
|
||||
}
|
||||
|
||||
private string GetMovieFileImageFilename(string movieFilePath)
|
||||
private static string GetMovieFileImageFilename(string movieFilePath)
|
||||
{
|
||||
return Path.ChangeExtension(movieFilePath, "jpg");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,12 +148,12 @@ public override List<ImageFileResult> MovieImages(Movie movie)
|
|||
};
|
||||
}
|
||||
|
||||
private string GetMovieFileMetadataFilename(string movieFilePath)
|
||||
private static string GetMovieFileMetadataFilename(string movieFilePath)
|
||||
{
|
||||
return Path.ChangeExtension(movieFilePath, "xml");
|
||||
}
|
||||
|
||||
private string GetMovieFileImageFilename(string movieFilePath)
|
||||
private static string GetMovieFileImageFilename(string movieFilePath)
|
||||
{
|
||||
return Path.ChangeExtension(movieFilePath, "metathumb");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ public override IEnumerable<ExtraFile> ImportFiles(LocalMovie localMovie, MovieF
|
|||
return Enumerable.Empty<ExtraFile>();
|
||||
}
|
||||
|
||||
private List<MetadataFile> GetMetadataFilesForConsumer(IMetadata consumer, List<MetadataFile> movieMetadata)
|
||||
private static List<MetadataFile> GetMetadataFilesForConsumer(IMetadata consumer, List<MetadataFile> movieMetadata)
|
||||
{
|
||||
return movieMetadata.Where(c => c.Consumer == consumer.GetType().Name).ToList();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ public override IEnumerable<ExtraFile> ImportFiles(LocalMovie localMovie, MovieF
|
|||
return importedFiles;
|
||||
}
|
||||
|
||||
private string GetSuffix(Language language, int copy, List<string> languageTags, bool multipleCopies = false, string title = null)
|
||||
private static string GetSuffix(Language language, int copy, List<string> languageTags, bool multipleCopies = false, string title = null)
|
||||
{
|
||||
var suffixBuilder = new StringBuilder();
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ public override HealthCheck Check()
|
|||
return new HealthCheck(GetType());
|
||||
}
|
||||
|
||||
private string FormatRootFolder(string rootFolderPath, List<ImportListDefinition> importLists)
|
||||
private static string FormatRootFolder(string rootFolderPath, List<ImportListDefinition> importLists)
|
||||
{
|
||||
return $"{rootFolderPath} ({string.Join(", ", importLists.Select(l => l.Name))})";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ public override HealthCheck Check()
|
|||
return new HealthCheck(GetType());
|
||||
}
|
||||
|
||||
private string FormatRootFolder(string rootFolderPath, List<MovieCollection> collections)
|
||||
private static string FormatRootFolder(string rootFolderPath, List<MovieCollection> collections)
|
||||
{
|
||||
return $"{rootFolderPath} ({string.Join(", ", collections.Select(c => c.Title))})";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ protected override IEnumerable<MovieHistory> PagedQuery(SqlBuilder builder) =>
|
|||
return hist;
|
||||
});
|
||||
|
||||
private string BuildLanguageWhereClause(int[] languages)
|
||||
private static string BuildLanguageWhereClause(int[] languages)
|
||||
{
|
||||
var clauses = new List<string>();
|
||||
|
||||
|
|
@ -153,7 +153,7 @@ private string BuildLanguageWhereClause(int[] languages)
|
|||
return $"({string.Join(" OR ", clauses)})";
|
||||
}
|
||||
|
||||
private string BuildQualityWhereClause(int[] qualities)
|
||||
private static string BuildQualityWhereClause(int[] qualities)
|
||||
{
|
||||
var clauses = new List<string>();
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public void Clean()
|
|||
}
|
||||
}
|
||||
|
||||
private int[] GetUsedTags(string table, IDbConnection mapper)
|
||||
private static int[] GetUsedTags(string table, IDbConnection mapper)
|
||||
{
|
||||
return mapper
|
||||
.Query<List<int>>(
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue