private static bool CheckDictQuery(string dict, string input) { int bracketLevel = 0; int lastSection = 0; List <string> elements = new List <string>(); // Separate the input into sections for (int index = 0; index < input.Length; index++) { if (input[index].Equals('{')) { bracketLevel++; } if (input[index].Equals('}')) { bracketLevel--; } // Section divider if (input[index].Equals(':')) { // Not in brackets if (bracketLevel == 0) { // Add previous element elements.Add(input.Substring(lastSection, index - lastSection)); lastSection = index + 1; } } } // Add previous element elements.Add(input.Substring(lastSection, input.Length - lastSection)); DictionaryI18n currentDict = selectDictionary(dict); if (currentDict == null) { return(false); } return(currentDict.KeyExists(elements[0])); }