private void submit_button_Click(object sender, EventArgs e) { clearControls(); if (selector.SelectedIndex == 0) { Thread cveThread = new Thread(new ThreadStart(makeCVEs)); cveThread.Start(); } else if (selector.SelectedIndex == 1) { int j = 0; List <BID> our_bids = new List <BID>(); string tmp = ""; char[] delimiterChars = { ',' }; string[] bids = this.items_box.Text.Split(delimiterChars); foreach (string b in bids) { BID t = new BID(b); our_bids.Add(t); } our_bids = our_bids.OrderBy(x => x.id).ToList(); foreach (BID b in our_bids) { addTextBoxes2(j, b.id, b.description, false); tmp += b.id + "\r\n\r\n"; tmp += b.description + "\r\n\r\n"; j++; } // copy_box.Text = tmp; } }
public List <BID> curl() { List <BID> associated_bids = new List <BID>(); Regex bid = new Regex(@"/bid/([0-9]+)"); string URI = "http://www.securityfocus.com/bid"; string myParameters = "op=display_list&c=12&vendor=&title=&version=&CVE=" + this.id; WebClient wc = new WebClient(); wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; string HtmlResult = wc.UploadString(URI, myParameters); HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(HtmlResult); HtmlNodeCollection nodes = doc.DocumentNode.SelectSingleNode("//div[@style='padding: 4px;']").SelectNodes(".//a"); if (nodes != null) { foreach (HtmlNode n in nodes) { Match m = bid.Match(n.Attributes["href"].Value); if (m.Success && n.InnerText.Substring(0, 4) != "http") { BID tmp = new BID(m.Groups[1].Captures[0].Value, n.InnerText); associated_bids.Add(tmp); } } } return(associated_bids); }
void showProgress2(int count, BID b, Boolean first) { if (progressBar1.InvokeRequired == false) { addTextBoxes2(count, b.id, b.description, first); } else { showProgress2Delegate ShowProgress2 = new showProgress2Delegate(showProgress2); this.BeginInvoke(ShowProgress2, new object[] { count, b, first }); } }