private void btnReadData_Click(object sender, RoutedEventArgs e) { OpenFileDialog openFile = new OpenFileDialog(); if (openFile.ShowDialog() == false) { return; } using (StreamReader sr = new StreamReader(openFile.FileName, Encoding.Default, false)) { int i = 0; while (!sr.EndOfStream && i < 5) { string link = sr.ReadLine(); link += "/description/"; string htmlstr = HtmlHelper.GetResponseString(link); string title = RegualerHelper.GetTitle(htmlstr); string content = RegualerHelper.GetContent(htmlstr); link = link.Replace("problems", "articles").Replace("/description/", ""); htmlstr = HtmlHelper.GetResponseString(link); string solution = RegualerHelper.GetSolution(htmlstr); ModelList.Add(new ProblemModel() { Title = title, Discrition = content, Solution = solution }); i++; } } }
private void btnRegex_Click(object sender, RoutedEventArgs e) { string inputstr = txtOutput.Text; //txtOutput.Text = RegualerHelper.GetAllMatches(inputstr, txtUrl.Text); txtOutput.Text = RegualerHelper.GetSolution(inputstr); }