|
|
@ -205,14 +205,14 @@ namespace MediaBrowser.Common.Implementations
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="BaseApplicationHost{TApplicationPathsType}"/> class.
|
|
|
|
/// Initializes a new instance of the <see cref="BaseApplicationHost{TApplicationPathsType}"/> class.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
protected BaseApplicationHost(TApplicationPathsType applicationPaths,
|
|
|
|
protected BaseApplicationHost(TApplicationPathsType applicationPaths,
|
|
|
|
ILogManager logManager,
|
|
|
|
ILogManager logManager,
|
|
|
|
IFileSystem fileSystem)
|
|
|
|
IFileSystem fileSystem)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// hack alert, until common can target .net core
|
|
|
|
// hack alert, until common can target .net core
|
|
|
|
BaseExtensions.CryptographyProvider = CryptographyProvider;
|
|
|
|
BaseExtensions.CryptographyProvider = CryptographyProvider;
|
|
|
|
|
|
|
|
|
|
|
|
XmlSerializer = new XmlSerializer (fileSystem, logManager.GetLogger("XmlSerializer"));
|
|
|
|
XmlSerializer = new XmlSerializer(fileSystem, logManager.GetLogger("XmlSerializer"));
|
|
|
|
FailedAssemblies = new List<string>();
|
|
|
|
FailedAssemblies = new List<string>();
|
|
|
|
|
|
|
|
|
|
|
|
ApplicationPaths = applicationPaths;
|
|
|
|
ApplicationPaths = applicationPaths;
|
|
|
@ -396,13 +396,13 @@ namespace MediaBrowser.Common.Implementations
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
public virtual Task RunStartupTasks()
|
|
|
|
public virtual Task RunStartupTasks()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Resolve<ITaskManager>().AddTasks(GetExports<IScheduledTask>(false));
|
|
|
|
Resolve<ITaskManager>().AddTasks(GetExports<IScheduledTask>(false));
|
|
|
|
|
|
|
|
|
|
|
|
ConfigureAutorun ();
|
|
|
|
ConfigureAutorun();
|
|
|
|
|
|
|
|
|
|
|
|
ConfigurationManager.ConfigurationUpdated += OnConfigurationUpdated;
|
|
|
|
ConfigurationManager.ConfigurationUpdated += OnConfigurationUpdated;
|
|
|
|
|
|
|
|
|
|
|
|
return Task.FromResult (true);
|
|
|
|
return Task.FromResult(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -438,7 +438,7 @@ namespace MediaBrowser.Common.Implementations
|
|
|
|
protected virtual void FindParts()
|
|
|
|
protected virtual void FindParts()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
RegisterModules();
|
|
|
|
RegisterModules();
|
|
|
|
|
|
|
|
|
|
|
|
ConfigurationManager.AddParts(GetExports<IConfigurationFactory>());
|
|
|
|
ConfigurationManager.AddParts(GetExports<IConfigurationFactory>());
|
|
|
|
Plugins = GetExports<IPlugin>().Select(LoadPlugin).Where(i => i != null).ToArray();
|
|
|
|
Plugins = GetExports<IPlugin>().Select(LoadPlugin).Where(i => i != null).ToArray();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -462,6 +462,10 @@ namespace MediaBrowser.Common.Implementations
|
|
|
|
|
|
|
|
|
|
|
|
assemblyPlugin.SetAttributes(assemblyFilePath, assemblyFileName, assemblyName.Version, assemblyId);
|
|
|
|
assemblyPlugin.SetAttributes(assemblyFilePath, assemblyFileName, assemblyName.Version, assemblyId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var isFirstRun = !File.Exists(plugin.ConfigurationFilePath);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin.SetStartupInfo(isFirstRun, File.GetLastWriteTimeUtc, s => Directory.CreateDirectory(s));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -498,43 +502,43 @@ namespace MediaBrowser.Common.Implementations
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
protected virtual Task RegisterResources(IProgress<double> progress)
|
|
|
|
protected virtual Task RegisterResources(IProgress<double> progress)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
RegisterSingleInstance(ConfigurationManager);
|
|
|
|
RegisterSingleInstance(ConfigurationManager);
|
|
|
|
RegisterSingleInstance<IApplicationHost>(this);
|
|
|
|
RegisterSingleInstance<IApplicationHost>(this);
|
|
|
|
|
|
|
|
|
|
|
|
RegisterSingleInstance<IApplicationPaths>(ApplicationPaths);
|
|
|
|
RegisterSingleInstance<IApplicationPaths>(ApplicationPaths);
|
|
|
|
|
|
|
|
|
|
|
|
TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, LogManager.GetLogger("TaskManager"), FileSystemManager);
|
|
|
|
TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, LogManager.GetLogger("TaskManager"), FileSystemManager);
|
|
|
|
|
|
|
|
|
|
|
|
RegisterSingleInstance(JsonSerializer);
|
|
|
|
RegisterSingleInstance(JsonSerializer);
|
|
|
|
RegisterSingleInstance(XmlSerializer);
|
|
|
|
RegisterSingleInstance(XmlSerializer);
|
|
|
|
RegisterSingleInstance(MemoryStreamProvider);
|
|
|
|
RegisterSingleInstance(MemoryStreamProvider);
|
|
|
|
|
|
|
|
|
|
|
|
RegisterSingleInstance(LogManager);
|
|
|
|
RegisterSingleInstance(LogManager);
|
|
|
|
RegisterSingleInstance(Logger);
|
|
|
|
RegisterSingleInstance(Logger);
|
|
|
|
|
|
|
|
|
|
|
|
RegisterSingleInstance(TaskManager);
|
|
|
|
RegisterSingleInstance(TaskManager);
|
|
|
|
|
|
|
|
|
|
|
|
RegisterSingleInstance(FileSystemManager);
|
|
|
|
RegisterSingleInstance(FileSystemManager);
|
|
|
|
|
|
|
|
|
|
|
|
HttpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, LogManager.GetLogger("HttpClient"), FileSystemManager, MemoryStreamProvider);
|
|
|
|
HttpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, LogManager.GetLogger("HttpClient"), FileSystemManager, MemoryStreamProvider);
|
|
|
|
RegisterSingleInstance(HttpClient);
|
|
|
|
RegisterSingleInstance(HttpClient);
|
|
|
|
|
|
|
|
|
|
|
|
NetworkManager = CreateNetworkManager(LogManager.GetLogger("NetworkManager"));
|
|
|
|
NetworkManager = CreateNetworkManager(LogManager.GetLogger("NetworkManager"));
|
|
|
|
RegisterSingleInstance(NetworkManager);
|
|
|
|
RegisterSingleInstance(NetworkManager);
|
|
|
|
|
|
|
|
|
|
|
|
SecurityManager = new PluginSecurityManager(this, HttpClient, JsonSerializer, ApplicationPaths, LogManager);
|
|
|
|
SecurityManager = new PluginSecurityManager(this, HttpClient, JsonSerializer, ApplicationPaths, LogManager);
|
|
|
|
RegisterSingleInstance(SecurityManager);
|
|
|
|
RegisterSingleInstance(SecurityManager);
|
|
|
|
|
|
|
|
|
|
|
|
InstallationManager = new InstallationManager(LogManager.GetLogger("InstallationManager"), this, ApplicationPaths, HttpClient, JsonSerializer, SecurityManager, ConfigurationManager, FileSystemManager);
|
|
|
|
InstallationManager = new InstallationManager(LogManager.GetLogger("InstallationManager"), this, ApplicationPaths, HttpClient, JsonSerializer, SecurityManager, ConfigurationManager, FileSystemManager);
|
|
|
|
RegisterSingleInstance(InstallationManager);
|
|
|
|
RegisterSingleInstance(InstallationManager);
|
|
|
|
|
|
|
|
|
|
|
|
ZipClient = new ZipClient(FileSystemManager);
|
|
|
|
ZipClient = new ZipClient(FileSystemManager);
|
|
|
|
RegisterSingleInstance(ZipClient);
|
|
|
|
RegisterSingleInstance(ZipClient);
|
|
|
|
|
|
|
|
|
|
|
|
IsoManager = new IsoManager();
|
|
|
|
IsoManager = new IsoManager();
|
|
|
|
RegisterSingleInstance(IsoManager);
|
|
|
|
RegisterSingleInstance(IsoManager);
|
|
|
|
|
|
|
|
|
|
|
|
return Task.FromResult (true);
|
|
|
|
return Task.FromResult(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void RegisterModules()
|
|
|
|
private void RegisterModules()
|
|
|
@ -583,7 +587,7 @@ namespace MediaBrowser.Common.Implementations
|
|
|
|
Logger.Error("LoaderException: " + loaderException.Message);
|
|
|
|
Logger.Error("LoaderException: " + loaderException.Message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// If it fails we can still get a list of the Types it was able to resolve
|
|
|
|
// If it fails we can still get a list of the Types it was able to resolve
|
|
|
|
return ex.Types.Where(t => t != null);
|
|
|
|
return ex.Types.Where(t => t != null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|