removed exception

This commit is contained in:
Greenback 2020-12-18 22:17:46 +00:00
parent 9bf970e5c6
commit d34428f2f7

View File

@ -80,7 +80,7 @@ namespace Emby.Server.Implementations.Plugins
// Now load the assemblies..
foreach (var plugin in _plugins)
{
CheckIfStillSuperceded(plugin);
UpdatePluginSuperceedStatus(plugin);
if (plugin.IsEnabledAndSupported == false)
{
@ -134,7 +134,7 @@ namespace Emby.Server.Implementations.Plugins
continue;
}
CheckIfStillSuperceded(plugin);
UpdatePluginSuperceedStatus(plugin);
if (!plugin.IsEnabledAndSupported)
{
continue;
@ -172,7 +172,7 @@ namespace Emby.Server.Implementations.Plugins
// Load the plugin.
var plugin = LoadManifest(folder);
// Make sure we haven't already loaded this.
if (plugin == null || _plugins.Any(p => p.Manifest.Equals(plugin.Manifest)))
if (_plugins.Any(p => p.Manifest.Equals(plugin.Manifest)))
{
return;
}
@ -435,7 +435,7 @@ namespace Emby.Server.Implementations.Plugins
}
}
private void CheckIfStillSuperceded(LocalPlugin plugin)
private void UpdatePluginSuperceedStatus(LocalPlugin plugin)
{
if (plugin.Manifest.Status != PluginStatus.Superceded)
{
@ -464,7 +464,6 @@ namespace Emby.Server.Implementations.Plugins
{
Directory.Delete(plugin.Path, true);
_logger.LogDebug("Deleted {Path}", plugin.Path);
_plugins.Remove(plugin);
}
#pragma warning disable CA1031 // Do not catch general exception types
catch
@ -476,9 +475,7 @@ namespace Emby.Server.Implementations.Plugins
return _plugins.Remove(plugin);
}
private LocalPlugin? LoadManifest(string dir)
{
try
private LocalPlugin LoadManifest(string dir)
{
Version? version;
PluginManifest? manifest = null;
@ -542,14 +539,6 @@ namespace Emby.Server.Implementations.Plugins
return new LocalPlugin(dir, true, manifest);
}
#pragma warning disable CA1031 // Do not catch general exception types
catch (Exception ex)
#pragma warning restore CA1031 // Do not catch general exception types
{
_logger.LogError(ex, "Something went wrong!");
return null;
}
}
/// <summary>
/// Gets the list of local plugins.
@ -566,14 +555,9 @@ namespace Emby.Server.Implementations.Plugins
}
var directories = Directory.EnumerateDirectories(_pluginsPath, "*.*", SearchOption.TopDirectoryOnly);
LocalPlugin? entry;
foreach (var dir in directories)
{
entry = LoadManifest(dir);
if (entry != null)
{
versions.Add(entry);
}
versions.Add(LoadManifest(dir));
}
string lastName = string.Empty;
@ -582,7 +566,7 @@ namespace Emby.Server.Implementations.Plugins
// The first item will be the latest version.
for (int x = versions.Count - 1; x >= 0; x--)
{
entry = versions[x];
var entry = versions[x];
if (!string.Equals(lastName, entry.Name, StringComparison.OrdinalIgnoreCase))
{
entry.DllFiles.AddRange(Directory.EnumerateFiles(entry.Path, "*.dll", SearchOption.AllDirectories));