static ICollection <string> FindFileKeys(InstallPackage pkg, ICollection <string> fileNames) { List <string> fileKeys = null; if (fileNames != null) { fileKeys = new List <string>(); foreach (string fileName in fileNames) { string[] foundFileKeys = null; if (fileName.IndexOfAny(new char[] { '*', '?' }) >= 0) { foundFileKeys = pkg.FindFiles(FilePatternToRegex(fileName)); } else { foundFileKeys = pkg.FindFiles(fileName); } fileKeys.AddRange(foundFileKeys); } if (fileKeys.Count == 0) { throw new FileNotFoundException("Files not found in package."); } } return(fileKeys); }