aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/ApplicationHost.cs
diff options
context:
space:
mode:
authorErwin de Haan <EraYaN@users.noreply.github.com>2019-01-17 17:48:01 +0100
committerGitHub <noreply@github.com>2019-01-17 17:48:01 +0100
commite241589969c643116f9fc5c24bcf2009fed83fe5 (patch)
tree5a9e7d266b5f79c6d90a4767e804887b40b87b1c /Emby.Server.Implementations/ApplicationHost.cs
parent47f08fbb12db5854f5e474ddbf70b758ca084616 (diff)
parent7aa975325af87fe425fe143aaed1df830133be8b (diff)
Merge branch 'dev' into skia-native-arm
Diffstat (limited to 'Emby.Server.Implementations/ApplicationHost.cs')
-rw-r--r--Emby.Server.Implementations/ApplicationHost.cs104
1 files changed, 22 insertions, 82 deletions
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index b020b33c3..283d6b6d7 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -1,4 +1,4 @@
-using Emby.Common.Implementations.Serialization;
+using Emby.Common.Implementations.Serialization;
using Emby.Drawing;
using Emby.Photos;
using Emby.Dlna;
@@ -41,7 +41,6 @@ using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Model.Extensions;
-using MediaBrowser.Common.Security;
using MediaBrowser.Common.Updates;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Channels;
@@ -132,13 +131,7 @@ namespace Emby.Server.Implementations
/// Gets or sets a value indicating whether this instance can self update.
/// </summary>
/// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
- public virtual bool CanSelfUpdate
- {
- get
- {
- return false;
- }
- }
+ public virtual bool CanSelfUpdate => false;
public virtual bool CanLaunchWebBrowser
{
@@ -237,7 +230,6 @@ namespace Emby.Server.Implementations
{
get
{
-
#if BETA
return PackageVersionClass.Beta;
#endif
@@ -245,10 +237,7 @@ namespace Emby.Server.Implementations
}
}
- public virtual string OperatingSystemDisplayName
- {
- get { return EnvironmentInfo.OperatingSystemName; }
- }
+ public virtual string OperatingSystemDisplayName => EnvironmentInfo.OperatingSystemName;
/// <summary>
/// The container
@@ -261,10 +250,7 @@ namespace Emby.Server.Implementations
/// Gets the server configuration manager.
/// </summary>
/// <value>The server configuration manager.</value>
- public IServerConfigurationManager ServerConfigurationManager
- {
- get { return (IServerConfigurationManager)ConfigurationManager; }
- }
+ public IServerConfigurationManager ServerConfigurationManager => (IServerConfigurationManager)ConfigurationManager;
/// <summary>
/// Gets the configuration manager.
@@ -352,11 +338,6 @@ namespace Emby.Server.Implementations
/// </summary>
/// <value>The installation manager.</value>
protected IInstallationManager InstallationManager { get; private set; }
- /// <summary>
- /// Gets the security manager.
- /// </summary>
- /// <value>The security manager.</value>
- protected ISecurityManager SecurityManager { get; private set; }
/// <summary>
/// Gets or sets the zip client.
@@ -453,13 +434,7 @@ namespace Emby.Server.Implementations
/// Gets the current application version
/// </summary>
/// <value>The application version.</value>
- public Version ApplicationVersion
- {
- get
- {
- return _version ?? (_version = typeof(ApplicationHost).Assembly.GetName().Version);
- }
- }
+ public Version ApplicationVersion => _version ?? (_version = typeof(ApplicationHost).Assembly.GetName().Version);
private DeviceId _deviceId;
public string SystemId
@@ -479,15 +454,9 @@ namespace Emby.Server.Implementations
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get
- {
- return "Emby Server";
- }
- }
+ public string Name => "Emby Server";
- private Tuple<Assembly, string> GetAssembly(Type type)
+ private static Tuple<Assembly, string> GetAssembly(Type type)
{
var assembly = type.GetTypeInfo().Assembly;
string path = null;
@@ -513,7 +482,7 @@ namespace Emby.Server.Implementations
/// <summary>
/// Creates the instance safe.
/// </summary>
- /// <param name="type">The type.</param>
+ /// <param name="typeInfo">The type information.</param>
/// <returns>System.Object.</returns>
protected object CreateInstanceSafe(Tuple<Type, string> typeInfo)
{
@@ -540,7 +509,7 @@ namespace Emby.Server.Implementations
protected void RegisterSingleInstance<T>(T obj, bool manageLifetime = true)
where T : class
{
- Container.RegisterSingleton(obj);
+ Container.RegisterInstance<T>(obj);
if (manageLifetime)
{
@@ -605,7 +574,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
- Logger.LogError(ex, "Error loading assembly {file}", file);
+ Logger.LogError(ex, "Error loading assembly {File}", file);
return null;
}
}
@@ -828,10 +797,7 @@ namespace Emby.Server.Implementations
SocketFactory = new SocketFactory(LoggerFactory.CreateLogger("SocketFactory"));
RegisterSingleInstance(SocketFactory);
- SecurityManager = new PluginSecurityManager(this, HttpClient, JsonSerializer, ApplicationPaths, LoggerFactory, FileSystemManager, CryptographyProvider);
- RegisterSingleInstance(SecurityManager);
-
- InstallationManager = new InstallationManager(LoggerFactory.CreateLogger("InstallationManager"), this, ApplicationPaths, HttpClient, JsonSerializer, SecurityManager, ServerConfigurationManager, FileSystemManager, CryptographyProvider, PackageRuntime);
+ InstallationManager = new InstallationManager(LoggerFactory.CreateLogger("InstallationManager"), this, ApplicationPaths, HttpClient, JsonSerializer, ServerConfigurationManager, FileSystemManager, CryptographyProvider, PackageRuntime);
RegisterSingleInstance(InstallationManager);
ZipClient = new ZipClient(FileSystemManager);
@@ -946,7 +912,7 @@ namespace Emby.Server.Implementations
PlaylistManager = new PlaylistManager(LibraryManager, FileSystemManager, LibraryMonitor, LoggerFactory.CreateLogger("PlaylistManager"), UserManager, ProviderManager);
RegisterSingleInstance<IPlaylistManager>(PlaylistManager);
- LiveTvManager = new LiveTvManager(this, HttpClient, ServerConfigurationManager, Logger, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager, LocalizationManager, JsonSerializer, ProviderManager, FileSystemManager, SecurityManager, () => ChannelManager);
+ LiveTvManager = new LiveTvManager(this, HttpClient, ServerConfigurationManager, Logger, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager, LocalizationManager, JsonSerializer, ProviderManager, FileSystemManager, () => ChannelManager);
RegisterSingleInstance(LiveTvManager);
UserViewManager = new UserViewManager(LibraryManager, LocalizationManager, UserManager, ChannelManager, LiveTvManager, ServerConfigurationManager);
@@ -1004,13 +970,7 @@ namespace Emby.Server.Implementations
return s => JsvReader.GetParseFn(propertyType)(s);
}
- public virtual string PackageRuntime
- {
- get
- {
- return "netcore";
- }
- }
+ public virtual string PackageRuntime => "netcore";
public static void LogEnvironmentInfo(ILogger logger, IApplicationPaths appPaths, EnvironmentInfo.EnvironmentInfo environmentInfo)
{
@@ -1049,7 +1009,7 @@ namespace Emby.Server.Implementations
return name + "/" + ApplicationVersion;
}
- private string FormatAttribute(string str)
+ private static string FormatAttribute(string str)
{
var arr = str.ToCharArray();
@@ -1066,13 +1026,7 @@ namespace Emby.Server.Implementations
return result;
}
- protected virtual bool SupportsDualModeSockets
- {
- get
- {
- return true;
- }
- }
+ protected virtual bool SupportsDualModeSockets => true;
private X509Certificate GetCertificate(CertificateInfo info)
{
@@ -1927,18 +1881,9 @@ namespace Emby.Server.Implementations
};
}
- public bool EnableHttps
- {
- get
- {
- return SupportsHttps && ServerConfigurationManager.Configuration.EnableHttps;
- }
- }
+ public bool EnableHttps => SupportsHttps && ServerConfigurationManager.Configuration.EnableHttps;
- public bool SupportsHttps
- {
- get { return Certificate != null || ServerConfigurationManager.Configuration.IsBehindProxy; }
- }
+ public bool SupportsHttps => Certificate != null || ServerConfigurationManager.Configuration.IsBehindProxy;
public async Task<string> GetLocalApiUrl(CancellationToken cancellationToken)
{
@@ -2132,15 +2077,10 @@ namespace Emby.Server.Implementations
}
}
- public string FriendlyName
- {
- get
- {
- return string.IsNullOrEmpty(ServerConfigurationManager.Configuration.ServerName)
- ? Environment.MachineName
- : ServerConfigurationManager.Configuration.ServerName;
- }
- }
+ public string FriendlyName =>
+ string.IsNullOrEmpty(ServerConfigurationManager.Configuration.ServerName)
+ ? Environment.MachineName
+ : ServerConfigurationManager.Configuration.ServerName;
public int HttpPort { get; private set; }
@@ -2177,7 +2117,7 @@ namespace Emby.Server.Implementations
private bool _hasUpdateAvailable;
public bool HasUpdateAvailable
{
- get { return _hasUpdateAvailable; }
+ get => _hasUpdateAvailable;
set
{
var fireEvent = value && !_hasUpdateAvailable;