diff options
| author | AShifter <[email protected]> | 2017-12-10 15:55:14 -0700 |
|---|---|---|
| committer | AShifter <[email protected]> | 2017-12-10 15:55:14 -0700 |
| commit | 684cdb8e3b7e9bb7e5d9be2b837bcf2c48967b52 (patch) | |
| tree | dec0dbd08ac6945ce659741045a7a20e05b8cfe6 /ShiftOS.Main/ShiftOS/Apps | |
| parent | 686f10a8d9850a25413ec4647dc0111f8548a596 (diff) | |
| download | shiftos-rewind-684cdb8e3b7e9bb7e5d9be2b837bcf2c48967b52.tar.gz shiftos-rewind-684cdb8e3b7e9bb7e5d9be2b837bcf2c48967b52.tar.bz2 shiftos-rewind-684cdb8e3b7e9bb7e5d9be2b837bcf2c48967b52.zip | |
something is wrong with git
hrm
Diffstat (limited to 'ShiftOS.Main/ShiftOS/Apps')
| -rw-r--r-- | ShiftOS.Main/ShiftOS/Apps/Terminal.cs | 148 |
1 files changed, 0 insertions, 148 deletions
diff --git a/ShiftOS.Main/ShiftOS/Apps/Terminal.cs b/ShiftOS.Main/ShiftOS/Apps/Terminal.cs deleted file mode 100644 index f7307cb..0000000 --- a/ShiftOS.Main/ShiftOS/Apps/Terminal.cs +++ /dev/null @@ -1,148 +0,0 @@ -using System; -using System.Windows.Forms; -using ShiftOS.Engine; -using ShiftOS.Main.Terminal; -using System.Linq; -using System.Collections.Generic; -using System.Drawing.Text; - -namespace ShiftOS.Main.ShiftOS.Apps -{ - public partial class Terminal : UserControl - { - public int TerminalID = TerminalBackend.trmTopID++; // Used so that we can have multiple instances of the terminal whilst the command begin run knowing what terminal to send the text to - very complicated ;) - public string defaulttextBefore = "user> "; - public string defaulttextResult = "[user@shiftos ~]$ "; // NOT YET IMPLEMENTED!!! - public bool DoClear = false; - public bool RunningCommand = false; - public bool WaitingResponse = false; - public string InputReturnText = ""; - public Stack<string> c = TerminalBackend.commandBuffer; - private PrivateFontCollection fontCollection = new PrivateFontCollection(); - - // The below variables makes the terminal... a terminal! - string OldText = ""; - - int TrackingPosition; - - public Terminal() - { - InitializeComponent(); - - termmain.ContextMenuStrip = new ContextMenuStrip(); // Disables the right click of a richtextbox! - - TerminalBackend.trm.Add(this); - - fontCollection.AddFontFile(SaveSystem.fontDir + "\\termFont.ttf"); - - termmain.Font = new System.Drawing.Font(fontCollection.Families[0], 12F, System.Drawing.FontStyle.Regular); - - } - - void Print() - { - termmain.AppendText($"\n {defaulttextResult}"); - TrackingPosition = termmain.Text.Length; - } - - void Print(string text) - { - termmain.AppendText($"\n {text} \n {defaulttextResult}"); - TrackingPosition = termmain.Text.Length; - } - - //if (e.Control && e.KeyCode == Keys.V) - // { - // //if (Clipboard.ContainsText()) - // // termmain.Paste(DataFormats.GetFormat(DataFormats.Text)); - // e.Handled = true; - // } else if (e.KeyCode == Keys.Enter) { - // RunningCommand = true; - // TerminalBackend.RunCommand(termmain.Text.Substring(TrackingPosition, termmain.Text.Length - TrackingPosition), TerminalID); // The most horrific line in the entire application! - // RunningCommand = false; - // termmain.AppendText($"\n {defaulttextResult}"); - // TrackingPosition = termmain.Text.Length; - // e.Handled = true; - // } - //} - - private void termmain_TextChanged(object sender, EventArgs e) - { - if (!RunningCommand) - { - if (termmain.SelectionStart < TrackingPosition) - { - if (!DoClear) // If it's not clearing the terminal - { - termmain.Text = OldText; - termmain.Select(termmain.Text.Length, 0); - } - } - else - { - OldText = termmain.Text; - } - } - } - - private void termmain_SelectionChanged(object sender, EventArgs e) - { - if (!RunningCommand) - { - if (termmain.SelectionStart < TrackingPosition) - { - termmain.Text = OldText; - termmain.Select(termmain.Text.Length, 0); - } - } - } - - private void Terminal_Load(object sender, EventArgs e) - { - termmain.Text = $"\n {defaulttextResult}"; - TrackingPosition = termmain.Text.Length; - termmain.Select(termmain.TextLength, 1); - } - - public void Input(string request) - { - InputReturnText = ""; - RunningCommand = false; - - termmain.AppendText($"\n {request} "); - TrackingPosition = termmain.Text.Length; - } - - public void Clear() - { - DoClear = true; - OldText = ""; - termmain.Text = ""; - TrackingPosition = termmain.Text.Length; - DoClear = false; - } - - void termmain_KeyDown(object sender, KeyEventArgs e) - { - // The below code disables the ability to paste anything other then text... - - if (e.Control && e.KeyCode == Keys.V) - { - //if (Clipboard.ContainsText()) - // termmain.Paste(DataFormats.GetFormat(DataFormats.Text)); - e.Handled = true; - } - else if (e.KeyCode == Keys.Enter) - { - TerminalBackend.RunCommand(termmain.Text.Substring(TrackingPosition, termmain.Text.Length - TrackingPosition), TerminalID); // The most horrific line in the entire application! - Print(); - e.Handled = true; - } - else if (e.KeyCode == Keys.Up) - { - if (c.Count == 0) return; - termmain.AppendText(c.Pop()); - } - } - } -} |
