Updater works now

This commit is contained in:
EverythingWindows 2022-11-03 14:40:32 +07:00
parent ec630f54d6
commit f7533bbd54
12 changed files with 278 additions and 6 deletions

View file

@ -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
'

View file

@ -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

View file

@ -0,0 +1,101 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class ShiftOSUpdater
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
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.
<System.Diagnostics.DebuggerStepThrough()> _
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

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -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

View file

@ -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

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>true</MySubMain>
<MainForm>Form1</MainForm>
<MainForm>ShiftOSMenu</MainForm>
<SingleInstance>false</SingleInstance>
<ShutdownMode>1</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<EnableVisualStyles>false</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData>

View file

@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
<Assembly: AssemblyVersion("0.2.0.0")>
<Assembly: AssemblyFileVersion("0.2.0.0")>

View file

@ -68,5 +68,14 @@ Namespace My.Resources
Return ResourceManager.GetString("BuildString", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to 0.2.0.
'''</summary>
Friend ReadOnly Property CurrentVersion() As String
Get
Return ResourceManager.GetString("CurrentVersion", resourceCulture)
End Get
End Property
End Module
End Namespace

View file

@ -120,4 +120,8 @@
<data name="BuildString" xml:space="preserve">
<value />
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="CurrentVersion" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\CurrentVersion.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
</root>

View file

@ -0,0 +1 @@
0.2.0

View file

@ -113,6 +113,12 @@
<DependentUpon>ShiftOSMenu.vb</DependentUpon>
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForms\ShiftOSUpdater.Designer.vb">
<DependentUpon>ShiftOSUpdater.vb</DependentUpon>
</Compile>
<Compile Include="MainForms\ShiftOSUpdater.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForms\Strings.vb" />
<Compile Include="MainForms\Terminal.Designer.vb">
<DependentUpon>Terminal.vb</DependentUpon>
@ -145,6 +151,9 @@
<EmbeddedResource Include="MainForms\IntroStory.resx">
<DependentUpon>IntroStory.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForms\ShiftOSUpdater.resx">
<DependentUpon>ShiftOSUpdater.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForms\Terminal.resx">
<DependentUpon>Terminal.vb</DependentUpon>
</EmbeddedResource>
@ -185,6 +194,7 @@
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<None Include="Resources\CurrentVersion.txt" />
<Content Include="ShiftOS.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />