Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void button8_Click(object sender, EventArgs e)
- {
- var wc = new WebClient{Encoding = Encoding.UTF8};
- wc.DownloadStringCompleted += ObtainItemName;
- wc.DownloadStringAsync(new Uri(uiURL_Items.Text));
- }
- static int titlelen = "<title>".Length;
- private void ObtainItemName(object sender, DownloadStringCompletedEventArgs e)
- {
- if (e.Error != null)
- {
- MessageBox.Show(e.ToString(), "Exception while loading file");
- return;
- }
- var s = e.Result.Split('\n');
- var r = "<error>";
- if (s.Length < 4)
- {
- uiResult_Items.Text = r;
- return;
- }
- var line = s[3];
- line = line.Remove(0, titlelen);
- var id = line.IndexOf(" - Aion", StringComparison.Ordinal);
- line = line.Remove(id);
- if (string.IsNullOrWhiteSpace(line))
- {
- uiResult_Items.Text = r;
- return;
- }
- r = line;
- uiResult_Items.Text = r;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement