diff --git a/TVRename/Forms/UI.cs b/TVRename/Forms/UI.cs index 439a41cc..e748de0b 100644 --- a/TVRename/Forms/UI.cs +++ b/TVRename/Forms/UI.cs @@ -1066,14 +1066,14 @@ private void UI_FormClosing(object sender, FormClosingEventArgs e) private void ChooseSiteMenu([NotNull] ToolStripSplitButton btn) { btn.DropDownItems.Clear(); - Searchers searchers = GetUsedSearchers(); + btn.DropDownItems.AddRange(GetUsedSearchers().Where(engine => engine.Name.HasValue()).Select(CreateSearcherMenuItem).ToArray()); + } - foreach (SearchEngine search in searchers.Where(engine => engine.Name.HasValue())) - { - ToolStripMenuItem tsi = new ToolStripMenuItem(search.Name) {Tag = search}; - tsi.Font = new Font(tsi.Font.FontFamily,9,FontStyle.Regular); - btn.DropDownItems.Add(tsi); - } + private static ToolStripItem CreateSearcherMenuItem(SearchEngine search) + { + ToolStripMenuItem tsi = new ToolStripMenuItem(search.Name) {Tag = search}; + tsi.Font = new Font(tsi.Font.FontFamily, 9, FontStyle.Regular); + return tsi; } private void FillMyShows() @@ -3847,11 +3847,11 @@ private void UpdateActionCheckboxes() SetCheckbox(mcbAll, all.Actions, chk.OfType()); } - private IEnumerable RenameActions(IEnumerable all) + private static IEnumerable RenameActions(IEnumerable all) { return all.Where(a => - (a is ActionCopyMoveRename cmr && cmr.Operation == ActionCopyMoveRename.Op.rename) || - (a is ActionMoveRenameDirectory)); + a is ActionCopyMoveRename {Operation: ActionCopyMoveRename.Op.rename} || + a is ActionMoveRenameDirectory); } private static void SetCheckbox([NotNull] ToolStripMenuItem box,[NotNull] IEnumerable all, [NotNull] IEnumerable chk)