public ICollection<Uri> Search(string searchFor) { ICollection<Uri> is2 = null; string str; int num; bool flag; MemoryStream os = new MemoryStream(); FormUtility utility = new FormUtility(os, null); if ((((uint) flag) + ((uint) num)) <= uint.MaxValue) { utility.Add("appid", "YahooDemo"); goto Label_00E2; } Label_0093: if (((uint) flag) <= uint.MaxValue) { os.Dispose(); Uri uri = new Uri("http://search.yahooapis.com/WebSearchService/V1/webSearch?" + str); num = 0; flag = false; while (!flag) { try { is2 = this.x7cdeaeac68d869b5(uri); flag = true; } catch (IOException) { do { if (num == 5) { throw; } Thread.Sleep(0x1388); } while ((((uint) flag) - ((uint) num)) > uint.MaxValue); } num++; } return is2; } Label_00E2: utility.Add("results", "100"); utility.Add("query", searchFor); utility.Complete(); str = new ASCIIEncoding().GetString(os.GetBuffer()); goto Label_0093; }
/// <summary> /// Perform a Yahoo search. /// </summary> /// <param name="searchFor">What are we searching for.</param> /// <returns>The URLs that contain the specified item.</returns> public ICollection<Uri> Search(String searchFor) { ICollection<Uri> result = null; // build the Uri var mstream = new MemoryStream(); var form = new FormUtility(mstream, null); form.Add("appid", "YahooDemo"); form.Add("results", "100"); form.Add("query", searchFor); form.Complete(); var enc = new ASCIIEncoding(); String str = enc.GetString(mstream.GetBuffer()); mstream.Dispose(); var uri = new Uri( "http://search.yahooapis.com/WebSearchService/V1/webSearch?" + str); int tries = 0; bool done = false; while (!done) { try { result = DoSearch(uri); done = true; } catch (IOException e) { if (tries == 5) { throw; } Thread.Sleep(5000); } tries++; } return result; }