public YahooStockServer(Country param) : base(param) { if (YahooStockServer.servers.ContainsKey(param)) { this.baseURL = YahooStockServer.servers[param]; } else { this.baseURL = null; } }
public URL(URL baseUrl, string str) { _UrlString = str; }
// The returned URLs, shouldn't have any duplication with visited, // and they are unique. Although is more suitable that we use Set, // use List is more convinient for us to iterate. private List<URL> getURLs(String respond, List<URL> visited) { List<URL> urls = new List<URL>(); MatchCollection matcher = urlPattern.Matches(respond); for (int i = 0; i < matcher.Count; i++) { String str = matcher[i].Value; try { URL url = new URL(baseURL, str); if ((urls.Contains(url) == false) && (visited.Contains(url) == false)) { urls.Add(url); } } catch (Exception ex) { log.Error("", ex); } } return urls; }