From f7533bbd5465954f670b210cc5e4b02d273a9908 Mon Sep 17 00:00:00 2001 From: EverythingWindows Date: Thu, 3 Nov 2022 14:40:32 +0700 Subject: [PATCH] Updater works now --- .../MainForms/ShiftOSMenu.Designer.vb | 2 +- ShiftOS-TheRevival/MainForms/ShiftOSMenu.vb | 16 +++ .../MainForms/ShiftOSUpdater.Designer.vb | 101 +++++++++++++++ .../MainForms/ShiftOSUpdater.resx | 120 ++++++++++++++++++ .../MainForms/ShiftOSUpdater.vb | 11 ++ .../My Project/Application.Designer.vb | 2 +- .../My Project/Application.myapp | 4 +- ShiftOS-TheRevival/My Project/AssemblyInfo.vb | 4 +- .../My Project/Resources.Designer.vb | 9 ++ ShiftOS-TheRevival/My Project/Resources.resx | 4 + .../Resources/CurrentVersion.txt | 1 + ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj | 10 ++ 12 files changed, 278 insertions(+), 6 deletions(-) create mode 100644 ShiftOS-TheRevival/MainForms/ShiftOSUpdater.Designer.vb create mode 100644 ShiftOS-TheRevival/MainForms/ShiftOSUpdater.resx create mode 100644 ShiftOS-TheRevival/MainForms/ShiftOSUpdater.vb create mode 100644 ShiftOS-TheRevival/Resources/CurrentVersion.txt diff --git a/ShiftOS-TheRevival/MainForms/ShiftOSMenu.Designer.vb b/ShiftOS-TheRevival/MainForms/ShiftOSMenu.Designer.vb index a613e25..de8b732 100644 --- a/ShiftOS-TheRevival/MainForms/ShiftOSMenu.Designer.vb +++ b/ShiftOS-TheRevival/MainForms/ShiftOSMenu.Designer.vb @@ -54,7 +54,7 @@ Partial Class ShiftOSMenu Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(162, 19) Me.Label2.TabIndex = 1 - Me.Label2.Text = "Shift is your way" + Me.Label2.Text = "Shift it your way" ' 'btn_Aboot ' diff --git a/ShiftOS-TheRevival/MainForms/ShiftOSMenu.vb b/ShiftOS-TheRevival/MainForms/ShiftOSMenu.vb index bd1edb2..82af7be 100644 --- a/ShiftOS-TheRevival/MainForms/ShiftOSMenu.vb +++ b/ShiftOS-TheRevival/MainForms/ShiftOSMenu.vb @@ -23,6 +23,7 @@ Public Class ShiftOSMenu Catch ex As Exception MsgBox("Why? Because of " & ex.Message) End Try + CheckUpdate() End Sub Private Sub btn_Exit_Click(sender As Object, e As EventArgs) Handles btn_Exit.Click @@ -73,4 +74,19 @@ Public Class ShiftOSMenu btn_Exit.Visible = True End Select 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 + + Else + ShiftOSUpdater.Show() + ShiftOSUpdater.Label2.Text = "A new version, " & NewVersion & " is available." & Environment.NewLine & "Your version is " & CurrentVersion + End If + End Sub End Class diff --git a/ShiftOS-TheRevival/MainForms/ShiftOSUpdater.Designer.vb b/ShiftOS-TheRevival/MainForms/ShiftOSUpdater.Designer.vb new file mode 100644 index 0000000..24f54ab --- /dev/null +++ b/ShiftOS-TheRevival/MainForms/ShiftOSUpdater.Designer.vb @@ -0,0 +1,101 @@ + _ +Partial Class ShiftOSUpdater + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.Label1 = New System.Windows.Forms.Label() + Me.Label2 = New System.Windows.Forms.Label() + Me.Button1 = New System.Windows.Forms.Button() + Me.ProgressBar1 = New System.Windows.Forms.ProgressBar() + Me.SuspendLayout() + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Font = New System.Drawing.Font("Consolas", 24.0!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.FontStyle)) + Me.Label1.Location = New System.Drawing.Point(13, 13) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(287, 37) + Me.Label1.TabIndex = 0 + Me.Label1.Text = "ShiftOS Updater" + ' + 'Label2 + ' + Me.Label2.AutoSize = True + Me.Label2.Font = New System.Drawing.Font("Consolas", 12.0!) + Me.Label2.Location = New System.Drawing.Point(20, 54) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(171, 19) + Me.Label2.TabIndex = 1 + Me.Label2.Text = "Checking update..." + ' + 'Button1 + ' + Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.Button1.Font = New System.Drawing.Font("Consolas", 10.0!) + Me.Button1.Location = New System.Drawing.Point(286, 220) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(86, 29) + Me.Button1.TabIndex = 2 + Me.Button1.Text = "Cancel" + Me.Button1.UseVisualStyleBackColor = True + ' + 'ProgressBar1 + ' + Me.ProgressBar1.BackColor = System.Drawing.Color.Black + Me.ProgressBar1.Cursor = System.Windows.Forms.Cursors.AppStarting + Me.ProgressBar1.ForeColor = System.Drawing.Color.White + Me.ProgressBar1.Location = New System.Drawing.Point(20, 98) + Me.ProgressBar1.Name = "ProgressBar1" + Me.ProgressBar1.Size = New System.Drawing.Size(352, 29) + Me.ProgressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee + Me.ProgressBar1.TabIndex = 3 + ' + 'ShiftOSUpdater + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.BackColor = System.Drawing.Color.Black + Me.ClientSize = New System.Drawing.Size(384, 261) + Me.ControlBox = False + Me.Controls.Add(Me.ProgressBar1) + Me.Controls.Add(Me.Button1) + Me.Controls.Add(Me.Label2) + Me.Controls.Add(Me.Label1) + Me.ForeColor = System.Drawing.Color.White + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle + Me.Name = "ShiftOSUpdater" + Me.ShowIcon = False + Me.ShowInTaskbar = False + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "ShiftOSUpdate" + Me.TopMost = True + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents Label1 As Label + Friend WithEvents Label2 As Label + Friend WithEvents Button1 As Button + Friend WithEvents ProgressBar1 As ProgressBar +End Class diff --git a/ShiftOS-TheRevival/MainForms/ShiftOSUpdater.resx b/ShiftOS-TheRevival/MainForms/ShiftOSUpdater.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS-TheRevival/MainForms/ShiftOSUpdater.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS-TheRevival/MainForms/ShiftOSUpdater.vb b/ShiftOS-TheRevival/MainForms/ShiftOSUpdater.vb new file mode 100644 index 0000000..d264230 --- /dev/null +++ b/ShiftOS-TheRevival/MainForms/ShiftOSUpdater.vb @@ -0,0 +1,11 @@ +Imports System.IO + +Public Class ShiftOSUpdater + Public HasChecked As Boolean + Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click + Close() + End Sub + Private Sub ShiftOSUpdate_Load(sender As Object, e As EventArgs) Handles MyBase.Load + + End Sub +End Class \ No newline at end of file diff --git a/ShiftOS-TheRevival/My Project/Application.Designer.vb b/ShiftOS-TheRevival/My Project/Application.Designer.vb index 3ab54de..ca29170 100644 --- a/ShiftOS-TheRevival/My Project/Application.Designer.vb +++ b/ShiftOS-TheRevival/My Project/Application.Designer.vb @@ -25,7 +25,7 @@ Namespace My Public Sub New() MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) Me.IsSingleInstance = false - Me.EnableVisualStyles = true + Me.EnableVisualStyles = false Me.SaveMySettingsOnExit = true Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterAllFormsClose End Sub diff --git a/ShiftOS-TheRevival/My Project/Application.myapp b/ShiftOS-TheRevival/My Project/Application.myapp index effc3c8..3825827 100644 --- a/ShiftOS-TheRevival/My Project/Application.myapp +++ b/ShiftOS-TheRevival/My Project/Application.myapp @@ -1,10 +1,10 @@  true - Form1 + ShiftOSMenu false 1 - true + false 0 true \ No newline at end of file diff --git a/ShiftOS-TheRevival/My Project/AssemblyInfo.vb b/ShiftOS-TheRevival/My Project/AssemblyInfo.vb index 9b0c356..0ef265c 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/My Project/Resources.Designer.vb b/ShiftOS-TheRevival/My Project/Resources.Designer.vb index 413136f..62a3fe0 100644 --- a/ShiftOS-TheRevival/My Project/Resources.Designer.vb +++ b/ShiftOS-TheRevival/My Project/Resources.Designer.vb @@ -68,5 +68,14 @@ Namespace My.Resources Return ResourceManager.GetString("BuildString", resourceCulture) End Get End Property + + ''' + ''' Looks up a localized string similar to 0.2.0. + ''' + Friend ReadOnly Property CurrentVersion() As String + Get + Return ResourceManager.GetString("CurrentVersion", resourceCulture) + End Get + End Property End Module End Namespace diff --git a/ShiftOS-TheRevival/My Project/Resources.resx b/ShiftOS-TheRevival/My Project/Resources.resx index 008acd0..c74daae 100644 --- a/ShiftOS-TheRevival/My Project/Resources.resx +++ b/ShiftOS-TheRevival/My Project/Resources.resx @@ -120,4 +120,8 @@ + + + ..\Resources\CurrentVersion.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + \ No newline at end of file diff --git a/ShiftOS-TheRevival/Resources/CurrentVersion.txt b/ShiftOS-TheRevival/Resources/CurrentVersion.txt new file mode 100644 index 0000000..341cf11 --- /dev/null +++ b/ShiftOS-TheRevival/Resources/CurrentVersion.txt @@ -0,0 +1 @@ +0.2.0 \ No newline at end of file diff --git a/ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj b/ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj index 0c96be9..d03e8c9 100644 --- a/ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj +++ b/ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj @@ -113,6 +113,12 @@ ShiftOSMenu.vb Form + + ShiftOSUpdater.vb + + + Form + Terminal.vb @@ -145,6 +151,9 @@ IntroStory.vb + + ShiftOSUpdater.vb + Terminal.vb @@ -185,6 +194,7 @@ +