protected override void DoTranslate(string phrase, LanguagePair languagesPair, string subject, Result result, NetworkSetting networkSetting) { string query = "http://www.slovnenya.com/dictionary/{0}"; query = string.Format(query, HttpUtility.UrlEncode(phrase).Replace("+", "%20")); WebRequestHelper helper = new WebRequestHelper(result, new Uri(query), networkSetting, WebRequestContentType.UrlEncodedGet); helper.AcceptLanguage = "en-us,en"; string responseFromServer = helper.GetResponse(); if (responseFromServer.Contains("did not return any results</div>") || responseFromServer.Contains("</span>` did not return any results")) { result.ResultNotFound = true; throw new TranslationException("Nothing found"); } else if (responseFromServer.IndexOf("Query contains extraneous symbol(s)<") >= 0) { throw new TranslationException("Query contains extraneous symbols"); } else { result.ArticleUrl = query; result.ArticleUrlCaption = phrase; string translation = StringParser.Parse("<hr style=\"border:0;background-color:grey;height:1px;width:92%;text-align:center\" />", "<hr style=\"border:0;background-color:grey;height:1px;width:92%;text-align:center\" />", responseFromServer); StringsTree tree = StringParser.ParseTreeStructure("<table", "</table>", translation); if (tree.Childs.Count != 1) { throw new TranslationException("Wrong data structure"); } tree = tree.Childs[0]; if (tree.Childs.Count != 1) { throw new TranslationException("Wrong data structure"); } tree = tree.Childs[0]; Result wordres = result; if (tree.Childs.Count == 0) { throw new TranslationException("Wrong data structure"); } //get word if (tree.Childs[0].Childs.Count != 1) { throw new TranslationException("Wrong data structure"); } string word = StringParser.Parse("font-size:14pt\">", "<", tree.Childs[0].Childs[0].Data); for (int i = 1; i < tree.Childs.Count; i++) { StringsTree abbr_tree = tree.Childs[i]; Result abbrres = null; string abbr = StringParser.Parse("font-size:12pt\">", "<", abbr_tree.Data); Result tmpRes = CreateNewResult(abbr, languagesPair, subject); wordres.Childs.Add(tmpRes); abbrres = tmpRes; StringParser parser = new StringParser(abbr_tree.Childs[0].Data); string[] translations = parser.ReadItemsList("font-size:12pt\">", "<"); foreach (string trans in translations) { abbrres.Translations.Add(trans); } } } }