2022-11-03 07:40:32 +00:00
Imports System . IO
2022-11-03 09:18:01 +00:00
Imports System . Net
2022-11-03 07:40:32 +00:00
Public Class ShiftOSUpdater
Public HasChecked As Boolean
2022-11-03 09:18:01 +00:00
Public NewVersion As String
Public WithEvents Download As WebClient
2022-11-03 07:40:32 +00:00
Private Sub Button1_Click ( sender As Object , e As EventArgs ) Handles Button1 . Click
2022-11-06 00:21:26 +00:00
If ShiftOSMenu . ShouldUpdate = True Then
Else
ShiftOSMenu . btn_Aboot . Enabled = True
ShiftOSMenu . btn_Exit . Enabled = True
ShiftOSMenu . btn_FreeRoam . Enabled = True
ShiftOSMenu . btn_StoryMode . Enabled = True
End If
2022-11-03 07:40:32 +00:00
Close ( )
End Sub
2022-11-03 09:18:01 +00:00
Private Sub Button2_Click ( sender As Object , e As EventArgs ) Handles Button2 . Click
If Button2 . Text = " Download " Then
Dim FilePut As New SaveFileDialog
FilePut . Filter = " ShiftOS Program|*.exe "
FilePut . Title = " Save an updated ShiftOS version "
FilePut . ShowDialog ( )
If Not FilePut . FileName = " " Then
Button1 . Enabled = False
Button2 . Enabled = False
Dim PutTo As String = " http://148.251.124.62:8080/ShiftOS/versions/ShiftOS-TheRevival.v " & NewVersion & " .exe "
'Dim GetTo As New Uri(PutTo)
My . Computer . Network . DownloadFile ( PutTo , FilePut . FileName )
'Revisit this later
'Download.DownloadFileAsync(GetTo, FilePut.FileName)
Button1 . Enabled = True
Button2 . Enabled = True
ShiftOSMenu . btn_Aboot . Enabled = True
ShiftOSMenu . btn_Exit . Enabled = True
ShiftOSMenu . btn_FreeRoam . Enabled = True
ShiftOSMenu . btn_StoryMode . Enabled = True
Button2 . Text = " Saved "
End If
2022-11-06 00:21:26 +00:00
ElseIf Button2 . Text = " Update " Then
2022-11-09 01:42:46 +00:00
Label2 . Text = " Updating ShiftOS to " & My . Resources . CurrentVersion
UpdateToNew ( )
2022-11-03 09:18:01 +00:00
Else
2022-11-09 01:42:46 +00:00
Close ( )
2022-11-03 09:18:01 +00:00
End If
End Sub
2022-11-03 07:40:32 +00:00
Private Sub ShiftOSUpdate_Load ( sender As Object , e As EventArgs ) Handles MyBase . Load
2022-11-06 00:21:26 +00:00
If ShiftOSMenu . ShouldUpdate = True Then
2022-11-09 01:42:46 +00:00
Button2 . Text = " Update "
2022-11-06 00:21:26 +00:00
End If
2022-11-03 07:40:32 +00:00
End Sub
2022-11-03 09:18:01 +00:00
2022-11-03 15:27:40 +00:00
'Will revisit this later
'Private Sub Download_DownloadProgressChanged(ByVal sender As Object, ByVal e As DownloadProgressChangedEventArgs) Handles Download.DownloadProgressChanged
' ProgressBar1.Value = e.ProgressPercentage
'End Sub
2022-11-03 07:40:32 +00:00
End Class