0.2.3 final code

This commit is contained in:
EverythingWindows 2022-11-06 18:45:00 +07:00
parent 2a3e5ec4d5
commit 1ca1bed37d
9 changed files with 233 additions and 109 deletions

View file

@ -1,4 +1,6 @@
Module SaveLoadSystem
Imports System.IO
Module SaveLoadSystem
Public Sub NewGameMode()
Strings.ComputerInfo(2) = "0"
@ -61,4 +63,18 @@
Strings.AvailableFeature(14) = "2"
Strings.AvailableFeature(15) = "2"
End Sub
Public Sub SaveGame()
If Strings.OnceInfo(6) = "story" Then
File.WriteAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\saved\ComputerInfo.sos", Strings.ComputerInfo)
File.WriteAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\saved\AvailableFeature.sos", Strings.AvailableFeature)
End If
End Sub
Public Sub LoadGame()
If Strings.OnceInfo(6) = "story" Then
Strings.ComputerInfo = File.ReadAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\saved\ComputerInfo.sos")
Strings.AvailableFeature = File.ReadAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\saved\AvailableFeature.sos")
End If
End Sub
End Module

View file

@ -61,6 +61,7 @@ Partial Class ShiftOSMenu
'btn_Aboot
'
Me.btn_Aboot.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btn_Aboot.Font = New System.Drawing.Font("Segoe UI", 8.25!)
Me.btn_Aboot.ForeColor = System.Drawing.Color.White
Me.btn_Aboot.Location = New System.Drawing.Point(22, 166)
Me.btn_Aboot.Name = "btn_Aboot"
@ -82,6 +83,7 @@ Partial Class ShiftOSMenu
'btn_StoryMode
'
Me.btn_StoryMode.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btn_StoryMode.Font = New System.Drawing.Font("Segoe UI", 8.25!)
Me.btn_StoryMode.ForeColor = System.Drawing.Color.White
Me.btn_StoryMode.Location = New System.Drawing.Point(22, 108)
Me.btn_StoryMode.Name = "btn_StoryMode"
@ -93,6 +95,7 @@ Partial Class ShiftOSMenu
'btn_FreeRoam
'
Me.btn_FreeRoam.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btn_FreeRoam.Font = New System.Drawing.Font("Segoe UI", 8.25!)
Me.btn_FreeRoam.ForeColor = System.Drawing.Color.White
Me.btn_FreeRoam.Location = New System.Drawing.Point(22, 137)
Me.btn_FreeRoam.Name = "btn_FreeRoam"
@ -104,6 +107,7 @@ Partial Class ShiftOSMenu
'btn_Exit
'
Me.btn_Exit.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btn_Exit.Font = New System.Drawing.Font("Segoe UI", 8.25!)
Me.btn_Exit.ForeColor = System.Drawing.Color.White
Me.btn_Exit.Location = New System.Drawing.Point(22, 195)
Me.btn_Exit.Name = "btn_Exit"

View file

