private static bool isHostMatch(string pattern, string name) { FileNameMatcher fn; try { fn = new FileNameMatcher(pattern, null); } catch (InvalidPatternException) { return false; } fn.Append(name); return fn.IsMatch(); }