Initialize device id in constructor

pull/9191/head
Patrick Barron 2 years ago
parent 0df899943f
commit 990bd7d1ee

@ -118,6 +118,7 @@ namespace Emby.Server.Implementations
/// The disposable parts. /// The disposable parts.
/// </summary> /// </summary>
private readonly ConcurrentDictionary<IDisposable, byte> _disposableParts = new(); private readonly ConcurrentDictionary<IDisposable, byte> _disposableParts = new();
private readonly DeviceId _deviceId;
private readonly IFileSystem _fileSystemManager; private readonly IFileSystem _fileSystemManager;
private readonly IConfiguration _startupConfig; private readonly IConfiguration _startupConfig;
@ -135,8 +136,6 @@ namespace Emby.Server.Implementations
/// <value>All concrete types.</value> /// <value>All concrete types.</value>
private Type[] _allConcreteTypes; private Type[] _allConcreteTypes;
private DeviceId _deviceId;
private bool _disposed = false; private bool _disposed = false;
/// <summary> /// <summary>
@ -160,6 +159,7 @@ namespace Emby.Server.Implementations
Logger = LoggerFactory.CreateLogger<ApplicationHost>(); Logger = LoggerFactory.CreateLogger<ApplicationHost>();
_fileSystemManager.AddShortcutHandler(new MbLinkShortcutHandler(_fileSystemManager)); _fileSystemManager.AddShortcutHandler(new MbLinkShortcutHandler(_fileSystemManager));
_deviceId = new DeviceId(ApplicationPaths, LoggerFactory);
ApplicationVersion = typeof(ApplicationHost).Assembly.GetName().Version; ApplicationVersion = typeof(ApplicationHost).Assembly.GetName().Version;
ApplicationVersionString = ApplicationVersion.ToString(3); ApplicationVersionString = ApplicationVersion.ToString(3);
@ -280,15 +280,7 @@ namespace Emby.Server.Implementations
/// <value>The application name.</value> /// <value>The application name.</value>
public string ApplicationProductName { get; } = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).ProductName; public string ApplicationProductName { get; } = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).ProductName;
public string SystemId public string SystemId => _deviceId.Value;
{
get
{
_deviceId ??= new DeviceId(ApplicationPaths, LoggerFactory);
return _deviceId.Value;
}
}
/// <inheritdoc/> /// <inheritdoc/>
public string Name => ApplicationProductName; public string Name => ApplicationProductName;

Loading…
Cancel
Save