diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index f0a9149220..60cc19db70 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -1564,7 +1564,7 @@ namespace Emby.Server.Implementations /// IEnumerable{Assembly}. protected List> GetComposablePartAssemblies() { - var list = GetPluginAssemblies(); + var list = GetPluginAssemblies(ApplicationPaths.PluginsPath); // Gets all plugin assemblies by first reading all bytes of the .dll and calling Assembly.Load against that // This will prevent the .dll file from getting locked, and allow us to replace it when needed @@ -1615,79 +1615,6 @@ namespace Emby.Server.Implementations protected abstract IEnumerable GetAssembliesWithPartsInternal(); - /// - /// Gets the plugin assemblies. - /// - /// IEnumerable{Assembly}. - private List> GetPluginAssemblies() - { - // Copy pre-installed plugins - var sourcePath = Path.Combine(ApplicationPaths.ApplicationResourcesPath, "plugins"); - CopyPlugins(sourcePath, ApplicationPaths.PluginsPath); - - return GetPluginAssemblies(ApplicationPaths.PluginsPath); - } - - private void CopyPlugins(string source, string target) - { - List files; - - try - { - files = Directory.EnumerateFiles(source, "*.dll", SearchOption.TopDirectoryOnly) - .ToList(); - - } - catch (DirectoryNotFoundException) - { - return; - } - - if (files.Count == 0) - { - return; - } - - foreach (var sourceFile in files) - { - var filename = Path.GetFileName(sourceFile); - var targetFile = Path.Combine(target, filename); - - var targetFileExists = File.Exists(targetFile); - - if (!targetFileExists && ServerConfigurationManager.Configuration.UninstalledPlugins.Contains(filename, StringComparer.OrdinalIgnoreCase)) - { - continue; - } - - if (targetFileExists && GetDllVersion(targetFile) >= GetDllVersion(sourceFile)) - { - continue; - } - - Directory.CreateDirectory(target); - File.Copy(sourceFile, targetFile, true); - } - } - - private Version GetDllVersion(string path) - { - try - { - var result = Version.Parse(FileVersionInfo.GetVersionInfo(path).FileVersion); - - Logger.LogInformation("File {Path} has version {Version}", path, result); - - return result; - } - catch (Exception ex) - { - Logger.LogError(ex, "Error getting version number from {Path}", path); - - return new Version(1, 0); - } - } - private List> GetPluginAssemblies(string path) { try