@ -26,8 +26,8 @@ Public Class ShiftOSMenu
'Catch ex As Exception
' MsgBox("Why? Because of " & ex.Message)
'End Try
CheckInstall()
CheckUpdate()
'CheckInstall()
BannerChange.Start()
End Sub
@ -40,6 +40,7 @@ Public Class ShiftOSMenu
Case "Free Roam Mode"
Try
Strings.IsFree = True
Strings.OnceInfo(6) = "free"
FreeRoamMode()
Terminal.Show()
Close()
@ -51,6 +52,11 @@ Public Class ShiftOSMenu
End Try
Case "Continue"
MsgBox("This feature is in development")
Strings.IsFree = False
Strings.OnceInfo(6) = "story"
Terminal.Show()
Terminal.StayAtChapter = True
Close()
End Select
End Sub
@ -63,6 +69,7 @@ Public Class ShiftOSMenu
btn_Exit.Visible = False
Case "New Game"
Strings.IsFree = False
Strings.OnceInfo(6) = "story"
MsgBox("This feature is in development, be sure to watch out for bugs")
IntroStory.Show()
NewGameMode()
@ -82,12 +89,12 @@ Public Class ShiftOSMenu
Private Sub CheckUpdate()
Try
If File.Exists("C:\SOS_NewVer.txt") = True Then
File.Delete("C:\SOS_NewVer.txt")
If File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SOS_NewVer.txt") = True Then
File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SOS_NewVer.txt")
End If
My.Computer.Network.DownloadFile("http://148.251.124.62:8080/ShiftOS/data/NewVer.txt", "C:\SOS_NewVer.txt")
My.Computer.Network.DownloadFile("http://148.251.124.62:8080/ShiftOS/data/NewVer.txt", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SOS_NewVer.txt")
Dim CurrentVersion As String = My.Resources.CurrentVersion
Dim NewVersion As String = File.ReadAllText("C:\SOS_NewVer.txt")
Dim NewVersion As String = File.ReadAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SOS_NewVer.txt")
If CurrentVersion = NewVersion Then
Else
@ -107,25 +114,33 @@ Public Class ShiftOSMenu
Private Sub CheckInstall()
If Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\ShiftFS") = True Then
Dim WhatVersion As String = File.ReadAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\version.txt")
If WhatVersion = My.Resources.CurrentVersion Then
'Dim WhatVersion As String = File.ReadAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\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
' 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(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS") = True Then
If Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\ShiftFS") = True Then
Directory.CreateDirectory(My.Computer.FileSystem.GetTempFileName & "\ShiftOS\ShiftFS")
Else
Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\ShiftFS")
End If
If Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\saved") = True Then
Else
Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\saved")
End If
Else
Directory.CreateDirectory(My.Computer.FileSystem.GetTempFileName & "\ShiftOS")
Directory.CreateDirectory(My.Computer.FileSystem.GetTempFileName & "\ShiftOS\ShiftFS")
Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS")
Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\ShiftFS")
Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\saved")
End If
End If
End Sub

View file

@ -2,7 +2,7 @@
Public Shared OSInfo() As String
Public Shared ComputerInfo(4) As String
Public Shared IsFree As Boolean
Public Shared OnceInfo(4) As String
Public Shared OnceInfo(6) As String
Public Shared AvailableFeature(15) As String
Public Shared CLIInterpreter As String
Public Shared SaveFile As String
@ -32,6 +32,8 @@
'2 = Infobar Boolean (0.2.3) (default : True)
'3 = Color for Terminal (0.2.3) (default : 0F)
'4 = RootDirectoryString (0.2.3) (default : !)
'5 = Terminal TrackPos (0.2.3) (default : 0)
'6 = GameMode (0.2.3) (dependant)
'
'ComputerInfo Strings:
'0 = Computer Name (0.1) (default : shiftos)

View file

@ -27,6 +27,7 @@ Partial Class Terminal
Me.StoryOnlyTimer = New System.Windows.Forms.Timer(Me.components)
Me.InfoBar = New System.Windows.Forms.TextBox()
Me.InfoBarTimer = New System.Windows.Forms.Timer(Me.components)
Me.ToolBar = New System.Windows.Forms.TextBox()
Me.SuspendLayout()
'
'TextBox1
@ -36,10 +37,10 @@ Partial Class Terminal
Me.TextBox1.Dock = System.Windows.Forms.DockStyle.Fill
Me.TextBox1.Font = New System.Drawing.Font("Consolas", 11.0!)
Me.TextBox1.ForeColor = System.Drawing.Color.White
Me.TextBox1.Location = New System.Drawing.Point(0, 0)
Me.TextBox1.Location = New System.Drawing.Point(0, 36)
Me.TextBox1.Multiline = True
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(800, 432)
Me.TextBox1.Size = New System.Drawing.Size(800, 396)
Me.TextBox1.TabIndex = 0
'
'StoryOnlyTimer
@ -63,6 +64,18 @@ Partial Class Terminal
'InfoBarTimer
'
'
'ToolBar
'
Me.ToolBar.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.ToolBar.Dock = System.Windows.Forms.DockStyle.Top
Me.ToolBar.Font = New System.Drawing.Font("Consolas", 11.0!)
Me.ToolBar.Location = New System.Drawing.Point(0, 0)
Me.ToolBar.Multiline = True
Me.ToolBar.Name = "ToolBar"
Me.ToolBar.Size = New System.Drawing.Size(800, 36)
Me.ToolBar.TabIndex = 1
Me.ToolBar.Visible = False
'
'Terminal
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@ -71,6 +84,7 @@ Partial Class Terminal
Me.ClientSize = New System.Drawing.Size(800, 450)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.InfoBar)
Me.Controls.Add(Me.ToolBar)
Me.ForeColor = System.Drawing.Color.White
Me.Name = "Terminal"
Me.Text = "Terminal"
@ -83,4 +97,5 @@ Partial Class Terminal
Friend WithEvents StoryOnlyTimer As Timer
Friend WithEvents InfoBar As TextBox
Friend WithEvents InfoBarTimer As Timer
Friend WithEvents ToolBar As TextBox
End Class

