Right this is what i have so far, basically everything works fine now.
But there is one thing that is wrong which is weird not sure why its doing it but it works after it starts downloading the second part.
How it works:
You click the button and it then runs the 'Background worker' which then checks if the webhost is online then activates the 'download sub' which reads the lines of each links that's within the '.txt' that it finds in the 'DIR'.
Whilst it downloads it shows the files it's downloading ,size of the file, bytes rev, percentage of the download.
But only starts this when it starts on the second link in the '.txt' but still downloads the first of course.
//////////Example//////////////////////////
Imports System.IO
Imports System.Text
Imports System.Net
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Control.CheckForIllegalCrossThreadCalls = False
End Sub
Private Sub GetFile_Button(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
BackgroundWorker1.RunWorkerAsync()
End Sub
Private Sub DownloadTest3()
Dim AppPath As String
AppPath = Environment.CurrentDirectory()
For Each line In IO.File.ReadAllLines(AppPath + "\CheckFiles.txt")
Fulldownload = New WebClient
Fulldownload.DownloadFileAsync(New Uri(line), (AppPath.TrimEnd("\"c) & GetFileNameFromURL(line)))
Next
End Sub
Private Function GetFileNameFromURL(ByVal URL As String) As String
If URL.IndexOf("/"c) = -1 Then Return String.Empty
Return "\" & URL.Substring(URL.LastIndexOf("/"c) + 1)
End Function
Private Sub Fulldownload_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles Fulldownload.DownloadProgressChanged
ProgressBar1.Value = e.ProgressPercentage
Me.lolsize.Text = "FileSize: [" & e.TotalBytesToReceive & "]KB"
Me.lolgetdata.Text = "Downloaded: [" & e.BytesReceived & "]KB"
Me.lolpercent.Text = e.ProgressPercentage & "%"
End Sub
Public Sub FullDownloadComplete(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles Fulldownload.DownloadProgressChanged
If ProgressBar1.Value = 100 Then
ProgressBar1.Value = 0
Me.lolsize.Text = "FileSize: [ ]KB"
Me.lolgetdata.Text = "Downloaded: [ ]KB"
Me.lolpercent.Text = " %"
End If
End Sub
Private Sub BackgroundWorker1_DoWork(sender As System.Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Dim AppPath As String
AppPath = Environment.CurrentDirectory()
ProgressBar1.Value = 0
ProgressBar1.Maximum = 100
Dim Full As String = ("http://**/files/")
Dim theResponse As HttpWebResponse
Dim theRequest As HttpWebRequest
Try
theRequest = WebRequest.Create(Full)
theResponse = theRequest.GetResponse
DownloadTest3()
Catch ex As Exception
MsgBox("It's offline dumbass")
End Try
End Sub