From 17ca0d0942c2a4e568349a74e87807eb00838666 Mon Sep 17 00:00:00 2001 From: lempamo Date: Sun, 2 Jul 2017 17:54:32 -0400 Subject: ALEX DONT FUCK THINGS UP AGAIN PLZ --- TimeHACK.Main/GlobalPrograms/WinClassicTerminal.cs | 132 --------------------- 1 file changed, 132 deletions(-) delete mode 100644 TimeHACK.Main/GlobalPrograms/WinClassicTerminal.cs (limited to 'TimeHACK.Main/GlobalPrograms/WinClassicTerminal.cs') diff --git a/TimeHACK.Main/GlobalPrograms/WinClassicTerminal.cs b/TimeHACK.Main/GlobalPrograms/WinClassicTerminal.cs deleted file mode 100644 index 99f7aed..0000000 --- a/TimeHACK.Main/GlobalPrograms/WinClassicTerminal.cs +++ /dev/null @@ -1,132 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using System.Media; -using System.IO; -using System.Threading; -using System.Reflection; -using System.Linq.Expressions; -using System.Diagnostics; - -namespace TimeHACK.OS.Win95.Win95Apps -{ - public partial class WinClassicTerminal : UserControl - { - public Engine.WindowManager wm = new Engine.WindowManager(); - - public static int currentLine = 0; - public static string prefix = @"C:\>"; - public static string startupDir = $"{Engine.SaveSystem.ProfileMyComputerDirectory}"; - - public WinClassicTerminal() - { - InitializeComponent(); - - // Paint the classic borders - btnCopy.Paint += (sender, args) => Engine.Paintbrush.PaintClassicBorders(sender, args, 2); - btnFont.Paint += (sender, args) => Engine.Paintbrush.PaintClassicBorders(sender, args, 2); - btnMark.Paint += (sender, args) => Engine.Paintbrush.PaintClassicBorders(sender, args, 2); - btnNothing.Paint += (sender, args) => Engine.Paintbrush.PaintClassicBorders(sender, args, 2); - btnPaste.Paint += (sender, args) => Engine.Paintbrush.PaintClassicBorders(sender, args, 2); - btnSettings.Paint += (sender, args) => Engine.Paintbrush.PaintClassicBorders(sender, args, 2); - sizeSel.Paint += (sender, args) => Engine.Paintbrush.PaintClassicBorders(sender, args, 2); - - // Set the default index to "Auto" - sizeSel.SelectedIndex = 0; - - // Set the font and append the prefix text - cmdPrompt.Font = new System.Drawing.Font(TitleScreen.pfc.Families[1], 10F, System.Drawing.FontStyle.Regular); - cmdPrompt.AppendText(prefix); - - cmdPrompt.BringToFront(); - } - /// - /// Write text to the Terminal and create a new line. Very similar to the Win32 Console.WriteLine Function. - /// - /// - public void WriteLine(string Text) - { - cmdPrompt.AppendText(Text + "\n"); - this.Update(); - } - - /// - /// Write text to the Terminal. Very similar to the Win32 Console.Write Function. - /// - /// - public void Write(String Text) - { - cmdPrompt.AppendText(Text); - cmdPrompt.Update(); - } - - private void btnCopy_Click(object sender, EventArgs e) - { - if (cmdPrompt.SelectedText.Length > 0) - Clipboard.SetText(cmdPrompt.SelectedText); // Set the clipboard text to the selection of the RichTextBox - else - wm.StartInfobox95("ERROR", "You need to select something to copy.", Properties.Resources.Win95Error); // Display an error message if the length is 0 - } - - private void btnPaste_Click(object sender, EventArgs e) - { - if (Clipboard.GetText() != "") - Write(Clipboard.GetText()); // Write the contents of the Clipboard text in the RichTextBox - else - 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); - //TODO: Well, add the settings... - } - - private void btnFont_Click(object sender, EventArgs e) - { - //TODO: Add font UC(?) - } - - private void richTextBox1_KeyUp(object sender, KeyEventArgs e) - { - if (e.KeyData == Keys.Return) - { - /// Temporary CMD redirect - Process p = new Process(); - - p.StartInfo.UseShellExecute = false; - p.StartInfo.RedirectStandardOutput = true; - p.StartInfo.CreateNoWindow = true; - p.StartInfo.WorkingDirectory = startupDir; - p.StartInfo.FileName = "cmd.exe"; - p.StartInfo.Arguments = $"/C {cmdPrompt.Lines[cmdPrompt.GetLineFromCharIndex(currentLine)].Substring(prefix.Length)}"; - p.Start(); - - string output = p.StandardOutput.ReadToEnd(); - p.WaitForExit(); - - cmdPrompt.Focus(); - cmdPrompt.AppendText($"\n{output}"); - - currentLine++; - cmdPrompt.AppendText($"\n{prefix}"); - } - } - } -} -- cgit v1.2.3