From a10440a45c40652b13e883aec832a0c8ded685e8 Mon Sep 17 00:00:00 2001 From: John T Date: Sun, 5 Nov 2017 18:47:46 -0500 Subject: Added a half-complete ShiftFS and did some code cleanup --- ShiftOS.Main/App.config | 9 +- ShiftOS.Main/HijackScreen.Designer.cs | 105 ---- ShiftOS.Main/HijackScreen.cs | 612 --------------------- ShiftOS.Main/HijackScreen.resx | 132 ----- ShiftOS.Main/Program.cs | 27 +- ShiftOS.Main/Properties/AssemblyInfo.cs | 3 +- ShiftOS.Main/Properties/Settings.settings | 3 +- ShiftOS.Main/Resources/CatalystGrammar.xml | 13 +- ShiftOS.Main/ShiftOS.Main.csproj | 9 - ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs | 2 +- ShiftOS.Main/ShiftOS/Apps/ShiftDemo.cs | 34 +- .../Apps/ShifterStuff/SelectColor.Designer.cs | 2 +- .../ShiftOS/Apps/ShifterStuff/SelectColor.cs | 92 ++-- .../ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs | 8 +- ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs | 201 +++---- ShiftOS.Main/ShiftOS/Apps/Terminal.cs | 143 +++-- ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs | 2 +- ShiftOS.Main/ShiftOS/Apps/TestForm.cs | 41 +- ShiftOS.Main/ShiftOS/Apps/TextPad.cs | 76 +-- ShiftOS.Main/ShiftOS/Desktop.cs | 96 ++-- ShiftOS.Main/packages.config | 1 + 21 files changed, 363 insertions(+), 1248 deletions(-) delete mode 100644 ShiftOS.Main/HijackScreen.Designer.cs delete mode 100644 ShiftOS.Main/HijackScreen.cs delete mode 100644 ShiftOS.Main/HijackScreen.resx (limited to 'ShiftOS.Main') diff --git a/ShiftOS.Main/App.config b/ShiftOS.Main/App.config index 8e15646..5c73fc5 100644 --- a/ShiftOS.Main/App.config +++ b/ShiftOS.Main/App.config @@ -1,6 +1,7 @@ - + + - - - + + + \ No newline at end of file diff --git a/ShiftOS.Main/HijackScreen.Designer.cs b/ShiftOS.Main/HijackScreen.Designer.cs deleted file mode 100644 index fab31dc..0000000 --- a/ShiftOS.Main/HijackScreen.Designer.cs +++ /dev/null @@ -1,105 +0,0 @@ -namespace ShiftOS.Main -{ - partial class HijackScreen - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker(); - this.conversationtimer = new System.Windows.Forms.Timer(this.components); - this.hackeffecttimer = new System.Windows.Forms.Timer(this.components); - this.lblHijack = new System.Windows.Forms.Label(); - this.textgen = new System.Windows.Forms.Timer(this.components); - this.lblhackwords = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // conversationtimer - // - this.conversationtimer.Tick += new System.EventHandler(this.conversationtimer_Tick); - // - // hackeffecttimer - // - this.hackeffecttimer.Interval = 50; - this.hackeffecttimer.Tick += new System.EventHandler(this.hackeffecttimer_Tick); - // - // lblHijack - // - this.lblHijack.Anchor = System.Windows.Forms.AnchorStyles.None; - this.lblHijack.AutoSize = true; - this.lblHijack.BackColor = System.Drawing.Color.WhiteSmoke; - this.lblHijack.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F); - this.lblHijack.ForeColor = System.Drawing.Color.DimGray; - this.lblHijack.Location = new System.Drawing.Point(143, 193); - this.lblHijack.Name = "lblHijack"; - this.lblHijack.Size = new System.Drawing.Size(18, 25); - this.lblHijack.TabIndex = 0; - this.lblHijack.Text = "\\"; - // - // textgen - // - this.textgen.Interval = 20; - this.textgen.Tick += new System.EventHandler(this.textgen_Tick); - // - // lblhackwords - // - this.lblhackwords.AutoSize = true; - this.lblhackwords.Dock = System.Windows.Forms.DockStyle.Fill; - this.lblhackwords.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblhackwords.ForeColor = System.Drawing.SystemColors.ButtonFace; - this.lblhackwords.Location = new System.Drawing.Point(0, 0); - this.lblhackwords.Name = "lblhackwords"; - this.lblhackwords.Size = new System.Drawing.Size(127, 18); - this.lblhackwords.TabIndex = 1; - this.lblhackwords.Text = "Hijack in progress"; - // - // HijackScreen - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.Silver; - this.ClientSize = new System.Drawing.Size(636, 418); - this.Controls.Add(this.lblhackwords); - this.Controls.Add(this.lblHijack); - this.Name = "HijackScreen"; - this.Text = "ShiftOS"; - this.TransparencyKey = System.Drawing.Color.White; - this.Load += new System.EventHandler(this.HijackScreen_Load); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.ComponentModel.BackgroundWorker backgroundWorker1; - private System.Windows.Forms.Timer conversationtimer; - private System.Windows.Forms.Timer hackeffecttimer; - private System.Windows.Forms.Label lblHijack; - private System.Windows.Forms.Timer textgen; - private System.Windows.Forms.Label lblhackwords; - } -} \ No newline at end of file diff --git a/ShiftOS.Main/HijackScreen.cs b/ShiftOS.Main/HijackScreen.cs deleted file mode 100644 index 721d49e..0000000 --- a/ShiftOS.Main/HijackScreen.cs +++ /dev/null @@ -1,612 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using System.IO; -using System.Media; -using System.Text.RegularExpressions; - -namespace ShiftOS.Main -{ - public partial class HijackScreen : Form - { - public string actualshiftversion = "0.0.1.1"; - string rtext; - string gtexttotype; - int charcount; - int currentletter; - int slashcount; - int conversationcount = 0; - Label textgeninput; - bool needtoclose = false; - string oldversion; - public bool upgraded = false; - SoundPlayer player = new SoundPlayer(); - - FileStream fs; - int hackeffect; - int percentcount; - - static DriveInfo[] cdrives = DriveInfo.GetDrives(); - DriveInfo cdrive = Array.Find(cdrives, c => "C:\\" == "C:\\"); - public HijackScreen() - { - InitializeComponent(); - } - private void PlaySound(Stream path) - { - player.Stream = path; - player.Play(); - player.Stream.Position = 0; - } - private void HijackScreen_Load(object sender, EventArgs e) - { - //extractdlls(); - Control.CheckForIllegalCrossThreadCalls = false; - - this.FormBorderStyle = FormBorderStyle.None; - this.WindowState = FormWindowState.Maximized; - if (Directory.Exists("C:\\ShiftOS-Rewind")) - { - if (File.ReadAllText("C:/ShiftOS-Rewind/Shiftum42/HDAccess.sft") == actualshiftversion) - { - //ShiftOSDesktop.Show(); - conversationtimer.Start(); - needtoclose = true; - } - else - { - if (MessageBox.Show("Your save file is not currently compatible with this version of ShiftOS. Would you like to upgrade your save file so you can continue to play the latest version of ShiftOS without losing your progress? If so click yes below. If you would like to start a new game and wipe all your progress please click no", "Warning: Update your save file", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) == DialogResult.Yes) - { - this.Hide(); - //ShiftOS_Save_File_Converter.Show(); - // ShiftOS_Save_File_Converter.BringToFront(); - } - else - { - oldversion = System.IO.File.ReadAllText("C:/ShiftOS-Rewind/Shiftum42/HDAccess.sft"); - upgraded = true; - System.IO.Directory.Delete("C:/ShiftOS-Rewind/", true); - backgroundWorker1.RunWorkerAsync(); - conversationtimer.Start(); - hackeffecttimer.Start(); - } - } - } - else - { - backgroundWorker1.RunWorkerAsync(); - conversationtimer.Start(); - hackeffecttimer.Start(); - } - } - - private void TextType(string texttotype) - { - conversationtimer.Stop(); - charcount = texttotype.Length; - gtexttotype = texttotype; - currentletter = 0; - slashcount = 1; - textgen.Start(); - } - - - private void textgen_Tick(object sender, EventArgs e) - { - switch (slashcount) - { - case 1: - if (currentletter < gtexttotype.Length) - { - textgeninput.Text = rtext + "\\"; - } - - break; - case 2: - if (currentletter < gtexttotype.Length) - { - textgeninput.Text = rtext + "|"; - } - - break; - case 3: - if (currentletter < gtexttotype.Length) - { - textgeninput.Text = rtext + "/"; - } - - break; - case 4: - if (currentletter < gtexttotype.Length) - { - rtext = rtext + Regex.Split(gtexttotype, string.Empty)[currentletter]; - currentletter = currentletter + 1; - textgeninput.Text = rtext; - - } - break; - } - - slashcount = slashcount + 1; - - if (slashcount == 5) - slashcount = 1; - if (currentletter == gtexttotype.Length) - { - gtexttotype = ""; - PlaySound(Properties.Resources.typesound); - conversationtimer.Start(); - textgen.Stop(); - } - - - } - - private void conversationtimer_Tick(object sender, EventArgs e) - { - switch (conversationcount) - { - case 0: - if (needtoclose == true) - this.Close(); - break; - case 1: - - textgeninput = lblHijack; - TextType("Your computer is now being Hijacked "); - conversationtimer.Interval = 1000; - - break; - case 3: - textgeninput = lblhackwords; - textgen.Interval = 10; - rtext = ""; - TextType("Congratulations, " + Environment.UserName + "you have been involuntarily selected to be an Alpha Tester for ShiftOS!" + Environment.NewLine + Environment.NewLine); - break; - case 4: - TextType("At this time, I do not wish to reveal any of my intentions and idenity." + Environment.NewLine + Environment.NewLine); - break; - case 5: - TextType("I just need to use you and your computer as an external test bed to evolve my experimental operating system." + Environment.NewLine + Environment.NewLine); - break; - case 6: - TextType("I need to expand the name of ShiftOS, so I'll work on it, and you'll have the chance to use ShiftOS!" + Environment.NewLine + Environment.NewLine); - break; - case 7: - TextType("Your hard drive will now be formatted in preparation for the installation of ShiftOS." + Environment.NewLine + Environment.NewLine); - break; - case 8: - TextType("Starting Format."); - conversationtimer.Interval = 500; - break; - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - TextType("."); - break; - case 19: - rtext = ""; - break; - case 20: - TextType("Scanning Drive C:\\..."); - break; - case 21: - - TextType(Environment.NewLine + Environment.NewLine + "Drive Label: " + cdrive.VolumeLabel); - break; - case 22: - TextType(Environment.NewLine + "Total Drive Size: " + String.Format((cdrive.TotalSize / 1024 / 1024 / 1024).ToString(), "0.00") + "GB. "); - break; - case 23: - TextType(Environment.NewLine + "Old File System: " + cdrive.DriveFormat + ". "); - break; - case 24: - TextType(Environment.NewLine + "New File System: ShiftFS. "); - break; - case 25: - TextType(Environment.NewLine + Environment.NewLine + "Formatting C:\\... - "); - conversationtimer.Interval = 100; - break; - case 26: // TODO: to 126 - textgeninput.Text = rtext + percentcount + "%"; - if (percentcount < 101) - { - percentcount = percentcount + 1; - PlaySound(Main.Properties.Resources.writesound); - } - break; - case 127: - rtext = rtext + "100%"; - conversationtimer.Interval = 1000; - break; - case 128: - TextType(Environment.NewLine + "Format Complete"); - break; - case 129: - rtext = ""; - percentcount = 0; - TextType("Installing ShiftOS Beta 0.0.1 - "); - conversationtimer.Interval = 200; - break; - case 130: // TODO: to 230 - textgeninput.Text = rtext + percentcount + "%" + Environment.NewLine + Environment.NewLine; - if (percentcount < 101) - { - percentcount = percentcount + 1; - PlaySound(Properties.Resources.writesound); - } - switch (percentcount) - { - case 1: - case 2: - textgeninput.Text = textgeninput.Text + "C:/Home"; - if ((!System.IO.Directory.Exists("C:/ShiftOS-Rewind/Home"))) - System.IO.Directory.CreateDirectory("C:/ShiftOS-Rewind/Home"); - break; - case 3: - case 4: - textgeninput.Text = textgeninput.Text + "C:/Home/Documents"; - if ((!System.IO.Directory.Exists("C:/ShiftOS-Rewind/Home/Documents"))) - System.IO.Directory.CreateDirectory("C:/ShiftOS-Rewind/Home/Documents"); - break; - case 5: - case 6: - case 7: - case 8: - case 9: - textgeninput.Text = textgeninput.Text + "C:/Home/Documents/ShiftOSInfo.txt"; - fs = File.Create("C:/ShiftOS-Rewind/Home/Documents/ShiftOSInfo.txt"); - fs.Close(); - break; - case 10: - case 11: - case 12: - textgeninput.Text = textgeninput.Text + "C:/Home/Music"; - if ((!System.IO.Directory.Exists("C:/ShiftOS-Rewind/Home/Music"))) - System.IO.Directory.CreateDirectory("C:/ShiftOS-Rewind/Home/Music"); - break; - case 13: - case 14: - case 15: - textgeninput.Text = textgeninput.Text + "C:/Home/Pictures"; - if ((!System.IO.Directory.Exists("C:/ShiftOS-Rewind/Home/Pictures"))) - System.IO.Directory.CreateDirectory("C:/ShiftOS-Rewind/Home/Pictures"); - break; - case 16: - case 17: - case 18: - textgeninput.Text = textgeninput.Text + "C:/Shiftum42"; - if ((!System.IO.Directory.Exists("C:/ShiftOS-Rewind/Shiftum42"))) - System.IO.Directory.CreateDirectory("C:/ShiftOS-Rewind/Shiftum42"); - break; - case 19: - case 20: - textgeninput.Text = textgeninput.Text + "C:/Shiftum42/Drivers"; - if ((!System.IO.Directory.Exists("C:/ShiftOS-Rewind/Shiftum42/Drivers"))) - System.IO.Directory.CreateDirectory("C:/ShiftOS-Rewind/Shiftum42/Drivers"); - break; - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - textgeninput.Text = textgeninput.Text + "C:/Shiftum42/Drivers/HDD.dri"; - fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/Drivers/HDD.dri"); - fs.Close(); - break; - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - textgeninput.Text = textgeninput.Text + "C:/Shiftum42/Drivers/Keyboard.dri"; - fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/Drivers/Keyboard.dri"); - fs.Close(); - break; - case 36: - case 37: - case 38: - case 39: - case 40: - case 41: - case 42: - case 43: - case 44: - textgeninput.Text = textgeninput.Text + "C:/Shiftum42/Drivers/Monitor.dri"; - fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/Drivers/Monitor.dri"); - fs.Close(); - break; - case 45: - case 46: - case 47: - case 48: - case 49: - case 50: - case 51: - case 52: - textgeninput.Text = textgeninput.Text + "C:/Shiftum42/Drivers/Mouse.dri"; - fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/Drivers/Mouse.dri"); - fs.Close(); - break; - case 53: - case 54: - case 55: - case 56: - case 57: - case 58: - case 59: - case 60: - textgeninput.Text = textgeninput.Text + "C:/Shiftum42/Drivers/Printer.dri"; - fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/Drivers/Printer.dri"); - fs.Close(); - break; - case 61: - case 62: - case 63: - case 64: - case 65: - case 66: - case 67: - case 68: - textgeninput.Text = textgeninput.Text + "C:/Shiftum42/Languages/"; - if ((!System.IO.Directory.Exists("C:/ShiftOS-Rewind/Shiftum42/Languages/"))) - System.IO.Directory.CreateDirectory("C:/ShiftOS-Rewind/Shiftum42/Languages/"); - break; - case 69: - case 70: - case 71: - case 72: - case 73: - case 74: - case 75: - case 76: - textgeninput.Text = textgeninput.Text + "C:/Shiftum42/Languages/English.lang"; - fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/Languages/English.lang"); - fs.Close(); - break; - case 77: - case 78: - case 79: - case 80: - case 81: - case 82: - case 83: - case 84: - textgeninput.Text = textgeninput.Text + "C:/Shiftum42/HDAccess.sft"; - fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/HDAccess.sft"); - fs.Close(); - System.IO.StreamWriter objWriter = new System.IO.StreamWriter("C:/ShiftOS-Rewind/Shiftum42/HDAccess.sft", false); - objWriter.Write(actualshiftversion); - objWriter.Close(); - break; - case 85: - case 86: - case 87: - case 88: - case 89: - textgeninput.Text = textgeninput.Text + "C:/Shiftum42/ShiftGUI.sft"; - fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/ShiftGUI.sft"); - fs.Close(); - break; - case 90: - case 91: - case 92: - case 93: - textgeninput.Text = textgeninput.Text + "C:/Shiftum42/SKernal.sft"; - fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/SKernal.sft"); - fs.Close(); - break; - case 94: - case 95: - case 96: - case 97: - textgeninput.Text = textgeninput.Text + "C:/Shiftum42/SRead.sft"; - fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/SRead.sft"); - fs.Close(); - break; - case 98: - case 99: - case 100: - case 101: - textgeninput.Text = textgeninput.Text + "C:/Shiftum42/SWrite.sft"; - fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/SWrite.sft"); - fs.Close(); - break; - } - - break; - - case 231: - textgeninput.Text = rtext + "100%" + Environment.NewLine + Environment.NewLine + "C:/Shiftum42/SWrite.sft"; - conversationtimer.Interval = 1000; - PlaySound(Properties.Resources.writesound); - break; - case 232: - textgeninput.Text = rtext + "100%" + Environment.NewLine + Environment.NewLine + "ShiftOS Installation Complete!"; - PlaySound(Properties.Resources.typesound); - if ((!System.IO.Directory.Exists("C:/ShiftOS-Rewind/SoftwareData/"))) - System.IO.Directory.CreateDirectory("C:/ShiftOS-Rewind/SoftwareData/"); - if ((!System.IO.Directory.Exists("C:/ShiftOS-Rewind/SoftwareData/KnowledgeInput"))) - System.IO.Directory.CreateDirectory("C:/ShiftOS-Rewind/SoftwareData/KnowledgeInput"); - fs = File.Create("C:/ShiftOS-Rewind/SoftwareData/KnowledgeInput/Animals.lst"); - fs.Close(); - fs = File.Create("C:/ShiftOS-Rewind/SoftwareData/KnowledgeInput/Fruits.lst"); - fs.Close(); - fs = File.Create("C:/ShiftOS-Rewind/SoftwareData/KnowledgeInput/Countries.lst"); - fs.Close(); - break; - case 234: - //ShiftOSDesktop.newgame = true; - //ShiftOSDesktop.Show(); - //Terminal.Show(); - //Terminal.tmrfirstrun.Start(); - //this.Close(); - - break; - } - conversationcount = conversationcount + 1; - } - - private void hackeffecttimer_Tick(object sender, EventArgs e) - { - if (hackeffect < 101) - { - switch (hackeffect) - { - case 1: - case 3: - case 5: - case 7: - case 9: - case 11: - case 13: - case 15: - case 17: - case 19: - case 21: - case 23: - case 25: - case 27: - case 29: - case 31: - case 33: - case 35: - case 37: - case 39: - case 41: - case 43: - case 45: - case 47: - case 49: - case 51: - case 53: - case 55: - case 57: - case 59: - case 61: - case 63: - case 65: - case 67: - case 69: - case 71: - case 73: - case 75: - case 77: - case 79: - case 81: - case 83: - case 85: - case 87: - case 89: - case 91: - case 93: - case 95: - this.BackColor = Color.Black; - PlaySound(Properties.Resources.writesound); - break; - case 2: - case 4: - case 6: - case 8: - case 10: - case 12: - case 14: - case 16: - case 18: - case 20: - case 22: - case 24: - case 26: - case 28: - this.BackColor = Color.White; - PlaySound(Properties.Resources.typesound); - break; - case 30: - case 32: - case 34: - case 36: - case 38: - case 40: - case 42: - case 44: - case 46: - case 48: - case 50: - this.BackColor = Color.Gainsboro; - PlaySound(Properties.Resources.typesound); - break; - case 52: - case 54: - case 56: - case 58: - case 60: - case 62: - case 64: - case 66: - case 68: - case 70: - case 72: - case 74: - case 76: - this.BackColor = Color.Silver; - PlaySound(Properties.Resources.typesound); - break; - case 78: - case 80: - case 82: - case 84: - case 86: - case 88: - case 90: - case 92: - case 94: - this.BackColor = Color.DimGray; - PlaySound(Properties.Resources.typesound); - break; - case 96: - lblHijack.BackColor = Color.LightGray; - break; - case 97: - lblHijack.BackColor = Color.DarkGray; - break; - case 98: - lblHijack.BackColor = Color.DimGray; - break; - case 99: - lblHijack.BackColor = Color.Black; - lblHijack.ForeColor = Color.DimGray; - break; - case 100: - lblHijack.Hide(); - break; - } - } - else - { - hackeffecttimer.Stop(); - } - hackeffect = hackeffect + 1; - } - - } -} - - diff --git a/ShiftOS.Main/HijackScreen.resx b/ShiftOS.Main/HijackScreen.resx deleted file mode 100644 index 84970f0..0000000 --- a/ShiftOS.Main/HijackScreen.resx +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 181, 17 - - - 331, 17 - - - 467, 17 - - \ No newline at end of file diff --git a/ShiftOS.Main/Program.cs b/ShiftOS.Main/Program.cs index 10277b0..99776dc 100644 --- a/ShiftOS.Main/Program.cs +++ b/ShiftOS.Main/Program.cs @@ -2,23 +2,24 @@ using System.Threading.Tasks; using System.Windows.Forms; using ShiftOS.Main.ShiftOS; +using ShiftOS.Main.ShiftOS.Apps; namespace ShiftOS.Main { - static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); Parallel.Invoke( () => Application.Run(new TestForm()), () => Application.Run(new Desktop())); - } - } -} + } + } +} \ No newline at end of file diff --git a/ShiftOS.Main/Properties/AssemblyInfo.cs b/ShiftOS.Main/Properties/AssemblyInfo.cs index 6f85581..bcab0d6 100644 --- a/ShiftOS.Main/Properties/AssemblyInfo.cs +++ b/ShiftOS.Main/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -33,4 +32,4 @@ using System.Runtime.InteropServices; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/ShiftOS.Main/Properties/Settings.settings b/ShiftOS.Main/Properties/Settings.settings index 3964565..e04fc63 100644 --- a/ShiftOS.Main/Properties/Settings.settings +++ b/ShiftOS.Main/Properties/Settings.settings @@ -1,7 +1,8 @@  + - + \ No newline at end of file diff --git a/ShiftOS.Main/Resources/CatalystGrammar.xml b/ShiftOS.Main/Resources/CatalystGrammar.xml index b082a0d..90543d6 100644 --- a/ShiftOS.Main/Resources/CatalystGrammar.xml +++ b/ShiftOS.Main/Resources/CatalystGrammar.xml @@ -1,22 +1,23 @@ - + + - + - + How much Code Points do I have? - Can you run ? - Can you minimize ? - Can you close ? + Can you run ? + Can you minimize ? + Can you close ? diff --git a/ShiftOS.Main/ShiftOS.Main.csproj b/ShiftOS.Main/ShiftOS.Main.csproj index 93ece0f..7db2449 100644 --- a/ShiftOS.Main/ShiftOS.Main.csproj +++ b/ShiftOS.Main/ShiftOS.Main.csproj @@ -47,12 +47,6 @@ - - Form - - - HijackScreen.cs - @@ -97,9 +91,6 @@ Desktop.cs - - HijackScreen.cs - ResXFileCodeGenerator Resources.Designer.cs diff --git a/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs b/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs index 7fd37f0..f8ee8e3 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs @@ -1,4 +1,4 @@ -namespace ShiftOS.Main +namespace ShiftOS.Main.ShiftOS.Apps { partial class ShiftDemo { diff --git a/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.cs b/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.cs index 11fc160..ced10d2 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.cs @@ -1,26 +1,18 @@ -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.Windows.Forms; using ShiftOS.Engine.WindowManager; -namespace ShiftOS.Main +namespace ShiftOS.Main.ShiftOS.Apps { - public partial class ShiftDemo : UserControl, IShiftWindowExtensions - { - public ShiftDemo() - { - InitializeComponent(); - } + public partial class ShiftDemo : UserControl, IShiftWindowExtensions + { + public ShiftDemo() + { + InitializeComponent(); + } - public void OnLoaded(ShiftWindow window) - { - icon.Image = this.GetShiftWindow().Icon.ToBitmap(); - } + public void OnLoaded(ShiftWindow window) + { + icon.Image = this.GetShiftWindow().Icon.ToBitmap(); + } } -} +} \ No newline at end of file diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.Designer.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.Designer.cs index a7473a0..5d50bc0 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.Designer.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.Designer.cs @@ -1,4 +1,4 @@ -namespace ShiftOS.Main.ShiftOS.Apps +namespace ShiftOS.Main.ShiftOS.Apps.ShifterStuff { partial class SelectColor { diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs index f26fe4d..543529a 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs @@ -1,50 +1,54 @@ using System; using System.Drawing; +using System.Globalization; using System.Windows.Forms; using ShiftOS.Engine.WindowManager; -namespace ShiftOS.Main.ShiftOS.Apps +namespace ShiftOS.Main.ShiftOS.Apps.ShifterStuff { - public partial class SelectColor : UserControl - { - Color _finalColor; - int _colorType1; - int _colorType2; - int _colorType3; - public SelectColor() - { - InitializeComponent(); - - } - - private Color setColor() - { - _colorType1 = Int32.Parse(redUpDown.Value.ToString()); - _colorType2 = Int32.Parse(greenUpDown.Value.ToString()); - _colorType3 = Int32.Parse(blueUpDown.Value.ToString()); - try - { - _finalColor = Color.FromArgb(_colorType1, _colorType2, _colorType3); - - - foreach (var window in ShiftWM.Windows) -{ - window.Invoke(new Action(() => window.titleBar.BackColor = _finalColor)); - } - - - ShiftWM.StartInfoboxSession("Success!", $"Changed color to:\r\n{_colorType1}, {_colorType2}, {_colorType3}.", InfoboxTemplate.ButtonType.Ok); - } - catch (Exception) - { - ShiftWM.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.ButtonType.Ok); - } - return _finalColor; - } - - private void btnSetColor_Click(object sender, EventArgs e) - { - setColor(); - } - } -} + public partial class SelectColor : UserControl + { + int _colorType1; + int _colorType2; + int _colorType3; + Color _finalColor; + + public SelectColor() + { + InitializeComponent(); + } + + Color SetColor() + { + _colorType1 = int.Parse(redUpDown.Value.ToString(CultureInfo.InvariantCulture)); + _colorType2 = int.Parse(greenUpDown.Value.ToString(CultureInfo.InvariantCulture)); + _colorType3 = int.Parse(blueUpDown.Value.ToString(CultureInfo.InvariantCulture)); + try + { + _finalColor = Color.FromArgb(_colorType1, _colorType2, _colorType3); + + + foreach (var window in ShiftWm.Windows) + { + window.Invoke(new Action(() => window.titleBar.BackColor = _finalColor)); + } + + + ShiftWm.StartInfoboxSession( + "Success!", + $"Changed color to:\r\n{_colorType1}, {_colorType2}, {_colorType3}.", + InfoboxTemplate.ButtonType.Ok); + } + catch (Exception) + { + ShiftWm.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.ButtonType.Ok); + } + return _finalColor; + } + + void btnSetColor_Click(object sender, EventArgs e) + { + SetColor(); + } + } +} \ No newline at end of file diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs index ac81a5c..2ed43b4 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs @@ -1,4 +1,4 @@ -namespace ShiftOS.Main.ShiftOS.Apps +namespace ShiftOS.Main.ShiftOS.Apps.ShifterStuff { partial class Shifter { @@ -94,7 +94,7 @@ this.button4.TabIndex = 4; this.button4.Text = "Set Random Skin"; this.button4.UseVisualStyleBackColor = true; - this.button4.Click += new System.EventHandler(this.setRandomSkin); + this.button4.Click += new System.EventHandler(this.SetRandomSkin); // // button3 // @@ -106,7 +106,7 @@ this.button3.TabIndex = 3; this.button3.Text = "Set Default Skin"; this.button3.UseVisualStyleBackColor = true; - this.button3.Click += new System.EventHandler(this.setDefaultSkin); + this.button3.Click += new System.EventHandler(this.SetDefaultSkin); // // button2 // @@ -118,7 +118,7 @@ this.button2.TabIndex = 2; this.button2.Text = "Set Colorful Skin"; this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.setColorSkin); + this.button2.Click += new System.EventHandler(this.SetColorSkin); // // groupBox1 // diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs index 609b617..f7c9752 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs @@ -1,113 +1,116 @@ using System; -using System.Windows.Forms; -using ShiftOS.Engine; -using ShiftOS.Engine.WindowManager; using System.Drawing; using System.IO; +using System.Windows.Forms; using Newtonsoft.Json; +using ShiftOS.Engine.Misc; +using ShiftOS.Engine.WindowManager; +using ShiftOS.Main.Properties; -namespace ShiftOS.Main.ShiftOS.Apps +namespace ShiftOS.Main.ShiftOS.Apps.ShifterStuff { - public partial class Shifter : UserControl - { - public int colorType; //This is a check to see what option was chosen. - public Shifter() - { - InitializeComponent(); - } + public partial class Shifter : UserControl + { + public int ColorType; //This is a check to see what option was chosen. - private void button1_Click(object sender, EventArgs e) - { - colorType = 1; - ShiftWM.Init(new SelectColor(), "Select a color", Properties.Resources.iconColourPicker_fw.ToIcon()); - } + public Shifter() + { + InitializeComponent(); + } - private void setDefaultSkin(object sender, EventArgs e) - { - setBorderColor(Color.FromArgb(64, 64, 64)); - ShiftSkinData.btnCloseColor = Color.Black; - ShiftSkinData.btnMaxColor = Color.Black; - ShiftSkinData.btnMinColor = Color.Black; - button5_Click(sender, e); - } + void button1_Click(object sender, EventArgs e) + { + ColorType = 1; + ShiftWm.Init(new SelectColor(), "Select a color", Resources.iconColourPicker_fw.ToIcon()); + } - private void setColorSkin(object sender, EventArgs e) - { - setBorderColor(Color.Blue); - ShiftSkinData.btnCloseColor = Color.Red; - ShiftSkinData.btnMaxColor = Color.Yellow; - ShiftSkinData.btnMinColor = Color.Green; - ShiftSkinData.btnCloseHoverColor = Color.FromArgb(255, 102, 102); - ShiftSkinData.btnMaxHoverColor = Color.FromArgb(255, 255, 153); - ShiftSkinData.btnMinColor = Color.FromArgb(102, 255, 102); - button5_Click(sender, e); - } + void SetDefaultSkin(object sender, EventArgs e) + { + SetBorderColor(Color.FromArgb(64, 64, 64)); + ShiftSkinData.BtnCloseColor = Color.Black; + ShiftSkinData.BtnMaxColor = Color.Black; + ShiftSkinData.BtnMinColor = Color.Black; + button5_Click(sender, e); + } - private void setRandomSkin(object sender, EventArgs e) - { - Random rnd = new Random(); - setBorderColor(Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255))); - ShiftSkinData.btnCloseColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); - ShiftSkinData.btnMaxColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); - ShiftSkinData.btnMinColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); - ShiftSkinData.btnCloseHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); - ShiftSkinData.btnMaxHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); - ShiftSkinData.btnMinHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); - button5_Click(sender, e); - } + void SetColorSkin(object sender, EventArgs e) + { + SetBorderColor(Color.Blue); + ShiftSkinData.BtnCloseColor = Color.Red; + ShiftSkinData.BtnMaxColor = Color.Yellow; + ShiftSkinData.BtnMinColor = Color.Green; + ShiftSkinData.BtnCloseHoverColor = Color.FromArgb(255, 102, 102); + ShiftSkinData.BtnMaxHoverColor = Color.FromArgb(255, 255, 153); + ShiftSkinData.BtnMinColor = Color.FromArgb(102, 255, 102); + button5_Click(sender, e); + } - // SetBorderColor - public void setBorderColor(Color borderColor) - { - ShiftSkinData.leftTopCornerColor = borderColor; - ShiftSkinData.titleBarColor = borderColor; - ShiftSkinData.rightTopCornerColor = borderColor; - ShiftSkinData.leftSideColor = borderColor; - ShiftSkinData.rightSideColor = borderColor; - ShiftSkinData.leftBottomCornerColor = borderColor; - ShiftSkinData.bottomSideColor = borderColor; - ShiftSkinData.rightBottomCornerColor = borderColor; - } + void SetRandomSkin(object sender, EventArgs e) + { + var rnd = new Random(); + SetBorderColor(Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255))); + ShiftSkinData.BtnCloseColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); + ShiftSkinData.BtnMaxColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); + ShiftSkinData.BtnMinColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); + ShiftSkinData.BtnCloseHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); + ShiftSkinData.BtnMaxHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); + ShiftSkinData.BtnMinHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)); + button5_Click(sender, e); + } - private void button5_Click(object sender, EventArgs e) - { + // SetBorderColor + public void SetBorderColor(Color borderColor) + { + ShiftSkinData.LeftTopCornerColor = borderColor; + ShiftSkinData.TitleBarColor = borderColor; + ShiftSkinData.RightTopCornerColor = borderColor; + ShiftSkinData.LeftSideColor = borderColor; + ShiftSkinData.RightSideColor = borderColor; + ShiftSkinData.LeftBottomCornerColor = borderColor; + ShiftSkinData.BottomSideColor = borderColor; + ShiftSkinData.RightBottomCornerColor = borderColor; + } - foreach (var window in ShiftWM.Windows) - { - window.Invoke(new Action(() => window.titleBar.BackColor = ShiftSkinData.titleBarColor)); - window.Invoke(new Action(() => window.leftTopCorner.BackColor = ShiftSkinData.leftTopCornerColor)); - window.Invoke(new Action(() => window.rightTopCorner.BackColor = ShiftSkinData.rightTopCornerColor)); - window.Invoke(new Action(() => window.leftSide.BackColor = ShiftSkinData.leftSideColor)); - window.Invoke(new Action(() => window.rightSide.BackColor = ShiftSkinData.rightSideColor)); - window.Invoke(new Action(() => window.leftBottomCorner.BackColor = ShiftSkinData.leftBottomCornerColor)); - window.Invoke(new Action(() => window.bottomSide.BackColor = ShiftSkinData.bottomSideColor)); - window.Invoke(new Action(() => window.rightBottomCorner.BackColor = ShiftSkinData.rightBottomCornerColor)); - window.Invoke(new Action(() => window.btnClose.BackColor = ShiftSkinData.btnCloseColor)); - window.Invoke(new Action(() => window.btnMax.BackColor = ShiftSkinData.btnMaxColor)); - window.Invoke(new Action(() => window.btnMin.BackColor = ShiftSkinData.btnMinColor)); - - } - } + void button5_Click(object sender, EventArgs e) + { + foreach (var window in ShiftWm.Windows) + { + window.Invoke(new Action(() => window.titleBar.BackColor = ShiftSkinData.TitleBarColor)); + window.Invoke(new Action(() => window.leftTopCorner.BackColor = ShiftSkinData.LeftTopCornerColor)); + window.Invoke(new Action(() => window.rightTopCorner.BackColor = ShiftSkinData.RightTopCornerColor)); + window.Invoke(new Action(() => window.leftSide.BackColor = ShiftSkinData.LeftSideColor)); + window.Invoke(new Action(() => window.rightSide.BackColor = ShiftSkinData.RightSideColor)); + window.Invoke(new Action(() => window.leftBottomCorner.BackColor = ShiftSkinData.LeftBottomCornerColor)); + window.Invoke(new Action(() => window.bottomSide.BackColor = ShiftSkinData.BottomSideColor)); + window.Invoke(new Action(() => window.rightBottomCorner.BackColor = ShiftSkinData.RightBottomCornerColor)); + window.Invoke(new Action(() => window.btnClose.BackColor = ShiftSkinData.BtnCloseColor)); + window.Invoke(new Action(() => window.btnMax.BackColor = ShiftSkinData.BtnMaxColor)); + window.Invoke(new Action(() => window.btnMin.BackColor = ShiftSkinData.BtnMinColor)); + } + } - private void btnSave_Click(object sender, EventArgs e) - { - Color[] shiftColors = new Color[14]; - shiftColors[0] = ShiftSkinData.leftTopCornerColor; - shiftColors[1] = ShiftSkinData.titleBarColor; - shiftColors[2] = ShiftSkinData.rightTopCornerColor; - shiftColors[3] = ShiftSkinData.leftSideColor; - shiftColors[4] = ShiftSkinData.rightSideColor; - shiftColors[5] = ShiftSkinData.leftBottomCornerColor; - shiftColors[6] = ShiftSkinData.bottomSideColor; - shiftColors[7] = ShiftSkinData.rightBottomCornerColor; - shiftColors[8] = ShiftSkinData.btnCloseColor; - shiftColors[9] = ShiftSkinData.btnMaxColor; - shiftColors[10] = ShiftSkinData.btnMinColor; - shiftColors[11] = ShiftSkinData.btnCloseHoverColor; - shiftColors[12] = ShiftSkinData.btnMaxHoverColor; - shiftColors[13] = ShiftSkinData.btnMinHoverColor; - File.WriteAllText(@"C:\Users\Public\Documents\Skin.json", JsonConvert.SerializeObject(shiftColors)); - ShiftWM.StartInfoboxSession("Saved Skin", "Saved Skin to C:\\Users\\Public\\Documents\\Skin.json", InfoboxTemplate.ButtonType.Ok); - } - } -} + void btnSave_Click(object sender, EventArgs e) + { + var shiftColors = new Color[14]; + shiftColors[0] = ShiftSkinData.LeftTopCornerColor; + shiftColors[1] = ShiftSkinData.TitleBarColor; + shiftColors[2] = ShiftSkinData.RightTopCornerColor; + shiftColors[3] = ShiftSkinData.LeftSideColor; + shiftColors[4] = ShiftSkinData.RightSideColor; + shiftColors[5] = ShiftSkinData.LeftBottomCornerColor; + shiftColors[6] = ShiftSkinData.BottomSideColor; + shiftColors[7] = ShiftSkinData.RightBottomCornerColor; + shiftColors[8] = ShiftSkinData.BtnCloseColor; + shiftColors[9] = ShiftSkinData.BtnMaxColor; + shiftColors[10] = ShiftSkinData.BtnMinColor; + shiftColors[11] = ShiftSkinData.BtnCloseHoverColor; + shiftColors[12] = ShiftSkinData.BtnMaxHoverColor; + shiftColors[13] = ShiftSkinData.BtnMinHoverColor; + File.WriteAllText(@"C:\Users\Public\Documents\Skin.json", JsonConvert.SerializeObject(shiftColors)); + ShiftWm.StartInfoboxSession( + "Saved Skin", + "Saved Skin to C:\\Users\\Public\\Documents\\Skin.json", + InfoboxTemplate.ButtonType.Ok); + } + } +} \ No newline at end of file diff --git a/ShiftOS.Main/ShiftOS/Apps/Terminal.cs b/ShiftOS.Main/ShiftOS/Apps/Terminal.cs index a9bd093..4c11136 100644 --- a/ShiftOS.Main/ShiftOS/Apps/Terminal.cs +++ b/ShiftOS.Main/ShiftOS/Apps/Terminal.cs @@ -1,95 +1,80 @@ 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 ShiftOS.Engine; using ShiftOS.Engine.Terminal; namespace ShiftOS.Main.ShiftOS.Apps { - public partial class Terminal : UserControl - { - public string defaulttextBefore = "user> "; - public string defaulttextResult = "user@shiftos> "; // NOT YET IMPLEMENTED!!! - public bool doClear = false; + public partial class Terminal : UserControl + { + public string DefaulttextBefore = "user> "; + string DefaulttextResult = "user@shiftos> "; // NOT YET IMPLEMENTED!!! + bool DoClear = false; - // The below variables makes the terminal... a terminal! - public string OldText = ""; - public int TrackingPosition = 0; + // The below variables makes the terminal... a terminal! + string OldText = ""; - public Terminal() - { - InitializeComponent(); + int TrackingPosition; - termmain.ContextMenuStrip = new ContextMenuStrip(); // Disables the right click of a richtextbox! - } + public Terminal() + { + InitializeComponent(); - public void Print(string text) - { - termmain.AppendText($"\n {text} \n {defaulttextResult}"); - TrackingPosition = termmain.Text.Length; - } + termmain.ContextMenuStrip = new ContextMenuStrip(); // Disables the right click of a richtextbox! + } - private void termmain_KeyDown(object sender, KeyEventArgs e) - { - // The below code disables the ability to paste anything other then text... + 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) { - Print(TerminalBackend.RunCommand(termmain.Text.Substring(TrackingPosition, termmain.Text.Length - TrackingPosition))); // The most horrific line in the entire application! - e.Handled = true; - } - } + void termmain_KeyDown(object sender, KeyEventArgs e) + { + // The below code disables the ability to paste anything other then text... - private void termmain_TextChanged(object sender, EventArgs e) - { - if (termmain.SelectionStart < TrackingPosition) - { - if (doClear == false) // If it's not clearing the terminal - { - termmain.Text = OldText; - termmain.Select(termmain.Text.Length, 0); - } - } - else - { - OldText = termmain.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) + { + Print( + TerminalBackend.RunCommand( + termmain.Text.Substring( + TrackingPosition, + termmain.Text.Length - TrackingPosition))); // The most horrific line in the entire application! + e.Handled = true; + } + } - private void termmain_SelectionChanged(object sender, EventArgs e) - { - if (termmain.SelectionStart < TrackingPosition) - { - termmain.Text = OldText; - termmain.Select(termmain.Text.Length, 0); - } - } + void termmain_TextChanged(object sender, EventArgs e) + { + if (termmain.SelectionStart < TrackingPosition) + { + if (DoClear) return; + + termmain.Text = OldText; + termmain.Select(termmain.Text.Length, 0); + } + else + { + OldText = termmain.Text; + } + } - private void Terminal_Load(object sender, EventArgs e) - { - Print("\n"); - } + void termmain_SelectionChanged(object sender, EventArgs e) + { + if (termmain.SelectionStart >= TrackingPosition) return; + + termmain.Text = OldText; + termmain.Select(termmain.Text.Length, 0); + } - public string RunCommand(string command) - { - string ToReturn = ""; - - if (command == "hi") - { - ToReturn = $"{ToReturn} \n Hi!"; - MessageBox.Show("HI!"); - } - return ToReturn; - } - } -} + void Terminal_Load(object sender, EventArgs e) + { + Print("\n"); + } + } +} \ No newline at end of file diff --git a/ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs b/ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs index 50bcb58..b49924e 100644 --- a/ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs +++ b/ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs @@ -1,4 +1,4 @@ -namespace ShiftOS.Main +namespace ShiftOS.Main.ShiftOS.Apps { partial class TestForm { diff --git a/ShiftOS.Main/ShiftOS/Apps/TestForm.cs b/ShiftOS.Main/ShiftOS/Apps/TestForm.cs index 389f8d1..5929a66 100644 --- a/ShiftOS.Main/ShiftOS/Apps/TestForm.cs +++ b/ShiftOS.Main/ShiftOS/Apps/TestForm.cs @@ -1,28 +1,27 @@ using System; -using System.Drawing; -using System.Linq; using System.Windows.Forms; -using ShiftOS.Engine; +using ShiftOS.Engine.Misc; using ShiftOS.Engine.WindowManager; -using ShiftOS.Main.ShiftOS.Apps; +using ShiftOS.Main.Properties; +using ShiftOS.Main.ShiftOS.Apps.ShifterStuff; -namespace ShiftOS.Main +namespace ShiftOS.Main.ShiftOS.Apps { - public partial class TestForm : Form - { - public TestForm() - { - InitializeComponent(); - } + public partial class TestForm : Form + { + public TestForm() + { + InitializeComponent(); + } - private void Button1_Click(object sender, EventArgs e) - { - ShiftDemo demo = new ShiftDemo(); - ShiftWM.Init(demo, textBox1.Text, null); - ShiftWM.StartInfoboxSession(textBox1.Text, textBox2.Text, InfoboxTemplate.ButtonType.Ok); - } + void Button1_Click(object sender, EventArgs e) + { + var demo = new ShiftDemo(); + ShiftWm.Init(demo, textBox1.Text, null); + ShiftWm.StartInfoboxSession(textBox1.Text, textBox2.Text, InfoboxTemplate.ButtonType.Ok); + } - private void button2_Click(object sender, EventArgs e) - => ShiftWM.Init(new Shifter(), "Shifter", Properties.Resources.iconShifter.ToIcon()); - } -} + void button2_Click(object sender, EventArgs e) + => ShiftWm.Init(new Shifter(), "Shifter", Resources.iconShifter.ToIcon()); + } +} \ No newline at end of file diff --git a/ShiftOS.Main/ShiftOS/Apps/TextPad.cs b/ShiftOS.Main/ShiftOS/Apps/TextPad.cs index 6c091df..e86b1be 100644 --- a/ShiftOS.Main/ShiftOS/Apps/TextPad.cs +++ b/ShiftOS.Main/ShiftOS/Apps/TextPad.cs @@ -1,54 +1,36 @@ 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.IO; -using ShiftOS.Engine; +using System.Windows.Forms; namespace ShiftOS.Main.ShiftOS.Apps { - public partial class TextPad : UserControl - { - string editedText; - public TextPad() - { - InitializeComponent(); - editedText = textBox.Text; - } - private bool isEdited(string editedString) - { - editedString = editedText; - if(editedString != textBox.Text) - { - return true; - } - else - { - return false; - } - } + public partial class TextPad : UserControl + { + readonly string _editedText; + + public TextPad() + { + InitializeComponent(); + _editedText = textBox.Text; + } + + bool IsEdited() => _editedText != textBox.Text; - private void openToolStripMenuItem_Click(object sender, EventArgs e) - { - if (openFileDialog1.ShowDialog() == DialogResult.OK) - { - var sr = new StreamReader(openFileDialog1.FileName); - textBox.Text = sr.ReadToEnd(); - sr.Close(); - } - } + void openToolStripMenuItem_Click(object sender, EventArgs e) + { + if (openFileDialog1.ShowDialog() != DialogResult.OK) return; + + var sr = new StreamReader(openFileDialog1.FileName); + textBox.Text = sr.ReadToEnd(); + sr.Close(); + } - private void newToolStripMenuItem_Click(object sender, EventArgs e) - { - if (isEdited(textBox.Text)) - { - MessageBox.Show("yay it works"); - } - } - } -} + void newToolStripMenuItem_Click(object sender, EventArgs e) + { + if (IsEdited()) + { + MessageBox.Show("yay it works"); + } + } + } +} \ No newline at end of file diff --git a/ShiftOS.Main/ShiftOS/Desktop.cs b/ShiftOS.Main/ShiftOS/Desktop.cs index 66392a7..9bfcb0f 100644 --- a/ShiftOS.Main/ShiftOS/Desktop.cs +++ b/ShiftOS.Main/ShiftOS/Desktop.cs @@ -1,14 +1,10 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; +using ShiftOS.Engine.Misc; using ShiftOS.Engine.WindowManager; -using ShiftOS.Engine; +using ShiftOS.Main.Properties; +using ShiftOS.Main.ShiftOS.Apps; namespace ShiftOS.Main.ShiftOS { @@ -20,56 +16,64 @@ namespace ShiftOS.Main.ShiftOS timer1.Start(); - this.Closed += (sender, args) => - { - Application.Exit(); - }; + Closed += (sender, args) => { Application.Exit(); }; #region Disgusting taskbar code - ShiftWM.Windows.CollectionChanged += (sender, args) => + ShiftWm.Windows.CollectionChanged += (sender, args) => { - args.NewItems?.OfType().ToList().ForEach(window => - { - taskbar.Invoke(new Action(() => - { - taskbar.Items.Add(new ToolStripButton - { - Text = window.Title.Text, - Image = window.Icon.ToBitmap(), - Tag = window.Id - }); - })); - }); - - args.OldItems?.OfType().ToList().ForEach(window => - { - taskbar.Invoke(new Action(() => - { - var tbRemovalList = taskbar.Items.OfType().Where(i => (uint) i.Tag == window.Id); + args.NewItems?.OfType() + .ToList() + .ForEach( + window => + { + taskbar.Invoke( + new Action( + () => + { + taskbar.Items.Add( + new ToolStripButton + { + Text = window.Title.Text, + Image = window.Icon.ToBitmap(), + Tag = window.Id + }); + })); + }); - tbRemovalList.ToList().ForEach(p => taskbar.Items.Remove(p)); - })); - }); + args.OldItems?.OfType() + .ToList() + .ForEach( + window => + { + taskbar.Invoke( + new Action( + () => + { + var tbRemovalList = taskbar.Items.OfType().Where(i => (uint) i.Tag == window.Id); + + tbRemovalList.ToList().ForEach(p => taskbar.Items.Remove(p)); + })); + }); }; #endregion } - private void timer1_Tick(object sender, EventArgs e) => + void timer1_Tick(object sender, EventArgs e) => taskbarClock.Text = $"{DateTime.Now:t}"; - private void terminalToolStripMenuItem_Click(object sender, EventArgs e) - { - Apps.Terminal trm = new Apps.Terminal(); + void terminalToolStripMenuItem_Click(object sender, EventArgs e) + { + var trm = new Terminal(); - ShiftWM.Init(trm, "Terminal", null, false, true); - } + ShiftWm.Init(trm, "Terminal", null); + } - private void textPadToolStripMenuItem_Click(object sender, EventArgs e) - { - var tp = new Apps.TextPad(); - ShiftWM.Init(tp, "TextPad", Properties.Resources.iconTextPad.ToIcon()); - } - } -} + void textPadToolStripMenuItem_Click(object sender, EventArgs e) + { + var tp = new TextPad(); + ShiftWm.Init(tp, "TextPad", Resources.iconTextPad.ToIcon()); + } + } +} \ No newline at end of file diff --git a/ShiftOS.Main/packages.config b/ShiftOS.Main/packages.config index ee51c23..a96650b 100644 --- a/ShiftOS.Main/packages.config +++ b/ShiftOS.Main/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file -- cgit v1.2.3