此程序是一个POJ监视器
代码写的极其ws, 请见谅。
Imports System.Net
Imports System.Threading
Module Module1
Sub Main()
Console.Title = "POJ Monitor"
Using wc As New WebClient()
Dim Record As String()
Dim NowS, NewS As String
NowS = ""
NewS = ""
Do While True
Try
NewS = wc.DownloadString("http://poj.org/status")
If NewS = NowS Then
Continue Do
End If
Beep()
Console.Clear()
NowS = NewS
Record = Split(NowS, Chr(10))
Dim LineNum As Int32 = 0
For i = 0 To Record.GetUpperBound(0)
‘ Console.WriteLine(Record(i))
If InStr(Record(i), "Run ID") > 0 Then
LineNum = i + 1
Exit For
End If
Next
For i = LineNum To Record.GetUpperBound(0)
If InStr(Record(i), "</table>") > 0 Then
Exit For
End If
Dim Pen As Boolean = False, Num As Int32 = 0
For j = 0 To Record(i).Length – 1
If Record(i)(j) = "<" Then
If Num > 0 Then
Console.Write(" ")
End If
Pen = False
Num = 0
End If
If Pen Then
Console.Write(Record(i)(j))
Num += 1
End If
If Record(i)(j) = ">" Then
Pen = True
End If
Next
Console.WriteLine()
Next
Catch ex As Exception
End Try
Thread.Sleep(300)
Loop
Console.ReadKey()
End Using
End Sub
End Module
发表评论