Public Class SectionLister
Dim lastEntry As Boolean = False
Dim nextEntry As Integer
Dim lastItem As Boolean = False
Dim nextItem As Integer
Dim torrentTable As DataTable
Dim subProgress As ProgressBar
Dim subLabel As Label
Function List(ByVal sectionUrl As String, ByVal subProgress As ProgressBar, ByVal subLabel As Label) As DataTable
torrentTable = New DataTable
Dim _id As DataColumn = New DataColumn("ID")
_id.DataType = System.Type.GetType("System.Int32")
torrentTable.Columns.Add(_id)
Dim _time As DataColumn = New DataColumn("Time")
_time.DataType = System.Type.GetType("System.String")
torrentTable.Columns.Add(_time)
Dim _section As DataColumn = New DataColumn("Section")
_section.DataType = System.Type.GetType("System.String")
torrentTable.Columns.Add(_section)
Dim _name As DataColumn = New DataColumn("Name")
_name.DataType = System.Type.GetType("System.String")
torrentTable.Columns.Add(_name)
Dim _url As DataColumn = New DataColumn("URL")
_url.DataType = System.Type.GetType("System.String")
torrentTable.Columns.Add(_url)
Dim _size As DataColumn = New DataColumn("Size")
_size.DataType = System.Type.GetType("System.String")
torrentTable.Columns.Add(_size)
Dim _seeds As DataColumn = New DataColumn("Seeds")
_seeds.DataType = System.Type.GetType("System.Int32")
torrentTable.Columns.Add(_seeds)
Dim _peers As DataColumn = New DataColumn("Peers")
_peers.DataType = System.Type.GetType("System.Int32")
torrentTable.Columns.Add(_peers)
Dim _quality As DataColumn = New DataColumn("Quality")
_quality.DataType = System.Type.GetType("System.String")
torrentTable.Columns.Add(_quality)
Dim _donor As DataColumn = New DataColumn("Donor")
_donor.DataType = System.Type.GetType("System.String")
torrentTable.Columns.Add(_donor)
Dim _donorrank As DataColumn = New DataColumn("Donor Rank")
_donorrank.DataType = System.Type.GetType("System.String")
torrentTable.Columns.Add(_donorrank)
Dim _info As DataColumn = New DataColumn("Info URL")
_info.DataType = System.Type.GetType("System.String")
torrentTable.Columns.Add(_info)
Dim getsubs As New SubsectionLister
Dim http As New Connecter
Dim subsectionList As Hashtable = getsubs.List(sectionUrl)
subProgress.Maximum = subsectionList.Count
Dim entry As DictionaryEntry
For Each entry In subsectionList
Dim url As String = CType(entry.Value, String)
Dim title As String = CType(entry.Key, String)
subProgress.Update()
subProgress.Value += 1
subLabel.Text = "Listing: " & title
Dim html As String = http.Download(url)
ListSingleSection(html)
Next entry
subProgress.Value = 0
subLabel.Text = ""
Return torrentTable
End Function