Imports System.Net
Public Class Form1
Private WithEvents httpclient As WebClient
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Public Sub DownloadFile1( _
ByVal sourceURL As Uri, _
ByVal filedir As String _
)
End Sub
Public Sub DownloadFile2( _
ByVal sourceURL2 As Uri, _
ByVal filedir As String _
)
End Sub
Public Sub DownloadFile3( _
ByVal sourceURL3 As Uri, _
ByVal filedir As String _
)
End Sub
Public Sub DownloadFile4( _
ByVal sourceURL4 As Uri, _
ByVal filedir As String _
)
End Sub
Public Sub DownloadFile5( _
ByVal sourceURL5 As Uri, _
ByVal filedir As String _
)
End Sub
Public Sub DownloadFile6( _
ByVal sourceURL6 As Uri, _
ByVal filedir As String _
)
End Sub
Public Sub DownloadFile7( _
ByVal sourceURL7 As Uri, _
ByVal filedir As String _
)
End Sub
Public Sub DownloadFile8( _
ByVal sourceURL8 As Uri, _
ByVal filedir As String _
)
End Sub
Public Sub DownloadFile9( _
ByVal sourceURL9 As Uri, _
ByVal filedir As String _
)
End Sub
Public Sub DownloadFile10( _
ByVal sourceURL10 As Uri, _
ByVal filedir As String _
)
End Sub
Private Sub ButtonItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem1.Click
httpclient = New WebClient
Dim sourceURL = TextBoxX2.Text
Dim sourceURL2 = TextBoxX3.Text
My.Resources.gear.Save(My.Computer.FileSystem.SpecialDirectories.Temp & "\tempicon.ico", Imaging.ImageFormat.Icon)
NotifyIcon1.Icon = My.Resources.gear1
Refresh()
NotifyIcon1.Text = "Downloading in progress - MC Downloader"
NotifyIcon1.BalloonTipIcon = ToolTipIcon.Info
NotifyIcon1.BalloonTipText = "Downloading files"
NotifyIcon1.BalloonTipTitle = "MC Downloader"
NotifyIcon1.ShowBalloonTip(10000)
Dim sourceURL3 = TextBoxX4.Text
Dim sourceURL4 = TextBoxX5.Text
Dim sourceURL5 = TextBoxX6.Text
Dim sourceURL6 = TextBoxX7.Text
Dim sourceURL7 = TextBoxX8.Text 'v
Dim sourceURL8 = TextBoxX9.Text
Dim sourceURL9 = TextBoxX10.Text
Dim sourceURL10 = TextBoxX11.Text
Dim filedir As String = TextBoxX1.Text
filedir = TextBoxX1.Text
Try
Dim filename As String = sourceURL.Substring(sourceURL.LastIndexOf("/") + 1)
'And append the file name to the folder path
Dim saveTo As String = filedir & "\" & filename
DownloadFile1(New Uri(sourceURL), saveTo)
ProgressBarX2.Value = "100"
Catch ex As Exception
MsgBox("Failed " + ErrorToString(), MsgBoxStyle.Critical)
End Try
If CheckBoxX1.Checked = True Then
Try
Dim filename As String = sourceURL2.Substring(sourceURL2.LastIndexOf("/") + 1)
'And append the file name to the folder path
Dim saveTo As String = filedir & "\" & filename
DownloadFile2(New Uri(sourceURL2), saveTo)
ProgressBarX3.Value = "100"
Catch ex As Exception
MsgBox("Failed " + ErrorToString(), MsgBoxStyle.Critical)
End Try
End If
'effe wachten...
'klaar ga verder dan..
If CheckBoxX2.Checked = True Then
Try
Dim filename As String = sourceURL3.Substring(sourceURL3.LastIndexOf("/") + 1)
'And append the file name to the folder path
Dim saveTo As String = filedir & "\" & filename
DownloadFile3(New Uri(sourceURL3), saveTo)
ProgressBarX4.Value = "100"
Catch ex As Exception
MsgBox("Failed " + ErrorToString(), MsgBoxStyle.Critical)
End Try
End If
'effe wachten...
'klaar ga verder dan..
If CheckBoxX3.Checked = True Then
Try
Dim filename As String = sourceURL4.Substring(sourceURL4.LastIndexOf("/") + 1)
'And append the file name to the folder path
Dim saveTo As String = filedir & "\" & filename
DownloadFile4(New Uri(sourceURL4), saveto)
ProgressBarX5.Value = "100"
Catch ex As Exception
MsgBox("Failed " + ErrorToString(), MsgBoxStyle.Critical)
End Try
End If
'effe wachten...
'klaar ga verder dan..
If CheckBoxX4.Checked = True Then
Try
Dim filename As String = sourceURL5.Substring(sourceURL5.LastIndexOf("/") + 1)
'And append the file name to the folder path
Dim saveTo As String = filedir & "\" & filename
DownloadFile5(New Uri(sourceURL5), saveTo)
ProgressBarX6.Value = "100"
Catch ex As Exception
MsgBox("Failed " + ErrorToString(), MsgBoxStyle.Critical)
End Try
End If
'effe wachten...
'klaar ga verder dan..
If CheckBoxX5.Checked = True Then
Try
Dim filename As String = sourceURL6.Substring(sourceURL6.LastIndexOf("/") + 1)
'And append the file name to the folder path
Dim saveTo As String = filedir & "\" & filename
DownloadFile6(New Uri(sourceURL6), saveTo)
ProgressBarX7.Value = "100"
Catch ex As Exception
MsgBox("Failed " + ErrorToString(), MsgBoxStyle.Critical)
End Try
End If
'effe wachten...
'klaar ga verder dan..
If CheckBoxX6.Checked = True Then
Try
Dim filename As String = sourceURL7.Substring(sourceURL7.LastIndexOf("/") + 1)
'And append the file name to the folder path
Dim saveTo As String = filedir & "\" & filename
DownloadFile7(New Uri(sourceURL7), saveTo)
ProgressBarX8.Value = "100"
Catch ex As Exception
MsgBox("Failed " + ErrorToString(), MsgBoxStyle.Critical)
End Try
End If
'effe wachten...
'klaar ga verder dan..
If CheckBoxX7.Checked = True Then
Try
Dim filename As String = sourceURL8.Substring(sourceURL8.LastIndexOf("/") + 1)
'And append the file name to the folder path
Dim saveTo As String = filedir & "\" & filename
DownloadFile8(New Uri(sourceURL8), saveTo)
ProgressBarX9.Value = "100"
Catch ex As Exception
MsgBox("Failed " + ErrorToString(), MsgBoxStyle.Critical)
End Try
End If
'effe wachten...
'klaar ga verder dan..
If CheckBoxX8.Checked = True Then
Try
Dim filename As String = sourceURL9.Substring(sourceURL9.LastIndexOf("/") + 1)
'And append the file name to the folder path
Dim saveTo As String = filedir & "\" & filename
DownloadFile9(New Uri(sourceURL9), saveTo)
ProgressBarX10.Value = "100"
Catch ex As Exception
MsgBox("Failed " + ErrorToString(), MsgBoxStyle.Critical)
End Try
End If
'effe wachten...
'klaar ga verder dan..
If CheckBoxX9.Checked = True Then
Try
Dim filename As String = sourceURL10.Substring(sourceURL10.LastIndexOf("/") + 1)
'And append the file name to the folder path
Dim saveTo As String = filedir & "\" & filename
DownloadFile10(New Uri(sourceURL10), saveto)
ProgressBarX11.Value = "100"
Catch ex As Exception
MsgBox("Failed " + ErrorToString(), MsgBoxStyle.Critical)
End Try
End If
If ProgressBarX1.Value > "99" Then
NotifyIcon1.Icon = My.Resources.tick1
NotifyIcon1.Text = "Done - MC Downloader"
NotifyIcon1.BalloonTipIcon = ToolTipIcon.Info
NotifyIcon1.BalloonTipText = "Downloading finished"
NotifyIcon1.BalloonTipTitle = "MC Downloader"
NotifyIcon1.ShowBalloonTip(10000)
ProgressBarX1.Refresh()
End If
End Sub
Private Sub ButtonX1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX1.Click
Dim save As New FolderBrowserDialog
save.Description = "Download Directory"
save.ShowDialog()
TextBoxX1.Text = save.SelectedPath
End Sub
Private Sub httpclient_DownloadFileCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs) Handles httpclient.DownloadFileCompleted
End Sub
Private Sub httpclient_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles httpclient.DownloadProgressChanged
ProgressBarX1.Value = e.ProgressPercentage
End Sub