-
Notifications
You must be signed in to change notification settings - Fork 0
/
Event.cs
42 lines (34 loc) · 1.23 KB
/
Event.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using HtmlAgilityPack;
namespace FIRST
{
public class Event : Dictionary<string, string>
{
private static WebClient client;
public string Name { get { return this["Name"]; } }
public string Venue { get { return this["Event Venue"]; } }
public string Location { get { return this["Location"]; } }
public string Date { get { return this["Date"]; } }
public void LoadEventDetails()
{
if (client == null)
client = new WebClient();
string result = client.DownloadString(EventLoader.LassoLocation + this["Link"]);
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(result);
foreach (HtmlNode row in doc.DocumentNode.GetNodesByClass("tr"))
{
Console.WriteLine(row.OuterHtml);
List<HtmlNode> entries = row.GetNodesByClass("td").ToList();
if (entries.Count == 2 && entries[1].FirstChild.Name == "a")
{
this.Add(entries[0].InnerText, entries[1].FirstChild.InnerText);
}
}
}
}
}