// Kleines edit ;)
Eh Jo Updater Sache: (noch ned getestet)
Patcher.vb :
If VER <> scanner.ReadLine() Then ' überprüfen ob die Version stimmt
MsgBox("There is a new update", MsgBoxStyle.Information, "Update")
Try
My.Computer.Network.DownloadFile(PATCH_URL & "NewLaunch.exe", "NewLaunch.exe")
TerminateAndStart()
Catch ex As Exception
MsgBox("Could not download NewLauncher File")
End Try
Exit Sub
End If
Funktionen.vb :
Public Sub TerminateAndStart()
Dim Task As Long
Task = Shell(My.Application.Info.DirectoryPath & "Update.exe", vbNormalNoFocus)
MsgBox("A Newer Version of This Patcher has been downloaded !")
Process.GetCurrentProcess.Kill() ' Kills process
End Sub
Neues Projekt: Update
Modul1.vb :
Imports System
Imports System.IO
Module Module1
Sub Main()
Dim FileName As String = My.Application.Info.DirectoryPath & "\NewLauncher.exe"
Dim FileName2 As String = My.Application.Info.DirectoryPath & "\Launcher.exe"
If DoesProcessExists("Launcher.exe") Then
For Each Process In System.Diagnostics.Process.GetProcessesByName("Launcher.exe")
Process.Kill()
Next
ElseIf Not File.Exists(FileName) Then
MsgBox("NewLauncher.exe existiert nicht !")
End
Else
File.Delete(FileName2)
File.Move(FileName, FileName2)
Shell(FileName2, AppWinStyle.NormalFocus)
End
End If
End Sub
Private Function DoesProcessExists(ByVal PName As String) As Boolean
If System.Diagnostics.Process.GetProcessesByName(PName).Length > 0 Then
Return True
End If
Return False
End Function
End Module
Alles anzeigen