Skip to content

Commit

Permalink
Fix renamer ordering. (#871)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
Mik1ll authored Feb 1, 2021
1 parent 0bd9192 commit 08fbf81
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Shoko.Server/Renamer/RenameFileHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ internal static void FindRenamers(IList<Assembly> assemblies)
}

public static IList<IRenamer> 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<KeyValuePair<string, (Type type, string description)>> _getEnabledRenamers(string renamerName)
Expand Down

0 comments on commit 08fbf81

Please sign in to comment.