From 391b48614d598b5fbfad68b610520a5ae7a57b70 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Fri, 28 Dec 2018 15:21:02 +0100 Subject: Remove FireEventIfNotNull It's a pretty useless "helper" class --- .../Updates/InstallationManager.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'Emby.Server.Implementations/Updates') diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs index 27741863b5..bf47b63ea1 100644 --- a/Emby.Server.Implementations/Updates/InstallationManager.cs +++ b/Emby.Server.Implementations/Updates/InstallationManager.cs @@ -60,7 +60,7 @@ namespace Emby.Server.Implementations.Updates /// The plugin. private void OnPluginUninstalled(IPlugin plugin) { - EventHelper.FireEventIfNotNull(PluginUninstalled, this, new GenericEventArgs { Argument = plugin }, _logger); + PluginUninstalled?.Invoke(this, new GenericEventArgs { Argument = plugin }); } #endregion @@ -78,7 +78,7 @@ namespace Emby.Server.Implementations.Updates { _logger.LogInformation("Plugin updated: {0} {1} {2}", newVersion.name, newVersion.versionStr ?? string.Empty, newVersion.classification); - EventHelper.FireEventIfNotNull(PluginUpdated, this, new GenericEventArgs> { Argument = new Tuple(plugin, newVersion) }, _logger); + PluginUpdated?.Invoke(this, new GenericEventArgs> { Argument = new Tuple(plugin, newVersion) }); _applicationHost.NotifyPendingRestart(); } @@ -97,7 +97,7 @@ namespace Emby.Server.Implementations.Updates { _logger.LogInformation("New plugin installed: {0} {1} {2}", package.name, package.versionStr ?? string.Empty, package.classification); - EventHelper.FireEventIfNotNull(PluginInstalled, this, new GenericEventArgs { Argument = package }, _logger); + PluginInstalled?.Invoke(this, new GenericEventArgs { Argument = package }); _applicationHost.NotifyPendingRestart(); } @@ -469,7 +469,7 @@ namespace Emby.Server.Implementations.Updates PackageVersionInfo = package }; - EventHelper.FireEventIfNotNull(PackageInstalling, this, installationEventArgs, _logger); + PackageInstalling?.Invoke(this, installationEventArgs); try { @@ -482,7 +482,7 @@ namespace Emby.Server.Implementations.Updates CompletedInstallationsInternal.Add(installationInfo); - EventHelper.FireEventIfNotNull(PackageInstallationCompleted, this, installationEventArgs, _logger); + PackageInstallationCompleted?.Invoke(this, installationEventArgs); } catch (OperationCanceledException) { @@ -493,7 +493,7 @@ namespace Emby.Server.Implementations.Updates _logger.LogInformation("Package installation cancelled: {0} {1}", package.name, package.versionStr); - EventHelper.FireEventIfNotNull(PackageInstallationCancelled, this, installationEventArgs, _logger); + PackageInstallationCancelled?.Invoke(this, installationEventArgs); throw; } @@ -506,12 +506,11 @@ namespace Emby.Server.Implementations.Updates CurrentInstallations.Remove(tuple); } - EventHelper.FireEventIfNotNull(PackageInstallationFailed, this, new InstallationFailedEventArgs + PackageInstallationFailed?.Invoke(this, new InstallationFailedEventArgs { InstallationInfo = installationInfo, Exception = ex - - }, _logger); + }); throw; } -- cgit v1.2.3