From 08fbf81f2a4fc142a790226b11374ca949077460 Mon Sep 17 00:00:00 2001 From: Mik1ll <27949189+Mik1ll@users.noreply.github.com> Date: Sun, 31 Jan 2021 16:46:56 -0800 Subject: [PATCH] Fix renamer ordering. (#871) * Fix renamer ordering. Requested renamer is first. Then by RenamerPriorities (those without values go last). Then by lexical name. * Don't ignore case when sorting. --- Shoko.Server/Renamer/RenameFileHelper.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Shoko.Server/Renamer/RenameFileHelper.cs b/Shoko.Server/Renamer/RenameFileHelper.cs index 820a1d00c..e02b57504 100644 --- a/Shoko.Server/Renamer/RenameFileHelper.cs +++ b/Shoko.Server/Renamer/RenameFileHelper.cs @@ -126,9 +126,9 @@ internal static void FindRenamers(IList assemblies) } public static IList GetPluginRenamersSorted(string renamerName) => - _getEnabledRenamers(renamerName).OrderBy(a => renamerName == a.Key ? int.MaxValue : 0) - .ThenBy(a => ServerSettings.Instance.Plugins.Priority.Contains(a.Key) ? ServerSettings.Instance.Plugins.Priority.IndexOf(a.Key) : int.MaxValue) - .ThenBy(a => a.Key) + _getEnabledRenamers(renamerName).OrderBy(a => renamerName == a.Key ? 0 : int.MaxValue) + .ThenBy(a => ServerSettings.Instance.Plugins.RenamerPriorities.ContainsKey(a.Key) ? ServerSettings.Instance.Plugins.RenamerPriorities[a.Key] : int.MaxValue) + .ThenBy(a => a.Key, StringComparer.InvariantCulture) .Select(a => (IRenamer)ActivatorUtilities.CreateInstance(ShokoServer.ServiceContainer, a.Value.type)).ToList(); private static IEnumerable> _getEnabledRenamers(string renamerName)