Remove Static Configuration Class and .NET Core Prep (#2122)

* Remove static configuration class that required prior knowledge of when it was initialised to dependency injected method that ensures all configuration has already occured.

* Specify a different log name for the updater, require a path when running the Jackett updater

* Update to all .NET Standard packages

* Explicitly specify the restore project style

* Move automapper out of the  DI framework and put crude detection to prevent it from initializing more than once.
This commit is contained in:
Nathan Holland
2017-11-13 21:38:38 +13:00
committed by flightlevel
parent fe504ed660
commit 1c62504b22
34 changed files with 368 additions and 364 deletions

View File

@@ -8,6 +8,9 @@ using System.Security.AccessControl;
using System.Security.Principal;
using Jackett.Services.Interfaces;
using Jacket.Common;
using Jacket.Common.Utils;
using Jackett.Common.Models.Config;
using Jackett.Models.Config;
namespace Jackett.Services
{
@@ -17,15 +20,22 @@ namespace Jackett.Services
private ISerializeService serializeService;
private Logger logger;
private IProcessService processService;
private RuntimeSettings runtimeSettings;
public ConfigurationService(ISerializeService s, IProcessService p, Logger l)
public ConfigurationService(ISerializeService s, IProcessService p, Logger l, RuntimeSettings settings)
{
serializeService = s;
logger = l;
processService = p;
runtimeSettings = settings;
CreateOrMigrateSettings();
}
public string GetAppDataFolder()
{
return runtimeSettings.DataFolder;
}
public void CreateOrMigrateSettings()
{
try
@@ -213,31 +223,6 @@ namespace Jackett.Services
}
public string GetAppDataFolder()
{
return GetAppDataFolderStatic();
}
/// <summary>
/// This is needed for the logger prior to ioc setup.
/// </summary>
/// <returns></returns>
public static string GetAppDataFolderStatic()
{
if (!string.IsNullOrWhiteSpace(JackettStartup.CustomDataFolder))
{
return JackettStartup.CustomDataFolder;
}
if (System.Environment.OSVersion.Platform == PlatformID.Unix)
{
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Jackett");
}
else
{
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Jackett");
}
}
public string GetIndexerConfigDir()
{
@@ -256,7 +241,7 @@ namespace Jackett.Services
public string GetVersion()
{
return JackettStartup.JackettVersion;
return EnvironmentUtil.JackettVersion;
}
}
}