Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Download Manger
#2
I created this little code snippet. Hopefully this is what you were looking for, or something like it:

[code2=vbnet]Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim downloadFilePath As String = "http://brandonsoft.com/Trinity%20Webbrowser.zip?f=11&sid=e4e94d2692431bd601f36f919bfc743e"

Dim desktopPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)

If Not (My.Computer.FileSystem.DirectoryExists(desktopPath & "/Downloads")) Then
My.Computer.FileSystem.CreateDirectory(desktopPath & "/Downloads")
End If

'Now we need to simply determine the format of the online file
Dim extensionString As String = System.IO.Path.GetExtension(downloadFilePath)

My.Computer.Network.DownloadFile(downloadFilePath, desktopPath & "/Downloads/download" & GetWebExtension(extensionString))

End Sub

Public Function GetWebExtension(ByVal partialString As String) As String
partialString = partialString.Remove(0, 1)
'Now we need to eliminate any extra chars that aren't alphanumerical
For i As Integer = 1 To partialString.Length Step 1
Dim subString As String = partialString.Substring(0, i)
For Each character As Char In subString
If Not (Char.IsNumber(character) Or Char.IsLetter(character) Or Char.IsWhiteSpace(character)) Then
Return ("." & partialString.Substring(0, i - 1))
End If
Next
Next
Return ("." & partialString)
End Function[/code2]
My Blog | My Setup | My Videos | Have a wonderful day.


Messages In This Thread
Download Manger - by manishshrestha60 - 09-29-2012, 06:12 AM
Re: Download Manger - by brandonio21_phpbb3_import2 - 09-30-2012, 12:01 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)