af1152b001
Refactored all C# test files to use explicit namespace declarations and moved all using directives inside the namespace block for consistency. Updated assembly info and cache files to reflect the new build. Adjusted MvcTestingAppManifest.json to use fully qualified assembly names. No functional changes; all updates are related to code style, organization, and project metadata.
56 lines
2.3 KiB
C#
56 lines
2.3 KiB
C#
// <copyright file="PluginInstallationFailedLogger.cs" company="PlaceholderCompany">
|
|
// Copyright (c) PlaceholderCompany. All rights reserved.
|
|
// </copyright>
|
|
|
|
namespace Jellyfin.Server.Implementations.Events.Consumers.Updates
|
|
{
|
|
using System;
|
|
using System.Globalization;
|
|
using System.Threading.Tasks;
|
|
using Jellyfin.Database.Implementations.Entities;
|
|
using MediaBrowser.Common.Updates;
|
|
using MediaBrowser.Controller.Events;
|
|
using MediaBrowser.Model.Activity;
|
|
using MediaBrowser.Model.Globalization;
|
|
using MediaBrowser.Model.Notifications;
|
|
|
|
/// <summary>
|
|
/// Creates an entry in the activity log when a package installation fails.
|
|
/// </summary>
|
|
public class PluginInstallationFailedLogger : IEventConsumer<InstallationFailedEventArgs>
|
|
{
|
|
private readonly ILocalizationManager _localizationManager;
|
|
private readonly IActivityManager _activityManager;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="PluginInstallationFailedLogger"/> class.
|
|
/// </summary>
|
|
/// <param name="localizationManager">The localization manager.</param>
|
|
/// <param name="activityManager">The activity manager.</param>
|
|
public PluginInstallationFailedLogger(ILocalizationManager localizationManager, IActivityManager activityManager)
|
|
{
|
|
_localizationManager = localizationManager;
|
|
_activityManager = activityManager;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public async Task OnEvent(InstallationFailedEventArgs eventArgs)
|
|
{
|
|
await _activityManager.CreateAsync(new ActivityLog(
|
|
string.Format(
|
|
CultureInfo.InvariantCulture,
|
|
_localizationManager.GetLocalizedString("NameInstallFailed"),
|
|
eventArgs.InstallationInfo.Name),
|
|
NotificationType.InstallationFailed.ToString(),
|
|
Guid.Empty)
|
|
{
|
|
ShortOverview = string.Format(
|
|
CultureInfo.InvariantCulture,
|
|
_localizationManager.GetLocalizedString("VersionNumber"),
|
|
eventArgs.InstallationInfo.Version),
|
|
Overview = eventArgs.Exception.Message
|
|
}).ConfigureAwait(false);
|
|
}
|
|
}
|
|
}
|