private string[] ReadDlls(string[] args, Link link) { var dllsToReplace = new List <string>(); var dllNames = args[3].Split('=')[1].Split(','); foreach (var dll in dllNames) { if (dll.EndsWith(".dll")) { var dllWithoutExtension = dll.Substring(0, dll.Length - 4); dllsToReplace.Add(dllWithoutExtension); } else if (dll.EndsWith("*")) { var dllsMatchingWildcard = Directory.GetFiles(link.SourceDirectoryPath, dll).Where(n => n.EndsWith(".dll")).ToArray(); if (dllsMatchingWildcard.Any()) { (var selectedDlls, _) = _ui.AskUserToSelectItems(dllsMatchingWildcard, $"Found these DLLs matching {dll}. Select the ones you want to replace"); var selectedWildcardDlls = dllsMatchingWildcard.Where((d, i) => selectedDlls.Contains(i)).Select(Path.GetFileName).Select(p => p.Substring(0, p.Length - 4)); dllsToReplace.AddRange(selectedWildcardDlls); } else { var canContinue = _ui.Confirmation($"Found no DLLs matching the wildcard \"{dll}\". Continue?"); if (!canContinue) { throw new UserRequestedExecutionStop(); } } } else { dllsToReplace.Add(dll); } } return(dllsToReplace.ToArray()); }