From 32b92641fbb068a89aeb47956e6ce0e98b1d3918 Mon Sep 17 00:00:00 2001 From: Greenback Date: Fri, 20 Nov 2020 14:03:27 +0000 Subject: [PATCH 1/5] Get version info the manifest. --- .../ApplicationHost.cs | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 5d47d1e401..74e472be69 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -181,6 +181,8 @@ namespace Emby.Server.Implementations private IPlugin[] _plugins; + private IEnumerable _pluginsManifests; + /// /// Gets the plugins. /// @@ -772,6 +774,23 @@ namespace Emby.Server.Implementations foreach (var plugin in Plugins) { + if (plugin is IPluginAssembly assemblyPlugin) + { + // Ensure the version number matches the Plugin Manifest information. + foreach (var item in _pluginsManifests) + { + if (item.Path.Equals(plugin.AssemblyFilePath, StringComparison.OrdinalIgnoreCase)) + { + // Update version number to that of the manifest. + assemblyPlugin.SetAttributes( + plugin.AssemblyFilePath, + Path.Combine(ApplicationPaths.PluginsPath, Path.GetFileNameWithoutExtension(plugin.AssemblyFilePath)), + item.Version); + break; + } + } + } + pluginBuilder.Append(plugin.Name) .Append(' ') .Append(plugin.Version) @@ -1093,7 +1112,8 @@ namespace Emby.Server.Implementations { if (Directory.Exists(ApplicationPaths.PluginsPath)) { - foreach (var plugin in GetLocalPlugins(ApplicationPaths.PluginsPath)) + _pluginsManifests = GetLocalPlugins(ApplicationPaths.PluginsPath); + foreach (var plugin in _pluginsManifests) { foreach (var file in plugin.DllFiles) { From d6b0a939f73e30192d39f25bb745f1893606f7fb Mon Sep 17 00:00:00 2001 From: Greenback Date: Fri, 20 Nov 2020 14:14:00 +0000 Subject: [PATCH 2/5] fixed --- Emby.Server.Implementations/ApplicationHost.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 74e472be69..073baf6c0f 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -779,7 +779,7 @@ namespace Emby.Server.Implementations // Ensure the version number matches the Plugin Manifest information. foreach (var item in _pluginsManifests) { - if (item.Path.Equals(plugin.AssemblyFilePath, StringComparison.OrdinalIgnoreCase)) + if (Path.GetDirectoryName(plugin.AssemblyFilePath).Equals(item.Path, StringComparison.OrdinalIgnoreCase)) { // Update version number to that of the manifest. assemblyPlugin.SetAttributes( From b879fb615ebd5b922f3914021a4cdf892da12365 Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Fri, 20 Nov 2020 15:19:46 +0000 Subject: [PATCH 3/5] Update Emby.Server.Implementations/ApplicationHost.cs Co-authored-by: Cody Robibero --- Emby.Server.Implementations/ApplicationHost.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 073baf6c0f..2d9ef7e40d 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -181,7 +181,7 @@ namespace Emby.Server.Implementations private IPlugin[] _plugins; - private IEnumerable _pluginsManifests; + private IReadOnlyList _pluginsManifests; /// /// Gets the plugins. From 972ed3ccfe3b669ca3e3d53aa68b12ddabc9a613 Mon Sep 17 00:00:00 2001 From: Greenback Date: Fri, 20 Nov 2020 18:56:36 +0000 Subject: [PATCH 4/5] fix. --- Emby.Server.Implementations/ApplicationHost.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 2d9ef7e40d..d0dcdab757 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -1112,7 +1112,7 @@ namespace Emby.Server.Implementations { if (Directory.Exists(ApplicationPaths.PluginsPath)) { - _pluginsManifests = GetLocalPlugins(ApplicationPaths.PluginsPath); + _pluginsManifests = GetLocalPlugins(ApplicationPaths.PluginsPath).ToList(); foreach (var plugin in _pluginsManifests) { foreach (var file in plugin.DllFiles) From eed1a40b1935e00e04f6b27c7d307bf110b83b31 Mon Sep 17 00:00:00 2001 From: Greenback Date: Fri, 20 Nov 2020 19:18:18 +0000 Subject: [PATCH 5/5] Fixed tests --- Emby.Server.Implementations/ApplicationHost.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index d0dcdab757..cf7751c369 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -774,7 +774,7 @@ namespace Emby.Server.Implementations foreach (var plugin in Plugins) { - if (plugin is IPluginAssembly assemblyPlugin) + if (_pluginsManifests != null && plugin is IPluginAssembly assemblyPlugin) { // Ensure the version number matches the Plugin Manifest information. foreach (var item in _pluginsManifests)