diff options
| -rw-r--r-- | TimeHACK.Main/GlobalPrograms/WinClassicTerminal.Designer.cs | 1 | ||||
| -rw-r--r-- | TimeHACK.Main/GlobalPrograms/WinClassicTerminal.cs | 31 |
2 files changed, 20 insertions, 12 deletions
diff --git a/TimeHACK.Main/GlobalPrograms/WinClassicTerminal.Designer.cs b/TimeHACK.Main/GlobalPrograms/WinClassicTerminal.Designer.cs index f251094..b505208 100644 --- a/TimeHACK.Main/GlobalPrograms/WinClassicTerminal.Designer.cs +++ b/TimeHACK.Main/GlobalPrograms/WinClassicTerminal.Designer.cs @@ -106,6 +106,7 @@ this.termMax.Size = new System.Drawing.Size(23, 22); this.termMax.TabIndex = 5; this.termMax.UseVisualStyleBackColor = true; + this.termMax.Click += new System.EventHandler(this.termMax_Click); // // btnNothing // diff --git a/TimeHACK.Main/GlobalPrograms/WinClassicTerminal.cs b/TimeHACK.Main/GlobalPrograms/WinClassicTerminal.cs index 731bec1..99f7aed 100644 --- a/TimeHACK.Main/GlobalPrograms/WinClassicTerminal.cs +++ b/TimeHACK.Main/GlobalPrograms/WinClassicTerminal.cs @@ -13,7 +13,6 @@ using System.Threading; using System.Reflection; using System.Linq.Expressions; using System.Diagnostics; -using System.Text.RegularExpressions; namespace TimeHACK.OS.Win95.Win95Apps { @@ -21,10 +20,9 @@ namespace TimeHACK.OS.Win95.Win95Apps { public Engine.WindowManager wm = new Engine.WindowManager(); - public int currentLine = 0; + public static int currentLine = 0; public static string prefix = @"C:\>"; public static string startupDir = $"{Engine.SaveSystem.ProfileMyComputerDirectory}"; - public string output = ""; public WinClassicTerminal() { @@ -43,7 +41,7 @@ namespace TimeHACK.OS.Win95.Win95Apps sizeSel.SelectedIndex = 0; // Set the font and append the prefix text - cmdPrompt.Font = new Font(TitleScreen.pfc.Families[1], 10F, System.Drawing.FontStyle.Regular); + cmdPrompt.Font = new System.Drawing.Font(TitleScreen.pfc.Families[1], 10F, System.Drawing.FontStyle.Regular); cmdPrompt.AppendText(prefix); cmdPrompt.BringToFront(); @@ -84,6 +82,16 @@ namespace TimeHACK.OS.Win95.Win95Apps wm.StartInfobox95("ERROR", "You need to have something in your clipboard to paste.", Properties.Resources.Win95Error); // Display an error message if the clipboard is null/empty } + private void termMax_Click(object sender, EventArgs e) + { + var windowState = ((Engine.Template.WinClassic)this.TopLevelControl).WindowState; + + if (windowState == FormWindowState.Normal) + windowState = FormWindowState.Maximized; + else if (windowState == FormWindowState.Maximized) + windowState = FormWindowState.Normal; + } + private void btnSettings_Click(object sender, EventArgs e) { wm.StartInfobox95("INFO", "This feature has not been implemented yet. Stay tuned! -Jason", Properties.Resources.Win95Info); @@ -99,7 +107,7 @@ namespace TimeHACK.OS.Win95.Win95Apps { if (e.KeyData == Keys.Return) { - // Temporary CMD redirect + /// Temporary CMD redirect Process p = new Process(); p.StartInfo.UseShellExecute = false; @@ -107,18 +115,17 @@ namespace TimeHACK.OS.Win95.Win95Apps p.StartInfo.CreateNoWindow = true; p.StartInfo.WorkingDirectory = startupDir; p.StartInfo.FileName = "cmd.exe"; - p.StartInfo.Arguments = $"/C {cmdPrompt.Lines[currentLine].Substring(prefix.Length)}"; + p.StartInfo.Arguments = $"/C {cmdPrompt.Lines[cmdPrompt.GetLineFromCharIndex(currentLine)].Substring(prefix.Length)}"; p.Start(); - output = p.StandardOutput.ReadToEnd(); + string output = p.StandardOutput.ReadToEnd(); + p.WaitForExit(); cmdPrompt.Focus(); - cmdPrompt.AppendText($"\n{output}"); // Append the command output - - int numLines = output.Split('\n').Length; // Get the number of lines from the command output - currentLine = currentLine + 2 + numLines; // Set the current line to equals the previous line plus 2 plus the number of lines from the command + cmdPrompt.AppendText($"\n{output}"); - cmdPrompt.AppendText($"\n{prefix}"); // Append the text to the RichTextBox + currentLine++; + cmdPrompt.AppendText($"\n{prefix}"); } } } |
