diff --git a/ShiftOS-TheRevival/MainForms/ShiftOSMenu.vb b/ShiftOS-TheRevival/MainForms/ShiftOSMenu.vb index 82af7be..156e353 100644 --- a/ShiftOS-TheRevival/MainForms/ShiftOSMenu.vb +++ b/ShiftOS-TheRevival/MainForms/ShiftOSMenu.vb @@ -6,23 +6,23 @@ Public Class ShiftOSMenu Public Shared BuildLab() As String Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load - Try - If File.Exists("D:\ShiftOSBuildLab.txt") Then - BuildLab = File.ReadAllLines("D:\ShiftOSBuildLab.txt") - If BuildLab(0) = "No" Then - Dim BuildNum As Integer = BuildLab(1) - BuildNum = BuildLab(1) + 1 - ActualBuildLab = "ShiftOS_TheRevival." & BuildLab(3) & "." & BuildNum & "." & Date.Today.Year & Date.Today.Month & Date.Today.Day - BuildLab(1) = BuildNum - File.WriteAllLines("D:\ShiftOSBuildLab.txt", BuildLab) - End If - lbl_BuildString.Text = ActualBuildLab - Else + 'Try + ' If File.Exists("D:\ShiftOSBuildLab.txt") Then + ' BuildLab = File.ReadAllLines("D:\ShiftOSBuildLab.txt") + ' If BuildLab(0) = "No" Then + ' Dim BuildNum As Integer = BuildLab(1) + ' BuildNum = BuildLab(1) + 1 + ' ActualBuildLab = "ShiftOS_TheRevival." & BuildLab(3) & "." & BuildNum & "." & Date.Today.Year & Date.Today.Month & Date.Today.Day + ' BuildLab(1) = BuildNum + ' File.WriteAllLines("D:\ShiftOSBuildLab.txt", BuildLab) + ' End If + ' lbl_BuildString.Text = ActualBuildLab + ' Else - End If - Catch ex As Exception - MsgBox("Why? Because of " & ex.Message) - End Try + ' End If + 'Catch ex As Exception + ' MsgBox("Why? Because of " & ex.Message) + 'End Try CheckUpdate() End Sub @@ -76,17 +76,41 @@ Public Class ShiftOSMenu End Sub Private Sub CheckUpdate() - If File.Exists("C:\SOS_NewVer.txt") = True Then - File.Delete("C:\SOS_NewVer.txt") - End If - My.Computer.Network.DownloadFile("http://148.251.124.62:8080/ShiftOS/data/NewVer.txt", "C:\SOS_NewVer.txt") - Dim CurrentVersion As String = My.Resources.CurrentVersion - Dim NewVersion As String = File.ReadAllText("C:\SOS_NewVer.txt") - If CurrentVersion = NewVersion Then + Try + If File.Exists("C:\SOS_NewVer.txt") = True Then + File.Delete("C:\SOS_NewVer.txt") + End If + My.Computer.Network.DownloadFile("http://148.251.124.62:8080/ShiftOS/data/NewVer.txt", "C:\SOS_NewVer.txt") + Dim CurrentVersion As String = My.Resources.CurrentVersion + Dim NewVersion As String = File.ReadAllText("C:\SOS_NewVer.txt") + If CurrentVersion = NewVersion Then - Else - ShiftOSUpdater.Show() - ShiftOSUpdater.Label2.Text = "A new version, " & NewVersion & " is available." & Environment.NewLine & "Your version is " & CurrentVersion + Else + btn_Aboot.Enabled = False + btn_Exit.Enabled = False + btn_FreeRoam.Enabled = False + btn_StoryMode.Enabled = False + ShiftOSUpdater.Show() + ShiftOSUpdater.NewVersion = NewVersion + ShiftOSUpdater.Label2.Text = "A new version, " & NewVersion & " is available." & Environment.NewLine & "Your version is " & CurrentVersion + ShiftOSUpdater.Focus() + End If + Catch ex As Exception + + End Try + End Sub + + Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click + Label2.Text = "Debug it your way" + End Sub + + Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click + If Label2.Text = "Debug it your way" Then + Strings.IsFree = True + Strings.AvailableFeature(0) = "0" + Strings.AvailableFeature(1) = "0" + Terminal.Show() + Close() End If End Sub End Class diff --git a/ShiftOS-TheRevival/MainForms/ShiftOSUpdater.Designer.vb b/ShiftOS-TheRevival/MainForms/ShiftOSUpdater.Designer.vb index 24f54ab..7e5453e 100644 --- a/ShiftOS-TheRevival/MainForms/ShiftOSUpdater.Designer.vb +++ b/ShiftOS-TheRevival/MainForms/ShiftOSUpdater.Designer.vb @@ -26,6 +26,7 @@ Partial Class ShiftOSUpdater Me.Label2 = New System.Windows.Forms.Label() Me.Button1 = New System.Windows.Forms.Button() Me.ProgressBar1 = New System.Windows.Forms.ProgressBar() + Me.Button2 = New System.Windows.Forms.Button() Me.SuspendLayout() ' 'Label1 @@ -70,6 +71,17 @@ Partial Class ShiftOSUpdater Me.ProgressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee Me.ProgressBar1.TabIndex = 3 ' + 'Button2 + ' + Me.Button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.Button2.Font = New System.Drawing.Font("Consolas", 10.0!) + Me.Button2.Location = New System.Drawing.Point(194, 220) + Me.Button2.Name = "Button2" + Me.Button2.Size = New System.Drawing.Size(86, 29) + Me.Button2.TabIndex = 2 + Me.Button2.Text = "Download" + Me.Button2.UseVisualStyleBackColor = True + ' 'ShiftOSUpdater ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -78,6 +90,7 @@ Partial Class ShiftOSUpdater Me.ClientSize = New System.Drawing.Size(384, 261) Me.ControlBox = False Me.Controls.Add(Me.ProgressBar1) + Me.Controls.Add(Me.Button2) Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.Label1) @@ -98,4 +111,5 @@ Partial Class ShiftOSUpdater Friend WithEvents Label2 As Label Friend WithEvents Button1 As Button Friend WithEvents ProgressBar1 As ProgressBar + Friend WithEvents Button2 As Button End Class diff --git a/ShiftOS-TheRevival/MainForms/ShiftOSUpdater.vb b/ShiftOS-TheRevival/MainForms/ShiftOSUpdater.vb index d264230..5878577 100644 --- a/ShiftOS-TheRevival/MainForms/ShiftOSUpdater.vb +++ b/ShiftOS-TheRevival/MainForms/ShiftOSUpdater.vb @@ -1,11 +1,45 @@ Imports System.IO +Imports System.Net Public Class ShiftOSUpdater Public HasChecked As Boolean + Public NewVersion As String + Public WithEvents Download As WebClient Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Close() End Sub + + 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 + Else + + End If + End Sub Private Sub ShiftOSUpdate_Load(sender As Object, e As EventArgs) Handles MyBase.Load End Sub + + Private Sub Download_DownloadProgressChanged(ByVal sender As Object, ByVal e As DownloadProgressChangedEventArgs) Handles Download.DownloadProgressChanged + ProgressBar1.Value = e.ProgressPercentage + End Sub End Class \ No newline at end of file diff --git a/ShiftOS-TheRevival/My Project/AssemblyInfo.vb b/ShiftOS-TheRevival/My Project/AssemblyInfo.vb index 0ef265c..d897939 100644 --- a/ShiftOS-TheRevival/My Project/AssemblyInfo.vb +++ b/ShiftOS-TheRevival/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' by using the '*' as shown below: ' - - + + diff --git a/ShiftOS-TheRevival/Resources/CurrentVersion.txt b/ShiftOS-TheRevival/Resources/CurrentVersion.txt index 341cf11..7dff5b8 100644 --- a/ShiftOS-TheRevival/Resources/CurrentVersion.txt +++ b/ShiftOS-TheRevival/Resources/CurrentVersion.txt @@ -1 +1 @@ -0.2.0 \ No newline at end of file +0.2.1 \ No newline at end of file