Feature/netcore preparation (#2072)

* Use platform detection that works on mono 4.6+

* Move to use package reference for restoring nuget packages.

* DateTimeRoutines does not have Nuget packages that support .NET Standard (and therefore .NET Core). We will have to include them for now until we can get rid of this dependency.

* Start spliting some interfaces into their own files - this will help by allowing us to split them out in the future into a seperate project so the actual implementations can stay within their respective architectures when required

* Move out common libraries

* Few more tidy up tasks to get things working with .NET Standard

* Restructure the solution layout

* Encoding work to reduce rework later on platforms without Windows codepages (or require compliance with RFC1345)

* Move folder structure around to have more natural layout of the solutions

* DI server configuration to get rid of "temporary" hack and dependency circle for serverservice

* Make all encoding consistent to match the expected encoding casing for earlier versions of mono.
This commit is contained in:
Nathan Holland
2017-11-05 22:42:03 +13:00
committed by flightlevel
parent 47a2ffa313
commit 571c52a0f2
235 changed files with 967 additions and 1001 deletions

View File

@@ -15,6 +15,7 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Jacket.Common;
namespace JackettConsole
{
@@ -60,25 +61,25 @@ namespace JackettConsole
/* ====== Options ===== */
// SSL Fix
Startup.DoSSLFix = options.SSLFix;
JackettStartup.DoSSLFix = options.SSLFix;
// Use curl
if (options.Client != null)
Startup.ClientOverride = options.Client.ToLowerInvariant();
JackettStartup.ClientOverride = options.Client.ToLowerInvariant();
// Use Proxy
if (options.ProxyConnection != null)
{
Startup.ProxyConnection = options.ProxyConnection.ToLowerInvariant();
Engine.Logger.Info("Proxy enabled. " + Startup.ProxyConnection);
JackettStartup.ProxyConnection = options.ProxyConnection.ToLowerInvariant();
Engine.Logger.Info("Proxy enabled. " + JackettStartup.ProxyConnection);
}
// Logging
if (options.Logging)
Startup.LogRequests = true;
JackettStartup.LogRequests = true;
// Tracing
if (options.Tracing)
Startup.TracingEnabled = true;
JackettStartup.TracingEnabled = true;
// Log after the fact as using the logger will cause the options above to be used
@@ -94,7 +95,7 @@ namespace JackettConsole
Engine.Logger.Info("SSL ECC workaround has been disabled.");
// Ignore SSL errors on Curl
Startup.IgnoreSslErrors = options.IgnoreSslErrors;
JackettStartup.IgnoreSslErrors = options.IgnoreSslErrors;
if (options.IgnoreSslErrors == true)
{
Engine.Logger.Info("Jackett will ignore SSL certificate errors.");
@@ -103,8 +104,8 @@ namespace JackettConsole
// Choose Data Folder
if (!string.IsNullOrWhiteSpace(options.DataFolder))
{
Startup.CustomDataFolder = options.DataFolder.Replace("\"", string.Empty).Replace("'", string.Empty).Replace(@"\\", @"\");
Engine.Logger.Info("Jackett Data will be stored in: " + Startup.CustomDataFolder);
JackettStartup.CustomDataFolder = options.DataFolder.Replace("\"", string.Empty).Replace("'", string.Empty).Replace(@"\\", @"\");
Engine.Logger.Info("Jackett Data will be stored in: " + JackettStartup.CustomDataFolder);
}
/* ====== Actions ===== */
@@ -171,10 +172,10 @@ namespace JackettConsole
// Override listen public
if (options.ListenPublic || options.ListenPrivate)
{
if (Engine.Server.Config.AllowExternal != options.ListenPublic)
if (Engine.ServerConfig.AllowExternal != options.ListenPublic)
{
Engine.Logger.Info("Overriding external access to " + options.ListenPublic);
Engine.Server.Config.AllowExternal = options.ListenPublic;
Engine.ServerConfig.AllowExternal = options.ListenPublic;
if (System.Environment.OSVersion.Platform != PlatformID.Unix)
{
if (ServerUtil.IsUserAdministrator())
@@ -189,17 +190,17 @@ namespace JackettConsole
}
}
Engine.Server.SaveConfig();
Engine.SaveServerConfig();
}
}
// Override port
if (options.Port != 0)
{
if (Engine.Server.Config.Port != options.Port)
if (Engine.ServerConfig.Port != options.Port)
{
Engine.Logger.Info("Overriding port to " + options.Port);
Engine.Server.Config.Port = options.Port;
Engine.ServerConfig.Port = options.Port;
if (System.Environment.OSVersion.Platform != PlatformID.Unix)
{
if (ServerUtil.IsUserAdministrator())
@@ -214,11 +215,11 @@ namespace JackettConsole
}
}
Engine.Server.SaveConfig();
Engine.SaveServerConfig();
}
}
Startup.NoRestart = options.NoRestart;
JackettStartup.NoRestart = options.NoRestart;
}
Engine.Server.Initalize();