diff options
| author | EverythingWindows <[email protected]> | 2022-11-20 16:43:01 +0700 |
|---|---|---|
| committer | EverythingWindows <[email protected]> | 2022-11-20 16:43:01 +0700 |
| commit | 2fa56446be7a049994786931e9145043362e8adb (patch) | |
| tree | fd715e8afde59181985e3e2c654dfbfeeda27880 /ShiftOS-TheRevival/MainForms/Applications | |
| parent | 5ae42df217ded307bb8e33611d2292ebdb523a18 (diff) | |
| download | shiftos-therevival-old-2fa56446be7a049994786931e9145043362e8adb.tar.gz shiftos-therevival-old-2fa56446be7a049994786931e9145043362e8adb.tar.bz2 shiftos-therevival-old-2fa56446be7a049994786931e9145043362e8adb.zip | |
Guide command, MathQuiz App, ShiftOS About, and more
Diffstat (limited to 'ShiftOS-TheRevival/MainForms/Applications')
3 files changed, 475 insertions, 0 deletions
diff --git a/ShiftOS-TheRevival/MainForms/Applications/Console.Designer.vb b/ShiftOS-TheRevival/MainForms/Applications/Console.Designer.vb new file mode 100644 index 0000000..78dbfbf --- /dev/null +++ b/ShiftOS-TheRevival/MainForms/Applications/Console.Designer.vb @@ -0,0 +1,107 @@ +<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> +Partial Class Console + 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.components = New System.ComponentModel.Container() + Me.TextBox1 = New System.Windows.Forms.TextBox() + 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.ShortcutHandler = New System.ComponentModel.BackgroundWorker() + Me.SuspendLayout() + ' + 'TextBox1 + ' + Me.TextBox1.BackColor = System.Drawing.Color.Black + Me.TextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None + 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, 36) + Me.TextBox1.Multiline = True + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.ShortcutsEnabled = False + Me.TextBox1.Size = New System.Drawing.Size(800, 396) + Me.TextBox1.TabIndex = 0 + ' + 'StoryOnlyTimer + ' + ' + 'InfoBar + ' + Me.InfoBar.BorderStyle = System.Windows.Forms.BorderStyle.None + Me.InfoBar.Dock = System.Windows.Forms.DockStyle.Bottom + Me.InfoBar.Font = New System.Drawing.Font("Consolas", 11.0!) + Me.InfoBar.ForeColor = System.Drawing.Color.Black + Me.InfoBar.Location = New System.Drawing.Point(0, 432) + Me.InfoBar.Name = "InfoBar" + Me.InfoBar.ReadOnly = True + Me.InfoBar.ShortcutsEnabled = False + Me.InfoBar.Size = New System.Drawing.Size(800, 18) + Me.InfoBar.TabIndex = 0 + Me.InfoBar.TabStop = False + Me.InfoBar.Text = "Infobar" + Me.InfoBar.TextAlign = System.Windows.Forms.HorizontalAlignment.Right + Me.InfoBar.Visible = False + ' + '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 + ' + 'Console + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.BackColor = System.Drawing.Color.Red + 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 = "Console" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Terminal" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents TextBox1 As TextBox + Friend WithEvents StoryOnlyTimer As Timer + Friend WithEvents InfoBar As TextBox + Friend WithEvents InfoBarTimer As Timer + Friend WithEvents ToolBar As TextBox + Public WithEvents ShortcutHandler As System.ComponentModel.BackgroundWorker +End Class diff --git a/ShiftOS-TheRevival/MainForms/Applications/Console.resx b/ShiftOS-TheRevival/MainForms/Applications/Console.resx new file mode 100644 index 0000000..38ebc49 --- /dev/null +++ b/ShiftOS-TheRevival/MainForms/Applications/Console.resx @@ -0,0 +1,129 @@ +<?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> + <metadata name="StoryOnlyTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> + <metadata name="InfoBarTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>153, 17</value> + </metadata> + <metadata name="ShortcutHandler.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>274, 17</value> + </metadata> +</root>
\ No newline at end of file diff --git a/ShiftOS-TheRevival/MainForms/Applications/Console.vb b/ShiftOS-TheRevival/MainForms/Applications/Console.vb new file mode 100644 index 0000000..3ae1603 --- /dev/null +++ b/ShiftOS-TheRevival/MainForms/Applications/Console.vb @@ -0,0 +1,239 @@ +Imports System.IO + +Public Class Console + Public TrackPos As Integer 'Tracking the position of the caret in order to not bypass the user@hostname string + Public DefaultPrompt As String 'Default prompt to display in ShiftOS, usually it's user@hostname + Public BadCommand As Boolean 'Detect if it's a bad command or not + Public DisplayStory As Integer 'Keep record for displaying the DevX's or other's monologue + Public StoryToTell As String 'Which chapter that you're going to be in + Public ShouldChange As Boolean = False 'Indicates if the interpreter should changed to a specific program + Public ChangeInterpreter As Boolean = False 'Default interpreter is Terminal, if it's changed to True, there'll be other program used by Console + Public CurrentInterpreter As String 'Shows what program is using Console + Public CurrentDirectory As String 'Current Directory for ShiftOS Explorer + Public Pseudodir As String 'Pseudo-directory for ShiftFS + Public StayAtChapter As Boolean = False 'If this set to true, then intro for chapters are mostly going to be in + Public ToolBarUse As Boolean = False 'Either any program is using ToolBar or not + Public ReleaseCursor As Boolean = False 'Release cursor from TrackPos + Public ShOSKey As String 'DOSKEY tracking string for ShiftOS + Public Secure As Boolean 'Define either Secure Text mode is enabled or not (experimental!) + Public SecureString As String 'String for Secure Text mode (experimental) + + Private Sub Console_Load(sender As Object, e As EventArgs) Handles MyBase.Load + With ShortcutHandler + .WorkerSupportsCancellation = True + End With + Console_Full() + Cursor.Hide() + InitializeTerminal() + End Sub + + Private Sub txtterm_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown + KeyInput = e.KeyData + InputKey = e.KeyData + ShortcutHandle() + If ReleaseCursor = True Then + + Else + Select Case e.KeyData + Case Keys.Enter + e.SuppressKeyPress = True + If Secure = True Then + Secure = False + TextBox1.ReadOnly = False + Terminal_ReadCommand() + NewLine(SecureString) + Terminal_PrintPrompt() + SecureString = Nothing + TextRebind() + Else + If TextBox1.ReadOnly = True Then + + Else + Terminal_ReadCommand() + If Strings.AvailableFeature(18) = 1 Then + ShOSKey_InputCommand(command) + End If + If ChangeInterpreter = True Then + DoChildCommand() + Terminal_PrintPrompt() + TextRebind() + Else + Terminal_DoCommand() + Terminal_PrintPrompt() + TextRebind() + End If + End If + End If + TrackPos = 0 + Case Keys.ShiftKey, Keys.LShiftKey, Keys.RShiftKey, Keys.Alt, Keys.ControlKey, Keys.LWin, Keys.RWin + e.SuppressKeyPress = True + TrackPos = TrackPos + Case Keys.Back + If TrackPos <= 0 Then + e.SuppressKeyPress = True + Else + TrackPos = TrackPos - 1 + 'If TextBox1.SelectedText.Length < 1 Then + ' TrackPos = TrackPos - 1 + 'Else + ' e.SuppressKeyPress = True + 'End If + End If + Case Keys.Right + If TextBox1.SelectionStart = TextBox1.TextLength Then + Else + TrackPos = TrackPos + 1 + End If + 'If TrackPos <= 0 Then + ' Dim CommandChar As String + ' CommandChar = TextBox1.Lines(TextBox1.Lines.Length - 1) + ' CommandChar = CommandChar.Replace(DefaultPrompt, "") + ' TrackPos = CommandChar.Length - 1 + ' TextBox1.Select(TextBox1.TextLength, 0) + ' TextBox1.ScrollToCaret() + 'End If + Case Keys.Left + If TextBox1.SelectionStart = 0 Then + e.SuppressKeyPress = True + Else + TrackPos = TrackPos - 1 + End If + If TrackPos <= 0 Then + Dim CommandChar As String + CommandChar = TextBox1.Lines(TextBox1.Lines.Length - 1) + CommandChar = CommandChar.Replace(DefaultPrompt, "") + TrackPos = CommandChar.Length - 1 + TextBox1.Select(TextBox1.TextLength, 0) + TextBox1.ScrollToCaret() + End If + 'If TrackPos < 1 Then + ' e.SuppressKeyPress = True + ' TrackPos = TrackPos - 1 + 'Else + ' TrackPos = TrackPos - 2 + 'End If + Case Keys.Up + e.SuppressKeyPress = True + If Strings.AvailableFeature(18) = 1 Then + ShOSKey_Display() + TextRebind() + End If + Case Keys.Down + e.SuppressKeyPress = True + If Strings.AvailableFeature(18) = 1 Then + ShOSKey_Display() + TextRebind() + End If + Case Else + If Secure = True Then + If e.Modifiers = Keys.Shift Then + SecureString = SecureString & Chr(e.KeyValue) + Else + SecureString = SecureString & Chr(e.KeyValue + 32) + End If + Else + TrackPos = TrackPos + 1 + End If + End Select + End If + 'If e.KeyCode = Keys.Enter Then + ' 'If command = "clear" Then + ' ' txtterm.Text = txtterm.Text + ShiftOSDesktop.username & "@" & ShiftOSDesktop.osname & " $> " + ' ' txtterm.Select(txtterm.Text.Length, 0) + + ' 'Else + ' ' txtterm.Text = txtterm.Text + Environment.NewLine & ShiftOSDesktop.username & "@" & ShiftOSDesktop.osname & " $> " + ' ' txtterm.Select(txtterm.Text.Length, 0) + ' 'End If + 'Else + ' If e.KeyCode = Keys.Back Then + ' Else + ' TrackPos = TrackPos + 1 + ' End If + 'End If + + '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 Sub + + Private Sub TextBox1_Click(sender As Object, e As EventArgs) Handles TextBox1.Click, TextBox1.MouseDoubleClick + TextRebind() + End Sub + + Private Sub StoryOnlyTimer_Tick(sender As Object, e As EventArgs) Handles StoryOnlyTimer.Tick + StoryLineIntro(DisplayStory) + DisplayStory = DisplayStory + 1 + End Sub + + Private Sub InfoBarTimer_Tick(sender As Object, e As EventArgs) Handles InfoBarTimer.Tick + InfoBar.Text = "|" + If Strings.AvailableFeature(5) = "1" Then + InfoBar.Text = InfoBar.Text & " " & Math.Floor(Date.Now.Subtract(Date.Today).TotalSeconds) & " |" + ElseIf Strings.AvailableFeature(5) = "3" Then + If Strings.AvailableFeature(6) = "1" Then + InfoBar.Text = InfoBar.Text & " " & Math.Floor(Date.Now.Subtract(Date.Today).TotalMinutes) & " |" + ElseIf Strings.AvailableFeature(6) = "3" Then + If Strings.AvailableFeature(7) = "1" Then + InfoBar.Text = InfoBar.Text & " " & Math.Floor(Date.Now.Subtract(Date.Today).TotalHours) & " |" + ElseIf Strings.AvailableFeature(7) = "3" Then + If Strings.AvailableFeature(12) = "1" Then + If Date.Now.Hour < 12 Then + InfoBar.Text = InfoBar.Text & Environment.NewLine & " " & TimeOfDay.Hour & " AM |" + Else + InfoBar.Text = InfoBar.Text & Environment.NewLine & " " & TimeOfDay.Hour - 12 & " PM |" + End If + ElseIf Strings.AvailableFeature(12) = "3" Then + If Strings.AvailableFeature(23) = "1" Then + InfoBar.Text = InfoBar.Text & Environment.NewLine & " " & TimeOfDay.Hour & ":" & TimeOfDay.Minute & " |" + End If + End If + End If + End If + End If + If Strings.AvailableFeature(24) = 1 Then + InfoBar.Text = InfoBar.Text & " " & Date.Now.DayOfYear & " |" + ElseIf Strings.AvailableFeature(24) = 3 Then + If Strings.AvailableFeature(25) = 1 Then + Dim WeekOfYear As String = Date.Now.DayOfYear / 7 + InfoBar.Text = InfoBar.Text & " " & WeekOfYear.Substring(0, 2) & " |" + ElseIf Strings.AvailableFeature(25) = 3 Then + If Strings.AvailableFeature(26) = 1 Then + InfoBar.Text = InfoBar.Text & " " & Date.Now.Month & " |" + ElseIf Strings.AvailableFeature(26) = 3 Then + If Strings.AvailableFeature(27) = 1 Then + InfoBar.Text = InfoBar.Text & " " & Date.Now.Year & " |" + ElseIf Strings.AvailableFeature(27) = 3 Then + If Strings.AvailableFeature(28) = 1 Then + InfoBar.Text = InfoBar.Text & " " & Date.Now.Day & "/" & Date.Now.Month & " |" + ElseIf Strings.AvailableFeature(28) = 3 Then + If Strings.AvailableFeature(29) = 1 Then + InfoBar.Text = InfoBar.Text & " " & Date.Now.Day & "/" & Date.Now.Month & "/" & Date.Now.Year & " |" + End If + End If + End If + End If + End If + End If + If Strings.OnceInfo(0) = "Yes" Then + InfoBar.Text = InfoBar.Text & " root |" + Else + InfoBar.Text = InfoBar.Text & " user |" + End If + InfoBar.Text = InfoBar.Text & " " & CurrentInterpreter & " |" + InfoBar.Text = InfoBar.Text & " " & Strings.ComputerInfo(2) & " CP |" + InfoBar.Text = InfoBar.Text & " " & TrackPos & " |" + End Sub + + Private Sub TextBox1_Click(sender As Object, e As MouseEventArgs) Handles TextBox1.MouseDoubleClick, TextBox1.Click + + End Sub +End Class
\ No newline at end of file |
