From bbb3f3379d6378ad17aff8a7b81b514e23900fe4 Mon Sep 17 00:00:00 2001 From: MrDumbrava <109512837+9xbt@users.noreply.github.com> Date: Sat, 4 Nov 2023 16:11:09 +0100 Subject: [PATCH 1/2] Stuff --- GoOS/9xCode/Interpreter.cs | 105 ++++++++++++++++++++++----- GoOS/GUI/Apps/GoIDE/ProjectsFrame.cs | 53 ++++++++------ GoOS/GUI/Apps/GoIDE/WelcomeFrame.cs | 52 +++++++++++++ GoOS/GUI/Apps/Paintbrush.cs | 55 ++++++++++---- GoOS/GUI/Apps/TaskManager.cs | 4 +- GoOS/GUI/Dialogue.cs | 2 +- GoOS/GUI/Window.cs | 21 ++++++ GoOS/GUI/WindowManager.cs | 10 +++ GoOS/GoOS.csproj | 83 +-------------------- GoOS/Kernel.cs | 14 ++-- GoOS/OOBE.cs | 37 ++++------ 11 files changed, 270 insertions(+), 166 deletions(-) create mode 100644 GoOS/GUI/Apps/GoIDE/WelcomeFrame.cs diff --git a/GoOS/9xCode/Interpreter.cs b/GoOS/9xCode/Interpreter.cs index f441bc957f..87ffd64406 100644 --- a/GoOS/9xCode/Interpreter.cs +++ b/GoOS/9xCode/Interpreter.cs @@ -9,7 +9,7 @@ using Console = BetterConsole; using ConsoleColor = PrismAPI.Graphics.Color; -// 9xCode Beta 3.0 +// 9xCode Beta 3.1 // Licensed under the MIT license // Use permitted in GoOS @@ -36,10 +36,10 @@ private static void Interpret(string[] code) Interpreting = true; Console.ForegroundColor = Cyan; - Console.WriteLine("Mobren 9xCode Interpreter Version b3.0\n"); + Console.WriteLine("Mobren 9xCode Interpreter Version b3.1\n"); Console.ForegroundColor = White; - bool SysLib = false, ConsoleLib = false, IOLib = false, TimeLib = false, _9xGLLib = false; + bool SysLib = false, ConsoleLib = false, IOLib = false, TimeLib = false, _9xGLLib = false, GoOSLib = false; Dictionary Booleans = new Dictionary() { }; Dictionary Integers = new Dictionary() { }; @@ -173,6 +173,12 @@ private static void Interpret(string[] code) continue; } + else if (sub.StartsWith("GoOS")) + { + GoOSLib = true; + continue; + } + else { HandleError("Error", "Unknown library."); @@ -503,20 +509,20 @@ private static void Interpret(string[] code) Window wnd = new Window(); ushort width, height; - if (args2[0].Contains('"')) + if (args2[0].Trim().Contains('"')) wnd.Title = args2[0].Substring(1, args2[0].Length - 2); - else if (Strings.TryGetValue(args2[0], out string strval)) + else if (Strings.TryGetValue(args2[0].Trim(), out string strval)) wnd.Title = strval; - if (Integers.TryGetValue(args2[1], out int widthval)) + if (Integers.TryGetValue(args2[1].Trim(), out int widthval)) width = Convert.ToUInt16(widthval); else - width = Convert.ToUInt16(args2[1]); + width = Convert.ToUInt16(args2[1].Trim()); - if (Integers.TryGetValue(args2[2], out int heightval)) + if (Integers.TryGetValue(args2[2].Trim(), out int heightval)) height = Convert.ToUInt16(heightval); else - height = Convert.ToUInt16(args2[2]); + height = Convert.ToUInt16(args2[2].Trim()); wnd.Contents = new Canvas(width, height); wnd.Visible = true; @@ -576,7 +582,7 @@ private static void Interpret(string[] code) else if (Strings.TryGetValue(comparation[0].Trim(), out string strval)) { comparation[1] = comparation[1].Substring(comparation[1].IndexOf('"') + 1, comparation[1].LastIndexOf('"') - 2); - if (comparation[1] != strval) + if (comparation[1] != strval) { i = endif + 1; } @@ -795,12 +801,12 @@ private static void Interpret(string[] code) { string[] args = line.Split('>')[2].Trim().Split(','); - if (args.Length < 4) + if (args.Length < 5) { HandleError("Error", "Argument underflow."); break; } - if (args.Length > 4) + if (args.Length > 5) { HandleError("Error", "Argument overflow."); break; @@ -812,9 +818,9 @@ private static void Interpret(string[] code) break; } - if (!Strings.TryGetValue(args[1], out string strval)) + if (!Strings.TryGetValue(args[1].Trim(), out string strval)) { - if (args[1].Contains('"')) + if (args[1].Trim().Contains('"')) { strval = args[1].Trim().Substring(1, args[1].Length - 3); } @@ -825,17 +831,29 @@ private static void Interpret(string[] code) } } - if (!Integers.TryGetValue(args[2], out int xval)) + if (!Integers.TryGetValue(args[2].Trim(), out int xval)) { xval = Convert.ToInt32(args[2].Trim()); } - if (!Integers.TryGetValue(args[3], out int yval)) + if (!Integers.TryGetValue(args[3].Trim(), out int yval)) { yval = Convert.ToInt32(args[3].Trim()); } - wndval.Contents.DrawString(xval, yval, strval, Fonts.Font_1x, Color.Black); + if (!Colors.TryGetValue(args[4].Trim(), out Color colval)) + { + if (StringToConsoleColor.TryGetValue(args[4].Trim(), out Color colval2)) + { + colval = colval2; + } + else + { + HandleError("Syntax Error", "Unknown Color."); + } + } + + wndval.Contents.DrawString(xval, yval, strval, Fonts.Font_1x, colval); } else if (_9xGLLib && line.StartsWith("SetWindowPos") && line.Contains(">>")) @@ -883,6 +901,54 @@ private static void Interpret(string[] code) #endregion + #region GoOS Library + + else if (GoOSLib && line.StartsWith("EnableKillingSystemTasks")) + { + GUI.Apps.TaskManager.pko = true; + } + + else if (GoOSLib && line.StartsWith("DisableKillingSystemTasks")) + { + GUI.Apps.TaskManager.pko = false; + } + + else if (GoOSLib && line.StartsWith("RegProg") && line.Contains(">>")) + { + string[] args = line.Split('>')[2].Trim().Split(','); + + if (args.Length < 1) + { + HandleError("Error", "Argument underflow."); + break; + } + if (args.Length > 1) + { + HandleError("Error", "Argument overflow."); + break; + } + + if (!Strings.TryGetValue(args[0].Trim(), out string strval)) + { + if (args[0].Trim().Contains('"')) + { + strval = args[0].Trim().Substring(1, args[0].Length - 3); + } + else + { + HandleError("Error", "Unknown variable."); + break; + } + } + + if (!Directory.Exists(@"0:\content\prf\" + strval + @"\")) + { + Directory.CreateDirectory(@"0:\content\prf\" + strval + @"\"); + } + } + + #endregion + else { HandleError("Syntax Error", "Unknown function.\nMaybe try importing a library?"); @@ -894,6 +960,11 @@ private static void Interpret(string[] code) } } } + + while (WindowManager.ContainsAWindow(new List(Windows.Values))) + { + WindowManager.Update(); + } } private static void HandleError(string Title, string Message) diff --git a/GoOS/GUI/Apps/GoIDE/ProjectsFrame.cs b/GoOS/GUI/Apps/GoIDE/ProjectsFrame.cs index e576857e81..6779fd48af 100644 --- a/GoOS/GUI/Apps/GoIDE/ProjectsFrame.cs +++ b/GoOS/GUI/Apps/GoIDE/ProjectsFrame.cs @@ -1,9 +1,5 @@ using System; using System.IO; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using PrismAPI.Graphics; namespace GoOS.GUI.Apps.GoIDE @@ -11,6 +7,7 @@ namespace GoOS.GUI.Apps.GoIDE public class ProjectsFrame : Window { Button[] RecentProjectsButtons; + Button DeleteButton; Button ImportButton; Button LoadExistingButton; Button CreateNewButton; @@ -20,10 +17,11 @@ public ProjectsFrame() try { // Create the directories. - if (!Directory.Exists(@"0:\content\prf")) Directory.CreateDirectory(@"0:\content\prf"); - if (!Directory.Exists(@"0:\content\prf\GoIDE")) Directory.CreateDirectory(@"0:\content\prf\GoIDE"); - if (!Directory.Exists(@"0:\content\prf\GoIDE\Projects")) Directory.CreateDirectory(@"0:\content\prf\GoIDE\Projects"); - if (!Directory.Exists(@"0:\content\prf\GoIDE\SaveData")) Directory.CreateDirectory(@"0:\content\prf\GoIDE\SaveData"); + if (!Directory.Exists(@"0:\content\prf\GoIDE") || !Directory.Exists(@"0:\content\prf\GoIDE\Projects") || !Directory.Exists(@"0:\content\prf\GoIDE\SaveData")) + { + WindowManager.AddWindow(new WelcomeFrame()); + Dispose(); return; + } // Generate the fonts. Fonts.Generate(); @@ -53,9 +51,10 @@ public ProjectsFrame() }; } - ImportButton = new Button(this, Convert.ToUInt16(Contents.Width - 382), Convert.ToUInt16(Contents.Height - 30), 88, 20, "Import...") { Clicked = ImportButton_Click }; - LoadExistingButton = new Button(this, Convert.ToUInt16(Contents.Width - 284), Convert.ToUInt16(Contents.Height - 30), 144, 20, "Load existing...") { Clicked = LoadExistingButton_Click }; - CreateNewButton = new Button(this, Convert.ToUInt16(Contents.Width - 130), Convert.ToUInt16(Contents.Height - 30), 120, 20, "Create new...") { Clicked = CreateNewButton_Click }; + DeleteButton = new Button(this, Convert.ToUInt16(Contents.Width - 380), Convert.ToUInt16(Contents.Height - 30), 64, 20, "Delete") { Clicked = DeleteButton_Click }; + ImportButton = new Button(this, Convert.ToUInt16(Contents.Width - 306), Convert.ToUInt16(Contents.Height - 30), 64, 20, "Import") { Clicked = ImportButton_Click }; + LoadExistingButton = new Button(this, Convert.ToUInt16(Contents.Width - 234), Convert.ToUInt16(Contents.Height - 30), 120, 20, "Load existing") { Clicked = LoadExistingButton_Click }; + CreateNewButton = new Button(this, Convert.ToUInt16(Contents.Width - 106), Convert.ToUInt16(Contents.Height - 30), 96, 20, "Create new") { Clicked = CreateNewButton_Click }; // Paint the window. Contents.Clear(Color.LightGray); @@ -63,38 +62,50 @@ public ProjectsFrame() Contents.DrawFilledRectangle(2, Convert.ToUInt16(Contents.Height - 40), Convert.ToUInt16(Contents.Width - 4), 38, 0, Color.DeepGray); Contents.DrawString(10, 10, "All projects", Fonts.Font_2x, Color.White); foreach (Button i in RecentProjectsButtons) i.Render(); + DeleteButton.Render(); ImportButton.Render(); LoadExistingButton.Render(); CreateNewButton.Render(); } - catch (Exception e) - { - Dialogue.Show("TheTunaFishSandwitch is racist!!1", e.Message, null, WindowManager.errorIcon); - } + catch { } } - void RecentProjects_Click(string i) + private void RecentProjects_Click(string i) { - WindowManager.AddWindow(new IDEFrame(i.Remove(i.LastIndexOf(".")), @"0:\content\prf\GoIDE\Projects\" + i, i.EndsWith(".9xc"))); - Dispose(); + if (DeleteButton.AppearPressed) + { + File.Delete(@"0:\content\prf\GoIDE\Projects\" + i); + Dispose(); + WindowManager.AddWindow(new ProjectsFrame()); + } + else + { + WindowManager.AddWindow(new IDEFrame(i.Remove(i.LastIndexOf(".")), @"0:\content\prf\GoIDE\Projects\" + i, i.EndsWith(".9xc"))); + Dispose(); + } } - void ImportButton_Click() + private void ImportButton_Click() { WindowManager.AddWindow(new ImportProjectFrame()); Dispose(); } - void LoadExistingButton_Click() + private void LoadExistingButton_Click() { WindowManager.AddWindow(new LoadProjectFrame()); Dispose(); } - void CreateNewButton_Click() + private void CreateNewButton_Click() { WindowManager.AddWindow(new NewProjectFrame()); Dispose(); } + + private void DeleteButton_Click() + { + DeleteButton.AppearPressed = !DeleteButton.AppearPressed; + } } } diff --git a/GoOS/GUI/Apps/GoIDE/WelcomeFrame.cs b/GoOS/GUI/Apps/GoIDE/WelcomeFrame.cs new file mode 100644 index 0000000000..f9173e7460 --- /dev/null +++ b/GoOS/GUI/Apps/GoIDE/WelcomeFrame.cs @@ -0,0 +1,52 @@ +using System; +using System.IO; +using PrismAPI.Graphics; + +namespace GoOS.GUI.Apps.GoIDE +{ + public class WelcomeFrame : Window + { + Button CancelButton; + Button NextButton; + + public WelcomeFrame() + { + // Create the window. + AutoCreate(WindowDock.Center, 400, 300, "Welcome - GoIDE"); + + // Initialize the controls. + CancelButton = new Button(this, Convert.ToUInt16(Contents.Width - 132), Convert.ToUInt16(Contents.Height - 30), 64, 20, "Cancel") { Clicked = CancelButton_Click }; + NextButton = new Button(this, Convert.ToUInt16(Contents.Width - 58), Convert.ToUInt16(Contents.Height - 30), 48, 20, "Next") { Clicked = NextButton_Click }; + + // Paint the window. + Contents.Clear(Color.LightGray); + RenderSystemStyleBorder(); + Contents.DrawFilledRectangle(2, Convert.ToUInt16(Contents.Height - 40), Convert.ToUInt16(Contents.Width - 4), 38, 0, Color.DeepGray); + Contents.DrawString(10, 10, "Welcome", Fonts.Font_2x, Color.White); + Contents.DrawString(10, 52, "Welcome to GoIDE! This program will let you\ncreate and debug GoOS applications.\n\nGoIDE currently supports GoCode and 9xCode.\n\nPress next to install GoIDE and create a new\nproject.", Fonts.Font_1x, Color.White); + CancelButton.Render(); + NextButton.Render(); + } + + private void NextButton_Click() + { + Dialogue msg = new Dialogue("Setup Wizard", "Installing GoIDE...", default, Dialogue.infoIcon); + WindowManager.AddWindow(msg); + WindowManager.Update(); + + Directory.CreateDirectory(@"0:\content\prf\GoIDE"); + Directory.CreateDirectory(@"0:\content\prf\GoIDE\Projects"); + Directory.CreateDirectory(@"0:\content\prf\GoIDE\SaveData"); + + msg.Dispose(); + Dispose(); + WindowManager.AddWindow(new NewProjectFrame()); + } + + private void CancelButton_Click() + { + Dispose(); + Dialogue.Show("GoIDE", "You have canceled GoIDE setup.", default, WindowManager.errorIcon); + } + } +} diff --git a/GoOS/GUI/Apps/Paintbrush.cs b/GoOS/GUI/Apps/Paintbrush.cs index 3b1595b20d..384b45820b 100644 --- a/GoOS/GUI/Apps/Paintbrush.cs +++ b/GoOS/GUI/Apps/Paintbrush.cs @@ -10,7 +10,8 @@ public enum PaintTools { Brush = 0, Bucket = 1, - Text = 2 + Text = 2, + Rubber } public class Paintbrush : Window @@ -33,6 +34,9 @@ public class Paintbrush : Window [ManifestResourceStream(ResourceName = "GoOS.Resources.GUI.mouse_text.bmp")] private static byte[] mouse_textRaw; private static Canvas mouse_text = Image.FromBitmap(mouse_textRaw, false); + [ManifestResourceStream(ResourceName = "GoOS.Resources.GUI.Paint.rubber.bmp")] private static byte[] rubberRaw; + private static Canvas rubber = Image.FromBitmap(rubberRaw, false); + private bool IsOverColorTable { get { return MouseManager.X > X + 54 && MouseManager.X < X + 278 && MouseManager.Y > Y + Convert.ToUInt16(Contents.Height - 26) && MouseManager.Y < Y + Convert.ToUInt16(Contents.Height + 6); } } private bool IsOverPaintableArea { get { return MouseManager.X > X && MouseManager.X < X + Contents.Width - BrushSize && MouseManager.Y > Y + TITLE_BAR_HEIGHT && MouseManager.Y < Y + Convert.ToUInt16(Contents.Height - 36); } } @@ -53,10 +57,12 @@ public class Paintbrush : Window private int TextX, TextY; + private Color BackgroundColor = Color.White; + public Paintbrush() { Contents = new Canvas(324, 300); - Contents.Clear(Color.LightGray); + Contents.Clear(BackgroundColor); Title = "Paintbrush"; Visible = true; Closable = true; @@ -80,7 +86,11 @@ public Paintbrush() Image = text, Clicked = Text_Click }, - new Button(this, 28, Convert.ToUInt16(Contents.Height - 26), 16, 16, string.Empty), + new Button(this, 28, Convert.ToUInt16(Contents.Height - 26), 16, 16, string.Empty) + { + Image = rubber, + Clicked = Rubber_Click + } }; RenderPanel(); @@ -98,11 +108,8 @@ public override void HandleKey(KeyEvent key) WindowManager.AddWindow(new BrownGhost()); break; } - // TODO: implement ctrl + z - // What about a fucking eraser? - Owen2k6 - // you got a pencil that has a rubber on the other side - xrc2 } private void Pencil_Click() @@ -154,6 +161,11 @@ private void Text_Click() Utility = PaintTools.Text; } + private void Rubber_Click() + { + Utility = PaintTools.Rubber; + } + private void Text_Handler() { Contents.DrawString(TextX, TextY, Dialog_TextBox.Text, BetterConsole.font, SelectedColor); @@ -178,6 +190,10 @@ public override void HandleRun() case PaintTools.Text: WindowManager.MouseToDraw = mouse_text; break; + + case PaintTools.Rubber: + WindowManager.MouseToDraw = rubber; + break; } if (MouseManager.LastMouseState == MouseState.None) @@ -188,11 +204,19 @@ public override void HandleRun() if (MouseManager.MouseState == MouseState.Left && (OldX != MouseManager.X || OldY != MouseManager.Y)) { - if (Utility == PaintTools.Brush) + switch (Utility) { - DrawLine(OldX - X - 1, OldY - Y - 19, (int)MouseManager.X - X - 1, (int)MouseManager.Y - Y - 19, (ushort)BrushSize); - OldX = (int)MouseManager.X; - OldY = (int)MouseManager.Y; + case PaintTools.Brush: + DrawLine(OldX - X - 1, OldY - Y - 19, (int)MouseManager.X - X - 1, (int)MouseManager.Y - Y - 19, (ushort)BrushSize, SelectedColor); + OldX = (int)MouseManager.X; + OldY = (int)MouseManager.Y; + break; + + case PaintTools.Rubber: + DrawLine(OldX - X - 1, OldY - Y - 19, (int)MouseManager.X - X - 1, (int)MouseManager.Y - Y - 19, 10, BackgroundColor); + OldX = (int)MouseManager.X; + OldY = (int)MouseManager.Y; + break; } } } @@ -206,6 +230,7 @@ public override void HandleClick(MouseEventArgs e) { case PaintTools.Bucket: Contents.DrawFilledRectangle(0, 0, Convert.ToUInt16(Contents.Width - 2), Convert.ToUInt16(Contents.Height - 52), 0, SelectedColor); + BackgroundColor = SelectedColor; break; case PaintTools.Text: @@ -244,7 +269,7 @@ public override void HandleClick(MouseEventArgs e) private void RenderPanel() { - Contents.DrawFilledRectangle(2, Convert.ToUInt16(Contents.Height - 52), Convert.ToUInt16(Contents.Width - 4), 50, 0, new Color(234, 234, 234)); + Contents.DrawFilledRectangle(2, Convert.ToUInt16(Contents.Height - 52), Convert.ToUInt16(Contents.Width - 4), 50, 0, Color.DeepGray); Contents.DrawImage(54, Convert.ToUInt16(Contents.Height - 42), colorTable, false); RenderButtons(); RenderSystemStyleBorder(); @@ -263,12 +288,12 @@ private void RenderButtons() } /* Paint utilities */ - private void DrawPoint(int X, int Y, ushort size) + private void DrawPoint(int X, int Y, ushort size, Color color) { - Contents.DrawFilledRectangle(X, Y, size, size, 0, SelectedColor); + Contents.DrawFilledRectangle(X, Y, size, size, 0, color); } - private void DrawLine(int X1, int Y1, int X2, int Y2, ushort size) + private void DrawLine(int X1, int Y1, int X2, int Y2, ushort size, Color color) { int DX = Math.Abs(X2 - X1), SX = X1 < X2 ? 1 : -1; int DY = Math.Abs(Y2 - Y1), SY = Y1 < Y2 ? 1 : -1; @@ -276,7 +301,7 @@ private void DrawLine(int X1, int Y1, int X2, int Y2, ushort size) while (X1 != X2 || Y1 != Y2) { - DrawPoint(X1, Y1, size); + DrawPoint(X1, Y1, size, color); int E2 = err; diff --git a/GoOS/GUI/Apps/TaskManager.cs b/GoOS/GUI/Apps/TaskManager.cs index 5696be8560..e9365b6237 100644 --- a/GoOS/GUI/Apps/TaskManager.cs +++ b/GoOS/GUI/Apps/TaskManager.cs @@ -10,6 +10,8 @@ public class TaskManager : Window Button AboutButton; List Windows; + public static bool pko = false; + public TaskManager() { Contents = new Canvas(270, 310); @@ -64,7 +66,7 @@ private void Update() private void EndButton_Click() { - if (WindowManager.windows[Windows.Selected].Unkillable) + if (WindowManager.windows[Windows.Selected].Unkillable && !pko) { Dialogue.Show( "Error", diff --git a/GoOS/GUI/Dialogue.cs b/GoOS/GUI/Dialogue.cs index 8c54d82aa4..c7301ac33f 100644 --- a/GoOS/GUI/Dialogue.cs +++ b/GoOS/GUI/Dialogue.cs @@ -17,7 +17,7 @@ public struct DialogueButton public class Dialogue : Window { [ManifestResourceStream(ResourceName = "GoOS.Resources.GUI.info.bmp")] private static byte[] infoIconRaw; - private static Canvas infoIcon = Image.FromBitmap(infoIconRaw, false); + public static Canvas infoIcon = Image.FromBitmap(infoIconRaw, false); private const int buttonSpacing = 20; diff --git a/GoOS/GUI/Window.cs b/GoOS/GUI/Window.cs index 9d75cbeb3f..3c4d54f26c 100644 --- a/GoOS/GUI/Window.cs +++ b/GoOS/GUI/Window.cs @@ -410,5 +410,26 @@ protected void SetDock(WindowDock dock) /// Paint the window. Required for resizing. /// public virtual void Paint() { } + + public void AutoCreate(WindowDock dock, int Width, int Height, string Title) + { + Fonts.Generate(); + Contents = new Canvas((ushort)Width, (ushort)Height); + SetDock(dock); + this.Title = Title; + Visible = true; + Closable = true; + } + + public void AutoCreate(int X, int Y, int Width, int Height, string Title) + { + Fonts.Generate(); + Contents = new Canvas((ushort)Width, (ushort)Height); + this.X = X; + this.Y = Y; + this.Title = Title; + Visible = true; + Closable = true; + } } } diff --git a/GoOS/GUI/WindowManager.cs b/GoOS/GUI/WindowManager.cs index 0dc12a6e2b..4a9b19d6bb 100644 --- a/GoOS/GUI/WindowManager.cs +++ b/GoOS/GUI/WindowManager.cs @@ -94,6 +94,16 @@ public static int GetAmountOfWindowsByTitle(string wnd) public static bool ContainsWindowByTitle(string wnd) => GetAmountOfWindowsByTitle(wnd) > 0; + public static bool ContainsAWindow(List wnds) + { + foreach (Window w in wnds) + { + if (windows.Contains(w)) return true; + } + + return false; + } + public static void RemoveWindowByTitle(string wnd) { foreach (Window w in windows) diff --git a/GoOS/GoOS.csproj b/GoOS/GoOS.csproj index 5229adbc3f..dea5df2944 100644 --- a/GoOS/GoOS.csproj +++ b/GoOS/GoOS.csproj @@ -100,54 +100,6 @@ 512 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -171,45 +123,23 @@ - - - - - - - - - - - - - - - - - - - - - - - + @@ -220,11 +150,11 @@ - + @@ -235,15 +165,11 @@ - + - - - - DotNetClr.dll @@ -257,9 +183,6 @@ ..\..\..\Prism-OS\PrismAPI\bin\Debug\net6.0\PrismAPI.dll - - ..\..\UWS\UWS\bin\Debug\net6.0\UWS.dll - diff --git a/GoOS/Kernel.cs b/GoOS/Kernel.cs index 39e4b696ed..ac86706619 100644 --- a/GoOS/Kernel.cs +++ b/GoOS/Kernel.cs @@ -2,6 +2,10 @@ // I hate xrc2 code. // /////////////////////// +////////// xrc2 ////////// +// I hate ekeleze code. // +////////////////////////// + using Cosmos.HAL; using Cosmos.System.Network.Config; using Cosmos.System.Network.IPv4; @@ -64,14 +68,10 @@ protected override void BeforeRun() { System.Console.ForegroundColor = System.ConsoleColor.Red; System.Console.WriteLine(); - System.Console.Write( - "GoOS - Not enough ram to boot GoOS. Please increase the amount of RAM of your VM"); - System.Console.Write( - "GoOS - Or if you are running this on real hardware (you shouldn't), buy more RAM"); + System.Console.Write("GoOS - Not enough ram to boot GoOS. Please increase the amount of RAM of your VM"); + System.Console.Write("GoOS - Or if you are running this on real hardware (you shouldn't), buy more RAM"); - while (true) - { - } + while (true); } WindowManager.Canvas = Display.GetDisplay(800, 600); //TODO: Not have this hard coded >:^( diff --git a/GoOS/OOBE.cs b/GoOS/OOBE.cs index 0176b229b2..2f30ef5082 100644 --- a/GoOS/OOBE.cs +++ b/GoOS/OOBE.cs @@ -228,52 +228,41 @@ public static void ShowPage(int page) case 9: - balls: + retry: try { - tries++; Directory.CreateDirectory(@"0:\content"); Directory.CreateDirectory(@"0:\content\sys"); Directory.CreateDirectory(@"0:\content\themes"); + Directory.CreateDirectory(@"0:\content\prf"); Directory.CreateDirectory(@"0:\framework"); File.Create(@"0:\content\sys\option-showprotectedfiles.gms"); File.Create(@"0:\content\sys\option-editprotectedfiles.gms"); File.Create(@"0:\content\sys\option-deleteprotectedfiles.gms"); File.Create(@"0:\content\sys\setup.gms"); - File.WriteAllText(@"0:\content\sys\version.gms", - $"System.Version is set to {Kernel.version} \n Note to users reading this: DO NOT ALTER. IMPORTANT IF USER DATA NEEDS CONVERTING."); - File.WriteAllText(@"0:\content\sys\user.gms", - $"username: {username}\ncomputername: {computerName}"); - File.WriteAllBytes(@"0:\content\sys\resolution.gms", - new byte[] { videoMode }); // Video mode 2: 1280x720 - File.WriteAllText(@"0:\content\themes\default.gtheme", - "Default = White\nBackground = Black\nStartup = DarkMagenta,Red,DarkRed\nWindowText = Cyan\nWindowBorder = Green\nErrorText = Red\nOther1 = Yellow"); - File.WriteAllText(@"0:\content\themes\mono.gtheme", - "Default = White\nBackground = Black\nStartup = White,White,White\nWindowText = White\nWindowBorder = White\nErrorText = White\nOther1 = White"); - File.WriteAllText(@"0:\content\themes\dark.gtheme", - "Default = Gray\nBackground = Black\nStartup = DarkGray,Gray,DarkGray\nWindowText = Gray\nWindowBorder = DarkGray\nErrorText = DarkGray\nOther1 = DarkGray"); - File.WriteAllText(@"0:\content\themes\light.gtheme", - "Default = Black\nBackground = White\nStartup = Black,Black,Black\nWindowText = Black\nWindowBorder = Black\nErrorText = Black\nOther1 = Black"); - File.WriteAllText(@"0:\content\sys\theme.gms", @"ThemeFile = " + theme); + File.WriteAllText(@"0:\content\sys\version.gms", $"System.Version is set to {Kernel.version} \n Note to users reading this: DO NOT ALTER. IMPORTANT IF USER DATA NEEDS CONVERTING."); + File.WriteAllText(@"0:\content\sys\user.gms", $"username: {username}\ncomputername: {computerName}"); + File.WriteAllBytes(@"0:\content\sys\resolution.gms", new byte[] { videoMode }); // Video mode 2: 1280x720 + File.WriteAllText(@"0:\content\themes\default.gtheme", "Default = White\nBackground = Black\nStartup = DarkMagenta,Red,DarkRed\nWindowText = Cyan\nWindowBorder = Green\nErrorText = Red\nOther1 = Yellow"); + File.WriteAllText(@"0:\content\themes\mono.gtheme", "Default = White\nBackground = Black\nStartup = White,White,White\nWindowText = White\nWindowBorder = White\nErrorText = White\nOther1 = White"); + File.WriteAllText(@"0:\content\themes\dark.gtheme", "Default = Gray\nBackground = Black\nStartup = DarkGray,Gray,DarkGray\nWindowText = Gray\nWindowBorder = DarkGray\nErrorText = DarkGray\nOther1 = DarkGray"); + File.WriteAllText(@"0:\content\themes\light.gtheme", "Default = Black\nBackground = White\nStartup = Black,Black,Black\nWindowText = Black\nWindowBorder = Black\nErrorText = Black\nOther1 = Black"); + File.WriteAllText(@"0:\content\sys\theme.gms", "ThemeFile = " + theme); + + tries++; } catch (Exception e) { Console.SetCursorPosition(0,0); - //Console.WriteLine(e); if (tries < 10) { - goto balls; + goto retry; } else { Console.Clear(); Console.WriteLine(e); - Console.WriteLine(e); - Console.WriteLine(e); - Console.WriteLine(e); - Console.WriteLine(e); - Console.WriteLine(e); Console.WriteLine("Press any key to shutdown."); Console.ReadKey(true); Sys.Power.Shutdown(); From a38c79bf10645c0593c81a753d4ca940ab41ddb1 Mon Sep 17 00:00:00 2001 From: MrDumbrava <109512837+9xbt@users.noreply.github.com> Date: Sat, 4 Nov 2023 16:44:31 +0100 Subject: [PATCH 2/2] Fix --- GoOS/GoOS.csproj | 5 +++++ GoOS/Resources/GUI/Paint/rubber.bmp | Bin 0 -> 1174 bytes 2 files changed, 5 insertions(+) create mode 100644 GoOS/Resources/GUI/Paint/rubber.bmp diff --git a/GoOS/GoOS.csproj b/GoOS/GoOS.csproj index dea5df2944..a2e1315134 100644 --- a/GoOS/GoOS.csproj +++ b/GoOS/GoOS.csproj @@ -100,6 +100,10 @@ 512 + + + + @@ -119,6 +123,7 @@ + diff --git a/GoOS/Resources/GUI/Paint/rubber.bmp b/GoOS/Resources/GUI/Paint/rubber.bmp new file mode 100644 index 0000000000000000000000000000000000000000..9db317dd014af1844072b67c858c797c5bc7cf81 GIT binary patch literal 1174 zcmZ?royNid2Gf9K4G;@JF(ZQl12b5Lf#C=r1Vgz%>OTyDg#Ih!Wric<$YTLb1e*yZ z$TMW{=>mBR7bfJ|{|62nz>1N~#AgOpy&yBe`uFdLxeJ#Wg!L0)#(yAS01-fdOvBwU koXjAccrn5O7B1lMAgmu0SA@&}sUZYlagR(^b literal 0 HcmV?d00001