public Dictionary <string, DictionaryEntry> getLocalMap(DictionaryQueryFilters filters) { var entries = getEntries(filters); var f2 = new DictionaryQueryFilters() { categoryPrefix = (filters != null) ? (filters.categoryPrefix ?? filters.category) : null }; return(DictionaryEntry.toMap(entries, f2, categoryDelim)); }
public IEnumerable <DictionaryEntry> getEntries(DictionaryQueryFilters filters) { Dictionary <string, DictionaryEntry> m = null; string lang = (filters != null) ? filters.lang : null; if (lang != null) { var langM = getEntriesForLang(lang, false); if (langM != null) { m = langM; } } else { m = new Dictionary <string, DictionaryEntry>(); foreach (var langM in entriesMapsByLangMap.Values) { if (langM == null) { continue; } foreach (var entry in langM.Values) { if (entry == null) { continue; } m[entry.key] = entry; } } } Dictionary <string, DictionaryEntry> m2 = null; if (filters != null) { m2 = new Dictionary <string, DictionaryEntry>(); foreach (var entry in m.Values) { if (entry == null) { continue; } if ((filters.category != null) && ((entry.category == null) || (entry.category != filters.category))) { continue; } if ((filters.categoryPrefix != null) && ((entry.category == null) || ((entry.category != filters.category) && (!entry.category.StartsWith(filters.categoryPrefix + categoryDelim))))) { continue; } if ((filters.key != null) && ((entry.key == null) || (entry.key != filters.key))) { continue; } if ((filters.keySearch != null) && ((entry.key == null) || (!entry.key.Contains(filters.keySearch)))) { continue; } if ((filters.valueSearch != null) && ((entry.value == null) || (!entry.value.Contains(filters.valueSearch)))) { continue; } m2[entry.key] = entry; } } else { m2 = m; } return((m2 != null) ? (IEnumerable <DictionaryEntry>)m2.Values : new List <DictionaryEntry>()); }