View file

@ -13,6 +13,8 @@ Public Class Terminal
Public CurrentDirectory As String
Public Pseudodir As String
Public StayAtChapter As Boolean = False
Public ToolBarUse As Boolean = False
Public ReleaseCursor As Boolean = False
Private Sub Terminal_Load(sender As Object, e As EventArgs) Handles MyBase.Load
FormBorderStyle = FormBorderStyle.None
@ -34,6 +36,7 @@ Public Class Terminal
If StayAtChapter = True Then
Strings.ComputerInfo(0) = "shiftos"
Strings.ComputerInfo(1) = "user"
LoadGame()
CheckFeature()
PrintPrompt()
AssignPrompt()
@ -45,6 +48,7 @@ Public Class Terminal
Else
Strings.ComputerInfo(0) = "shiftos"
Strings.ComputerInfo(1) = "user"
LoadGame()
CheckFeature()
PrintPrompt()
AssignPrompt()
@ -59,16 +63,36 @@ Public Class Terminal
Public Sub CheckFeature()
If Strings.AvailableFeature(4) = "1" Then
If Strings.OnceInfo(2) = "True" Then
InfoBarTimer.Start()
TextBox1.Dock = DockStyle.None
InfoBar.Visible = True
InfoBar.SendToBack()
TextBox1.Dock = DockStyle.Fill
If ToolBarUse = True Then
If Strings.OnceInfo(2) = "True" Then
InfoBarTimer.Start()
TextBox1.Dock = DockStyle.None
ToolBar.Visible = True
ToolBar.SendToBack()
InfoBar.Visible = True
InfoBar.SendToBack()
TextBox1.Dock = DockStyle.Fill
Else
TextBox1.Dock = DockStyle.None
InfoBar.Visible = False
ToolBar.Visible = True
ToolBar.SendToBack()
TextBox1.Dock = DockStyle.Fill
End If
Else
TextBox1.Dock = DockStyle.None
InfoBar.Visible = False
TextBox1.Dock = DockStyle.Fill
If Strings.OnceInfo(2) = "True" Then
InfoBarTimer.Start()
TextBox1.Dock = DockStyle.None
InfoBar.Visible = True
InfoBar.SendToBack()
ToolBar.Visible = False
TextBox1.Dock = DockStyle.Fill
Else
TextBox1.Dock = DockStyle.None
InfoBar.Visible = False
ToolBar.Visible = False
TextBox1.Dock = DockStyle.Fill
End If
End If
Else
TextBox1.Dock = DockStyle.None
@ -117,7 +141,10 @@ Public Class Terminal
Private Sub ReadCommand()
command = TextBox1.Lines(TextBox1.Lines.Length - 1)
command = command.Replace(DefaultPrompt, "")
If DefaultPrompt = Nothing Then
Else
command = command.Replace(DefaultPrompt, "")
End If
command = command.ToLower()
End Sub
@ -131,7 +158,7 @@ Public Class Terminal
Case "bc"
If Strings.AvailableFeature(9) = "1" Then
ChangeInterpreter = True
AppHost("bc")
AppHost("bc", False)
AdvancedCommand = False
BadCommand = False
End If
@ -155,7 +182,7 @@ Public Class Terminal
BadCommand = False
Case "guess"
ChangeInterpreter = True
AppHost("guess")
AppHost("guess", False)
AdvancedCommand = False
BadCommand = False
'Undeveloped()
@ -215,7 +242,10 @@ Public Class Terminal
AdvancedCommand = False
BadCommand = False
Case "textpad"
ChangeInterpreter = True
AppHost("textpad", True)
AdvancedCommand = False
BadCommand = False
Case "reboot"
TextBox1.Text = Nothing
AdvancedCommand = False
@ -261,6 +291,9 @@ Public Class Terminal
BadCommand = False
Undeveloped()
Case "shutdown", "shut down"
If Strings.OnceInfo(6) = "story" Then
SaveGame()
End If
Cursor.Show()
ShiftOSMenu.Show()
Close()
@ -459,6 +492,8 @@ Public Class Terminal
End Sub
Private Sub txtterm_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
Select Case e.KeyData
Case (Keys.Control + Keys.Q)
If CurrentInterpreter = "terminal" Then
@ -476,84 +511,102 @@ Public Class Terminal
' TerminateApp()
' End If
'End Select
Select Case e.KeyCode
Case Keys.ShiftKey
TrackPos = TrackPos - 1
Case Keys.Alt
TrackPos = TrackPos - 1
Case Keys.CapsLock
TrackPos = TrackPos - 1
Case Keys.ControlKey
TrackPos = TrackPos - 1
Case Keys.LWin
TrackPos = TrackPos - 1
Case Keys.RWin
TrackPos = TrackPos - 1
Case Keys.Right
If TextBox1.SelectionStart = TextBox1.TextLength Then
TrackPos = TrackPos - 1
End If
Case Keys.Left
If TrackPos < 1 Then
e.SuppressKeyPress = True
TrackPos = TrackPos - 1
Else
TrackPos = TrackPos - 2
End If
Case Keys.Up
e.SuppressKeyPress = True
TrackPos = TrackPos - 1
Case Keys.Down
e.SuppressKeyPress = True
TrackPos = TrackPos - 1
End Select
If ReleaseCursor = True Then
If e.KeyCode = Keys.Enter Then
e.SuppressKeyPress = True
If TextBox1.ReadOnly = True Then
Else
ReadCommand()
If ChangeInterpreter = True Then
DoChildCommand()
PrintPrompt()
TextBox1.Select(TextBox1.Text.Length, 0)
Else
DoCommand()
PrintPrompt()
TextBox1.Select(TextBox1.Text.Length, 0)
End If
End If
'If command = "clear" Then
' PrintPrompt()
' TextBox1.Select(TextBox1.Text.Length, 0)
'Else
' PrintPrompt()
' TextBox1.Select(TextBox1.Text.Length, 0)
'End If
TrackPos = 0
Else
If e.KeyCode = Keys.Back Then
Else
TrackPos = TrackPos + 1
End If
End If
If ReleaseCursor = True Then
If e.KeyCode = Keys.Back Then
If TrackPos < 1 Then
e.SuppressKeyPress = True
Else
If TextBox1.SelectedText.Length < 1 Then
Select Case e.KeyCode
Case Keys.ShiftKey
TrackPos = TrackPos - 1
Case Keys.Alt
TrackPos = TrackPos - 1
Case Keys.CapsLock
TrackPos = TrackPos - 1
Case Keys.ControlKey
TrackPos = TrackPos - 1
Case Keys.Right
If TextBox1.SelectionStart = TextBox1.TextLength Then
TrackPos = TrackPos - 1
End If
Case Keys.Left
If TrackPos < 1 Then
e.SuppressKeyPress = True
TrackPos = TrackPos - 1
Else
TrackPos = TrackPos - 2
End If
Case Keys.Up
e.SuppressKeyPress = True
TrackPos = TrackPos - 1
Case Keys.Down
e.SuppressKeyPress = True
TrackPos = TrackPos - 1
End Select
End If
Select Case e.KeyCode
Case Keys.LWin
TrackPos = TrackPos - 1
Case Keys.RWin
TrackPos = TrackPos - 1
End Select
If e.KeyCode = Keys.Enter Then
e.SuppressKeyPress = True
If TextBox1.ReadOnly = True Then
Else
e.SuppressKeyPress = True
ReadCommand()
If ChangeInterpreter = True Then
DoChildCommand()
PrintPrompt()
TextBox1.Select(TextBox1.Text.Length, 0)
Else
DoCommand()
PrintPrompt()
TextBox1.Select(TextBox1.Text.Length, 0)
End If
End If
'If command = "clear" Then
' PrintPrompt()
' TextBox1.Select(TextBox1.Text.Length, 0)
'Else
' PrintPrompt()
' TextBox1.Select(TextBox1.Text.Length, 0)
'End If
TrackPos = 0
Else
If ReleaseCursor = True Then
Else
If e.KeyCode = Keys.Back Then
Else
TrackPos = TrackPos + 1
End If
End If
End If
End If
If ReleaseCursor = True Then
Else
If e.KeyCode = Keys.Back Then
If TrackPos < 1 Then
e.SuppressKeyPress = True
Else
If TextBox1.SelectedText.Length < 1 Then
TrackPos = TrackPos - 1
Else
e.SuppressKeyPress = True
End If
End If
End If
End If
End If
TextBox1.Select(TextBox1.TextLength, 0)
TextBox1.ScrollToCaret()
End Sub

