bom dia eu estou arrumando o auto update que fiz mas estou com um problema. eu quero que quando ele for instalar o novo exe que baixou ele mova e substitua por o um programa que esta na mesma pasta que ele por exemplo eu abri o auto update e ele baixou um
novo atualizado ai eu quero que ele mova e substitua por o antigo so que ele pode estar em pastas aleatorias pois ele vai substituir o que foi executado so isso mesmo eu vou deixar o source para darem uma olhada
-----------------------------------------------------------------------------------------------------------------------
Imports System.Net
Imports System.IO
Public Class Update
Public WithEvents Client As New WebClient
Public Dir As String = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\Goller[ATTS]\"
Private Sub btn_Verificar_Click(sender As Object, e As EventArgs) Handles btn_Verificar.Click
Try
Dim PegarVersao As String = Client.DownloadString("link da varificacao exemplo 0.0.0.1 ai se mudar no google drive o arquivo e deixar como 0.0.0.2 ele vai achar att nova")
Dim VersaoAtual As String = Application.ProductVersion
If PegarVersao.Contains(VersaoAtual) Then
Label2.Text = "Goller Atualizado"
Timer1.Interval = 3000 'ms
Timer1.Start()
My.Computer.Audio.Stop()
Else
If MsgBox("Nova versão disponível, deseja fazer o download?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
If File.Exists(Dir & "Goller.exe") Then
File.Delete(Dir & "Goller.exe")
ProgressBar1.Visible = True
Client = New WebClient
Client.DownloadFileAsync(New Uri("arquivo.exe"), Dir & "arquivo.exe")
Else
ProgressBar1.Visible = True
Client = New WebClient
Client.DownloadFileAsync(New Uri("arquivo.exe"), Dir & "arquivo.exe")
End If
End If
End If
Catch ex As Exception
End Try
End Sub
Private Sub DownloadCompleto(sender As Object, e As System.ComponentModel.AsyncCompletedEventArgs) Handles Client.DownloadFileCompleted
Label2.Text = "Download completo"
Button1.Visible = True
ProgressBar1.Visible = False
btn_Verificar.Visible = False
End Sub
Private Sub DownloadProgresso(sender As Object, e As DownloadProgressChangedEventArgs) Handles Client.DownloadProgressChanged
ProgressBar1.Value = e.ProgressPercentage
Label2.Text = "Baixando nova versão..."
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Process.Start(Dir & "arquivo.exe")
Close()
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Timer1.Stop()
Form99.Show()
Me.Close()
End Sub
Private Sub Update_Load(sender As Object, e As EventArgs) Handles MyBase.Load
My.Computer.Audio.Play(My.Resources.Lil_Xan___Betrayed, AudioPlayMode.BackgroundLoop)
End Sub
End Class