mirror of
https://github.com/HistacomUnity/Histacom2-old.git
synced 2025-01-22 09:02:01 -05:00
Merge branch 'master' of https://github.com/Histacom2-Devs/Histacom2.git
This commit is contained in:
commit
18b78b05bc
1 changed files with 21 additions and 7 deletions
|
@ -28,7 +28,7 @@ public partial class WinClassicTerminal : UserControl
|
|||
public static string prefix = @"C:\WINDOWS>";
|
||||
public static string workingDir = $"{SaveSystem.ProfileWindowsDirectory}";
|
||||
public string output = "";
|
||||
|
||||
public bool cls = false;
|
||||
public WinClassicTerminal(bool readOnly)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -110,6 +110,7 @@ private void btnFont_Click(object sender, EventArgs e)
|
|||
|
||||
private void richTextBox1_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
|
||||
if (e.KeyData == Keys.Return)
|
||||
{
|
||||
string[] cmd = cmdPrompt.Lines[currentLine].Substring(prefix.Length).Split(' ');
|
||||
|
@ -151,6 +152,12 @@ private void richTextBox1_KeyUp(object sender, KeyEventArgs e)
|
|||
dline = dline.Insert(34, "bytes free");
|
||||
output += dline;
|
||||
|
||||
break;
|
||||
case "cls":
|
||||
currentLine = 0;
|
||||
cmdPrompt.Clear();
|
||||
cls = true;
|
||||
output = prefix;
|
||||
break;
|
||||
default:
|
||||
// Temporary CMD redirect
|
||||
|
@ -174,11 +181,18 @@ private void richTextBox1_KeyUp(object sender, KeyEventArgs e)
|
|||
|
||||
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\n{prefix}"); // Append the text to the RichTextBox
|
||||
string[] stringSeparators = new string[] { "\n" };
|
||||
string[] lines = output.Split(stringSeparators, StringSplitOptions.None);
|
||||
foreach (string s in lines)
|
||||
{
|
||||
currentLine++;
|
||||
}
|
||||
if (!cls)
|
||||
{
|
||||
cmdPrompt.AppendText($"\n\n{prefix}"); // Append the text to the RichTextBox
|
||||
currentLine = currentLine + 3;
|
||||
}
|
||||
cls = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue