// public Searcher (List<Unit> getAll) // { // throw new NotImplementedException(); // } public List <SearchableEntry> Search(string searchText) { var foundEntries = new List <SearchableEntry>(); var entriesToSearchIn = new List <SearchableEntry>(); if (searchFilter.HasFlag(SearchFilter.Monsters)) { entriesToSearchIn.AddRange(DomEdit.I.monsters.Entries); } if (searchFilter.HasFlag(SearchFilter.Items)) { entriesToSearchIn.AddRange(DomEdit.I.items.Entries); } if (searchFilter.HasFlag(SearchFilter.Magic)) { entriesToSearchIn.AddRange(DomEdit.I.magicPaths.magics); } foreach (var entry in entriesToSearchIn) { if (entry.Name.IndexOf(searchText, StringComparison.OrdinalIgnoreCase) != -1) { foundEntries.Add(entry); if (foundEntries.Count >= MAX_RESULTS) { break; } } } return(foundEntries); }