示例#1
0
        private IEnumerable<WikiSearchResult> ParseResult(string webResult)
        {
            var result = new List<WikiSearchResult>();

            try
            {
                var jWikis = JObject.Parse(webResult);
                var wikis = jWikis["query"]["search"];

                foreach (var w in wikis)
                {
                    var wsr = new WikiSearchResult();

                    wsr.Title = w["title"].Value<string>();
                    wsr.Url = string.Format(wikiUrl, wsr.Title);

                    Uri uri;
                    if (Uri.TryCreate(wsr.Url, UriKind.Absolute, out uri))
                    {
                        result.Add(wsr);
                    }
                }
            }
            catch { }

            return result;
        }
示例#2
0
 private SearchResultListItem MapWikiSearch(WikiSearchResult wsr)
 {
     return new SearchResultListItem
     {
         Text = wsr.Title,
         Url = wsr.Url
     };
 }