I am testing it every time I make changes. However now that I feel
like I am getting somewhere when I launch the application it just
stands still. VB.Net isn't showing errors and I am not quite sure
what is wrong.
Imports System.IO
Public Class Form1
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
DownloadPatchNames_txt()
Timer1.Start()
End Sub
Private Sub DownloadPatchNames_txt()
Dim PatchNamesRequest As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("https://dl.dropbox.com/u/89372994/Warcraft%20Battlegrounds/PatchNames.txt")
Dim PatchNamesResponse As System.Net.HttpWebResponse = PatchNamesRequest.GetResponse()
Dim PatchNamesStream As System.IO.StreamReader = New System.IO.StreamReader(PatchNamesResponse.GetResponseStream())
While Not PatchNamesStream.EndOfStream
Dim PatchName As String = PatchNamesStream.ReadLine()
ComboBox1.Items.Add(PatchName)
End While
DownloadPatchLocations_txt()
End Sub
Private Sub DownloadPatchLocations_txt()
Dim PatchLocationsRequest As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("https://dl.dropbox.com/u/89372994/Warcraft%20Battlegrounds/PatchLocations.txt")
Dim PatchLocationsResponse As System.Net.HttpWebResponse = PatchLocationsRequest.GetResponse()
Dim PatchLocationsStream As System.IO.StreamReader = New System.IO.StreamReader(PatchLocationsResponse.GetResponseStream())
While Not PatchLocationsStream.EndOfStream
Dim PatchLocations As String = PatchLocationsStream.ReadLine()
ComboBox2.Items.Add(PatchLocations)
End While
CheckForPatch()
End Sub
Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
ComboBox2.SelectedIndex = ComboBox1.SelectedIndex
End Sub
Private Sub CheckForPatch()
ComboBox1.SelectedIndex = ComboBox1.SelectedIndex + 1
If ComboBox2.Text = ("Data/") Then
If File.Exists(My.Computer.FileSystem.CurrentDirectory & "/Data/" & ComboBox1.Text) Then
CheckForPatch()
Else
Label3.Text = ("Downloading: " & ComboBox1.Text)
Using mywc As New System.Net.WebClient
AddHandler mywc.DownloadProgressChanged, AddressOf pchanged
AddHandler mywc.DownloadFileCompleted, AddressOf done
mywc.DownloadFileAsync(New Uri("https://dl.dropbox.com/u/89372994/Warcraft%20Battlegrounds/" & ComboBox1.Text), My.Computer.FileSystem.CurrentDirectory & "/Data/" & ComboBox1.Text)
End Using
End If
End If
If ComboBox2.Text = ("Data/enUS/") Then
If File.Exists(My.Computer.FileSystem.CurrentDirectory & "/Data/enUS/" & ComboBox1.Text) Then
CheckForPatch()
Else
Label3.Text = ("Downloading: " & ComboBox1.Text)
Using mywc As New System.Net.WebClient
AddHandler mywc.DownloadProgressChanged, AddressOf pchanged
AddHandler mywc.DownloadFileCompleted, AddressOf done
mywc.DownloadFileAsync(New Uri("https://dl.dropbox.com/u/89372994/Warcraft%20Battlegrounds/" & ComboBox1.Text), My.Computer.FileSystem.CurrentDirectory & "/Data/enUS/" & ComboBox1.Text)
End Using
End If
End If
End Sub
Sub pchanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs)
ProgressBar1.Value = e.ProgressPercentage
End Sub
Sub done(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs)
' Notify if download is completed successfully
If e.Error Is Nothing Then
ProgressBar1.Value = ProgressBar1.Minimum
ProgressBar1.Style = ProgressBarStyle.Marquee
Label3.Text = ("Applying: " & ComboBox1.Text)
Timer2.Start()
Else
MsgBox(e.Error.Message)
End If
End Sub
Private Sub Timer2_Tick(sender As System.Object, e As System.EventArgs) Handles Timer2.Tick
ProgressBar2.Value = ProgressBar2.Value + 1
If ProgressBar2.Value = ProgressBar2.Maximum Then
ProgressBar1.Style = ProgressBarStyle.Blocks
ProgressBar2.Value = ProgressBar2.Minimum
CheckForPatch()
Timer2.Stop()
End If
End Sub
End Class

New Topic/Question
Reply



MultiQuote



|