private static SpellCheckJson BuildCheckWordsRequest(JObject jsonRequest) { SpellCheckJson scJson = new SpellCheckJson(); JToken parms; scJson.Method = SpellCheckMethod.CheckWords; parms = jsonRequest["params"]; scJson.Language = parms[0].Value<string>(); // The words that need to be checked are passed in via a JavaScript array within a JavaScript array scJson.Words = new List<string>(); foreach (JToken word in parms[1].Values()) { scJson.Words.Add(word.Value<string>()); } return scJson; }
private SpellCheckResultsJson GetCheckWordsResponse(SpellCheckJson sp) { List<string> mispelledWords = new List<string>(); foreach (string word in sp.Words) { // Check to see if the word is in the dictionary // if it is not, it is mispelled if (!HunspellInstance.Spell(word)) { mispelledWords.Add(word); } } SpellCheckResultsJson results = new SpellCheckResultsJson(); results.result = mispelledWords; return results; }