public IEnumerable <KspPartObject> LookupParts(RegexFilter partFilter) { int id; if (int.TryParse(partFilter.Pattern, out id)) { var dependency = craft.Child <KspPartObject> (id); return(dependency != null ? new[] { dependency } : Enumerable.Empty <KspPartObject> ()); } return(partFilter.Apply(craft.Children <KspPartObject> (), part => part.Name)); }
public IEnumerable <KspCraftObject> LookupCrafts(RegexFilter craftFilter) { var allCrafts = (kspObjTree is KspCraftObject) ? new[] { kspObjTree as KspCraftObject } : kspObjTree.Children <KspCraftObject> (recursive: true); return(craftFilter.Apply(allCrafts, craft => craft.Name)); }