View file

@ -23,7 +23,7 @@
Strings.ComputerInfo(2) = Convert.ToString(TempCP)
End Sub
Public Sub AppHost(App As Object)
Public Sub AppHost(App As Object, UseToolBar As Boolean)
Select Case App
Case "bc"
Terminal.DefaultPrompt = "> "
@ -32,7 +32,7 @@
ShouldChange = True
Case "guess" 'Guess the Number
Terminal.DefaultPrompt = "Your answer: "
Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "Guess the Number" & Environment.NewLine & "Guess the correct number between 1 and 50 and you'll get anything between 1 to 5 Codepoints" & Environment.NewLine & "Type 'exit' to terminate this game"
Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "Guess the Number" & Environment.NewLine & "Guess the correct number between 1 and 50 and you'll get anything between 1 to 10 Codepoints" & Environment.NewLine & "Type 'exit' to terminate this game"
Terminal.CurrentInterpreter = "guess"
GTN_GenerateNumber()
ShouldChange = True
@ -49,7 +49,19 @@
ShiftoriumFX_DisplayPackages()
Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & Environment.NewLine & "Type any package you want to investigate"
ShouldChange = True
Case "textpad"
Terminal.DefaultPrompt = ""
Terminal.ToolBarUse = True
Terminal.CheckFeature()
Terminal.CurrentInterpreter = "textpad"
Terminal.ToolBar.Text = "TextPad - " & Environment.NewLine & "Ctrl-Q Exit | Ctrl-N New | Ctrl-O Open | Ctrl-S Save | F12 Save As"
Terminal.TextBox1.Text = Nothing
Terminal.ReleaseCursor = True
End Select
If Terminal.ReleaseCursor = True Then
Strings.OnceInfo(5) = Terminal.TrackPos
Terminal.TrackPos = Nothing
End If
If ShouldChange = True Then
Terminal.ChangeInterpreter = True
ShouldChange = False
@ -57,8 +69,15 @@
End Sub
Public Sub TerminateApp()
If Terminal.ReleaseCursor = True Then
Terminal.TrackPos = Strings.OnceInfo(5)
Strings.OnceInfo(5) = 0
End If
Terminal.ToolBarUse = False
Terminal.ChangeInterpreter = False
Terminal.ReleaseCursor = False
Terminal.CurrentInterpreter = "terminal"
Terminal.CheckFeature()
Terminal.AssignPrompt()
End Sub
@ -167,7 +186,7 @@
If TheirNumber > 0 And TheirNumber < 51 Then
If TheirNumber = TheNumber Then
Dim GetCP As New Random
Dim GotCP As Integer = GetCP.Next(1, 6)
Dim GotCP As Integer = GetCP.Next(1, 11)
ChangeCP(True, GotCP)
Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "You are correct!, you got " & GotCP & " Codepoint(s)" & Environment.NewLine & "Guess the new number between 1 and 50."
GTN_GenerateNumber()

View file

@ -16,7 +16,7 @@
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>

View file

@ -1 +1 @@
0.2.2
0.2.3