ShiftOS-TheRevival-Old/ShiftOS-TheRevival/MainForms/ShiftOSMenu.vb

157 lines
6 KiB
VB.net
Raw Normal View History

2022-11-01 04:27:02 -04:00
Imports System.IO
2022-11-01 21:52:31 -04:00
Public Class ShiftOSMenu
2022-11-01 04:27:02 -04:00
Public Shared ActualBuildLab As String
Public Shared BuildLab() As String
Public Shared BannerUse As Integer = 1
Public Shared TimeToChange
Public Shared ShouldUpdate As Boolean = False
2022-11-01 04:27:02 -04:00
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
2022-11-03 05:18:01 -04:00
'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
2022-11-01 21:52:31 -04:00
2022-11-03 05:18:01 -04:00
' End If
'Catch ex As Exception
' MsgBox("Why? Because of " & ex.Message)
'End Try
2022-11-03 03:40:32 -04:00
CheckUpdate()
'CheckInstall()
BannerChange.Start()
2022-11-01 04:27:02 -04:00
End Sub
Private Sub btn_Exit_Click(sender As Object, e As EventArgs) Handles btn_Exit.Click
Close()
End Sub
Private Sub btn_FreeRoam_Click(sender As Object, e As EventArgs) Handles btn_FreeRoam.Click
2022-11-02 00:17:14 -04:00
Select Case btn_FreeRoam.Text
Case "Free Roam Mode"
Try
Strings.IsFree = True
FreeRoamMode()
2022-11-02 00:17:14 -04:00
Terminal.Show()
Close()
Catch ex As Exception
Dim NewBugSlap As New BugSlap
NewBugSlap.Show()
NewBugSlap.TextBox1.Text = ex.Message
Close()
End Try
Case "Continue"
MsgBox("This feature is in development")
End Select
End Sub
Private Sub btn_StoryMode_Click(sender As Object, e As EventArgs) Handles btn_StoryMode.Click
Select Case btn_StoryMode.Text
Case "Story Mode"
btn_StoryMode.Text = "New Game"
btn_FreeRoam.Text = "Continue"
btn_Aboot.Text = "Back"
btn_Exit.Visible = False
Case "New Game"
2022-11-02 17:28:19 -04:00
Strings.IsFree = False
MsgBox("This feature is in development, be sure to watch out for bugs")
IntroStory.Show()
NewGameMode()
2022-11-02 17:28:19 -04:00
Close()
2022-11-02 00:17:14 -04:00
End Select
End Sub
Private Sub btn_Aboot_Click(sender As Object, e As EventArgs) Handles btn_Aboot.Click
Select Case btn_Aboot.Text
Case "Back"
btn_StoryMode.Text = "Story Mode"
btn_FreeRoam.Text = "Free Roam Mode"
btn_Aboot.Text = "About"
btn_Exit.Visible = True
End Select
End Sub
2022-11-03 03:40:32 -04:00
Private Sub CheckUpdate()
2022-11-03 05:18:01 -04:00
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
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 CheckInstall()
If Directory.Exists(My.Computer.FileSystem.SpecialDirectories.Temp & "\ShiftOS\ShiftFS") = True Then
Dim WhatVersion As String = File.ReadAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\ShiftOS\version.txt")
If WhatVersion = My.Resources.CurrentVersion Then
Else
btn_Aboot.Enabled = False
btn_Exit.Enabled = False
btn_FreeRoam.Enabled = False
btn_StoryMode.Enabled = False
ShouldUpdate = True
ShiftOSUpdater.Show()
End If
Else
If Directory.Exists(My.Computer.FileSystem.SpecialDirectories.Temp & "\ShiftOS") = True Then
If Directory.Exists(My.Computer.FileSystem.SpecialDirectories.Temp & "\ShiftOS\ShiftFS") = True Then
Directory.CreateDirectory(My.Computer.FileSystem.GetTempFileName & "\ShiftOS\ShiftFS")
End If
Else
Directory.CreateDirectory(My.Computer.FileSystem.GetTempFileName & "\ShiftOS")
Directory.CreateDirectory(My.Computer.FileSystem.GetTempFileName & "\ShiftOS\ShiftFS")
End If
End If
End Sub
2022-11-03 05:18:01 -04:00
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
Label2.Text = "Debug it your way"
End Sub
2022-11-03 03:40:32 -04:00
2022-11-03 05:18:01 -04:00
Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click
If Label2.Text = "Debug it your way" Then
Strings.IsFree = True
GodMode()
2022-11-03 05:18:01 -04:00
Terminal.Show()
Close()
2022-11-03 03:40:32 -04:00
End If
End Sub
Private Sub BannerChange_Tick(sender As Object, e As EventArgs) Handles BannerChange.Tick
Select Case TimeToChange
Case 50
Thumbnail.BackgroundImage = My.Resources.MenuBanner1
Case 100
Thumbnail.BackgroundImage = My.Resources.MenuBanner2
TimeToChange = 0
End Select
TimeToChange = TimeToChange + 1
End Sub
2022-11-01 04:27:02 -04:00
End Class