Files
pgsql-jellyfin/MediaBrowser.Common/Plugins/BasePlugin.cs
T
wjones af1152b001 Refactor: standardize namespace and using directive style
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.
2026-02-20 16:26:53 -05:00

99 lines
2.9 KiB
C#

// <copyright file="BasePlugin.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace MediaBrowser.Common.Plugins
{
#nullable disable
using System;
using System.IO;
using System.Reflection;
using MediaBrowser.Model.Plugins;
/// <summary>
/// Provides a common base class for all plugins.
/// </summary>
public abstract class BasePlugin : IPlugin, IPluginAssembly
{
/// <summary>
/// Gets the name of the plugin.
/// </summary>
/// <value>The name.</value>
public abstract string Name { get; }
/// <summary>
/// Gets the description.
/// </summary>
/// <value>The description.</value>
public virtual string Description => string.Empty;
/// <summary>
/// Gets the unique id.
/// </summary>
/// <value>The unique id.</value>
public virtual Guid Id { get; private set; }
/// <summary>
/// Gets the plugin version.
/// </summary>
/// <value>The version.</value>
public Version Version { get; private set; }
/// <summary>
/// Gets the path to the assembly file.
/// </summary>
/// <value>The assembly file path.</value>
public string AssemblyFilePath { get; private set; }
/// <summary>
/// Gets the full path to the data folder, where the plugin can store any miscellaneous files needed.
/// </summary>
/// <value>The data folder path.</value>
public string DataFolderPath { get; private set; }
/// <summary>
/// Gets a value indicating whether the plugin can be uninstalled.
/// </summary>
public bool CanUninstall => !Path.GetDirectoryName(AssemblyFilePath)
.Equals(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), StringComparison.Ordinal);
/// <summary>
/// Gets the plugin info.
/// </summary>
/// <returns>PluginInfo.</returns>
public virtual PluginInfo GetPluginInfo()
{
var info = new PluginInfo(
Name,
Version,
Description,
Id,
CanUninstall);
return info;
}
/// <summary>
/// Called just before the plugin is uninstalled from the server.
/// </summary>
public virtual void OnUninstalling()
{
}
/// <inheritdoc />
public void SetAttributes(string assemblyFilePath, string dataFolderPath, Version assemblyVersion)
{
AssemblyFilePath = assemblyFilePath;
DataFolderPath = dataFolderPath;
Version = assemblyVersion;
}
/// <inheritdoc />
public void SetId(Guid assemblyId)
{
Id = assemblyId;
}
}
}