private bool New() { WebCapture cap = new WebCapture(); // setup web-capture configuration cap.UseProxy = UseProxy; cap.ProxyAddress = ProxyAddress; cap.ConnectionsRetries = ConnectionsRetries; string url = @"http://www.asx.com.au/asx/research/ASXListedCompanies.csv"; string page = cap.DownloadHtmlWebPage(url); foreach (string line in page.Split('\n')) { string[] items = line.Split(','); if (items.Length == 3 && !items[0].Contains("Company")) { string name = items[0].Trim().TrimEnd(new char[] { '\"' }).TrimStart(new char[] { '\"' }); string symbol = items[1].Trim().TrimEnd(new char[] { '\"' }).TrimStart(new char[] { '\"' }); // add row SymbolTable.AddSymbolTableRow(name, symbol); } } // save creation table SetParameter("Created with Version", CurrentVersion); return(true); }
public WorldInterestRate(WebCapture cap) { this.cap = cap; }
public NameLookup(WebCapture cap) { this.cap = cap; Load(); }
public Optionetics(WebCapture cap, WebForm wbf) { this.cap = cap; this.wbf = wbf; }
public Yahoo(WebCapture cap) { this.cap = cap; }
public MoneyCentral(WebCapture cap) { this.cap = cap; }
public MorningStar(WebCapture cap) { this.cap = cap; }
private void checkIPButton_Click(object sender, EventArgs e) { // disable close button cancelButton.Enabled = false; // xml test // newer parser file is available online, get it // update proxy settings WebCapture cap = new WebCapture(); XmlDocument xml = null; cap.ProxyAddress = ""; cap.UseProxy = false; xml = cap.DownloadXmlWebFile(Config.Local.GetRemoteConfigurationUrl(false)); if (xml != null) { statusTextBox.Text += "Xml: No Proxy Test Passed\r\n"; } else { statusTextBox.Text += "Xml: No Proxy Test Failed (" + Config.Local.GetRemoteConfigurationUrl(false) + ") - '" + cap.LastException + "'\r\n"; } cap.ProxyAddress = ""; cap.UseProxy = true; xml = cap.DownloadXmlWebFile(Config.Local.GetRemoteConfigurationUrl(false)); if (xml != null) { statusTextBox.Text += "Xml: Default IE Proxy Test Passed\r\n"; } else { statusTextBox.Text += "Xml: Default IE Proxy Test Failed (" + Config.Local.GetRemoteConfigurationUrl(false) + ") - '" + cap.LastException + "'\r\n"; } try { RegistryKey regkey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", false); if (regkey != null) { object ps = regkey.GetValue("ProxyServer"); object pe = regkey.GetValue("ProxyEnable"); string ps_string = (ps == null) ? "(null)" : ps.ToString(); string pe_string = (pe == null) ? "(null)" : pe.ToString(); statusTextBox.Text += "Xml: ProxyServer=" + ps_string + " ProxyEnable=" + pe_string + "\r\n"; } } catch { } cap.ProxyAddress = WebRequest.DefaultWebProxy.GetProxy(new Uri(Config.Local.GetRemoteConfigurationUrl(false))).ToString(); cap.UseProxy = true; statusTextBox.Text += "Xml: Default WR ProxyAddress=" + cap.ProxyAddress + "\r\n"; xml = cap.DownloadXmlWebFile(Config.Local.GetRemoteConfigurationUrl(false)); if (xml != null) { statusTextBox.Text += "Xml: Default WR Proxy Test Passed\r\n\r\n"; } else { statusTextBox.Text += "Xml: Default WR Proxy Test Failed (" + Config.Local.GetRemoteConfigurationUrl(false) + ") - '" + cap.LastException + "'\r\n\r\n"; } string who = TESTSITE; AutoResetEvent waiter = new AutoResetEvent(false); Ping pingSender = new Ping(); // When the PingCompleted event is raised, // the PingCompletedCallback method is called. pingSender.PingCompleted += new PingCompletedEventHandler(PingCompletedCallback); // Create a buffer of 32 bytes of data to be transmitted. string data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; byte[] buffer = Encoding.ASCII.GetBytes(data); // Wait 4 seconds for a reply. int timeout = 4000; // Set options for transmission: // The data can go through 64 gateways or routers // before it is destroyed, and the data packet // cannot be fragmented. PingOptions options = new PingOptions(64, true); statusTextBox.Text += "Ping: time to live: " + options.Ttl.ToString() + "\r\n"; statusTextBox.Text += "Ping: Don't fragment: " + options.DontFragment.ToString() + "\r\n"; // Send the ping asynchronously. // Use the waiter as the user token. // When the callback completes, it can wake up this thread. pingSender.SendAsync(who, timeout, buffer, options, waiter); }
public MarketWatch(WebCapture cap) { this.cap = cap; }