aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common/Plugins
diff options
context:
space:
mode:
authorBaronGreenback <jimcartlidge@yahoo.co.uk>2021-03-22 17:05:44 +0000
committerGitHub <noreply@github.com>2021-03-22 17:05:44 +0000
commit5d16d1f66de499022da3eeb484a2cdfe341bed2f (patch)
treeac348fc960f2c849d989a6d2f27a34a73d4f3675 /MediaBrowser.Common/Plugins
parent7fa525c83b7573e61124fa1c64a3b27569e66b6d (diff)
parent0853d1265c99a2e8614aa0c7a584dff541484e19 (diff)
Merge branch 'master' into RemoteAccessFix
Diffstat (limited to 'MediaBrowser.Common/Plugins')
-rw-r--r--MediaBrowser.Common/Plugins/BasePlugin.cs2
-rw-r--r--MediaBrowser.Common/Plugins/BasePluginOfT.cs36
-rw-r--r--MediaBrowser.Common/Plugins/LocalPlugin.cs6
3 files changed, 21 insertions, 23 deletions
diff --git a/MediaBrowser.Common/Plugins/BasePlugin.cs b/MediaBrowser.Common/Plugins/BasePlugin.cs
index 7b162c0e1..ad5a7338d 100644
--- a/MediaBrowser.Common/Plugins/BasePlugin.cs
+++ b/MediaBrowser.Common/Plugins/BasePlugin.cs
@@ -50,7 +50,7 @@ namespace MediaBrowser.Common.Plugins
/// Gets a value indicating whether the plugin can be uninstalled.
/// </summary>
public bool CanUninstall => !Path.GetDirectoryName(AssemblyFilePath)
- .Equals(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), StringComparison.InvariantCulture);
+ .Equals(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), StringComparison.Ordinal);
/// <summary>
/// Gets the plugin info.
diff --git a/MediaBrowser.Common/Plugins/BasePluginOfT.cs b/MediaBrowser.Common/Plugins/BasePluginOfT.cs
index d5c780851..99c226f50 100644
--- a/MediaBrowser.Common/Plugins/BasePluginOfT.cs
+++ b/MediaBrowser.Common/Plugins/BasePluginOfT.cs
@@ -39,29 +39,27 @@ namespace MediaBrowser.Common.Plugins
{
ApplicationPaths = applicationPaths;
XmlSerializer = xmlSerializer;
- if (this is IPluginAssembly assemblyPlugin)
- {
- var assembly = GetType().Assembly;
- var assemblyName = assembly.GetName();
- var assemblyFilePath = assembly.Location;
- var dataFolderPath = Path.Combine(ApplicationPaths.PluginsPath, Path.GetFileNameWithoutExtension(assemblyFilePath));
- if (!Directory.Exists(dataFolderPath) && Version != null)
- {
- // Try again with the version number appended to the folder name.
- dataFolderPath = dataFolderPath + "_" + Version.ToString();
- }
+ var assembly = GetType().Assembly;
+ var assemblyName = assembly.GetName();
+ var assemblyFilePath = assembly.Location;
- assemblyPlugin.SetAttributes(assemblyFilePath, dataFolderPath, assemblyName.Version);
+ var dataFolderPath = Path.Combine(ApplicationPaths.PluginsPath, Path.GetFileNameWithoutExtension(assemblyFilePath));
+ if (!Directory.Exists(dataFolderPath) && Version != null)
+ {
+ // Try again with the version number appended to the folder name.
+ dataFolderPath = dataFolderPath + "_" + Version.ToString();
+ }
- var idAttributes = assembly.GetCustomAttributes(typeof(GuidAttribute), true);
- if (idAttributes.Length > 0)
- {
- var attribute = (GuidAttribute)idAttributes[0];
- var assemblyId = new Guid(attribute.Value);
+ SetAttributes(assemblyFilePath, dataFolderPath, assemblyName.Version);
- assemblyPlugin.SetId(assemblyId);
- }
+ var idAttributes = assembly.GetCustomAttributes(typeof(GuidAttribute), true);
+ if (idAttributes.Length > 0)
+ {
+ var attribute = (GuidAttribute)idAttributes[0];
+ var assemblyId = new Guid(attribute.Value);
+
+ SetId(assemblyId);
}
}
diff --git a/MediaBrowser.Common/Plugins/LocalPlugin.cs b/MediaBrowser.Common/Plugins/LocalPlugin.cs
index 23b6cfa81..12a1ad1ec 100644
--- a/MediaBrowser.Common/Plugins/LocalPlugin.cs
+++ b/MediaBrowser.Common/Plugins/LocalPlugin.cs
@@ -22,7 +22,7 @@ namespace MediaBrowser.Common.Plugins
public LocalPlugin(string path, bool isSupported, PluginManifest manifest)
{
Path = path;
- DllFiles = new List<string>();
+ DllFiles = Array.Empty<string>();
_supported = isSupported;
Manifest = manifest;
}
@@ -59,9 +59,9 @@ namespace MediaBrowser.Common.Plugins
public string Path { get; }
/// <summary>
- /// Gets the list of dll files for this plugin.
+ /// Gets or sets the list of dll files for this plugin.
/// </summary>
- public List<string> DllFiles { get; }
+ public IReadOnlyList<string> DllFiles { get; set; }
/// <summary>
/// Gets or sets the instance of this plugin.