Skip to content

Commit

Permalink
Implemented autoupdate of mod manager with additional Updater.exe;
Browse files Browse the repository at this point in the history
  • Loading branch information
grasmann committed May 22, 2017
1 parent 6a06707 commit 2b0ac2b
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
12 changes: 12 additions & 0 deletions VMM/forms/About.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions VMM/forms/About.vb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Public Class About

Private WithEvents _update_check As New ModManagerUpdateCheck
Private WithEvents _update_download As Download

Private Sub _update_check_NoUpdate() Handles _update_check.NoUpdate
lbl_up_to_date.Visible = True
Expand All @@ -14,9 +15,32 @@ Public Class About
lbl_update.Visible = True
lbl_update.Text = String.Format("Update {0} is available.", File.Version)
btn_update.Visible = True
btn_update.Tag = File
lbl_checking_update.Visible = False
End Sub

Private Sub _update_download_DownloadFinished(Download As Download) Handles _update_download.DownloadFinished
ProgressBar1.Visible = False
'Process.Start(Download.Temp)
Dim Updater As String = String.Format("{0}\{1}", Application.StartupPath, "Updater.exe")
If My.Computer.FileSystem.FileExists(Updater) Then
Process.Start(Updater, Download.Temp)
Application.Exit()
Else
Process.Start(Download.Temp)
End If
'Using zip As ZipFile = ZipFile.Read(Path)
' 'zip.ExtractAll(PathHelper.)
'End Using
'Debug.Print(Download.Temp)
End Sub

Private Sub _update_download_ProgressChanged(Download As Download, Percentage As Integer) Handles _update_download.ProgressChanged
If ProgressBar1.Visible Then
ProgressBar1.Value = Percentage
End If
End Sub

Private Sub About_Load(sender As Object, e As EventArgs) Handles MyBase.Load
lbl_version.Text = Version.Current
End Sub
Expand All @@ -27,6 +51,18 @@ Public Class About
lbl_checking_update.Visible = True
pb_up_to_date.Visible = False
lbl_up_to_date.Visible = False
ProgressBar1.Visible = False
_update_check.CheckForUpdate()
End Sub

Private Sub btn_update_Click(sender As Object, e As EventArgs) Handles btn_update.Click
Dim File As FileInfo = btn_update.Tag
If Not IsNothing(File) Then
btn_update.Visible = False
ProgressBar1.Visible = True
_update_download = New Download(File)
_update_download.StartDownload()
End If
End Sub

End Class
2 changes: 1 addition & 1 deletion VMM/function/Version.vb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Public Const major As Integer = 0
Public Const minor As Integer = 5
Public Const patch As Integer = 23
Public Const patch As Integer = 22

Public ReadOnly Property Current() As String
Get
Expand Down

0 comments on commit 2b0ac2b

Please sign in to comment.