diff --git a/GoOS/Kernel.cs b/GoOS/Kernel.cs index c93420d95e..865c2dc228 100644 --- a/GoOS/Kernel.cs +++ b/GoOS/Kernel.cs @@ -57,8 +57,8 @@ namespace GoOS public class Kernel : Sys.Kernel { //Vars for OS - public string version = "1.5"; - public string BuildType = "Beta"; + public static string version = "1.5"; + public static string BuildType = "Beta"; public bool cmdm = true; public bool root = false; @@ -152,45 +152,11 @@ protected override void BeforeRun() } if (!File.Exists(@"0:\content\sys\setup.gms")) { - Console.WriteLine("GoOS is performing first boot..."); - Console.WriteLine("initialising file system..."); - Console.WriteLine("This may take some time."); - File.Create(@"0:\content\sys\version.gms"); - File.Create(@"0:\content\sys\userinfo.gms"); - File.Create(@"0:\content\sys\option-showprotectedfiles.gms"); - File.Create(@"0:\content\sys\option-editprotectedfiles.gms"); - File.Create(@"0:\content\sys\option-deleteprotectedfiles.gms"); - var setupcontent = Sys.FileSystem.VFS.VFSManager.GetFile(@"0:\content\sys\version.gms"); - var setupstream = setupcontent.GetFileStream(); - if (setupstream.CanWrite) - { - byte[] textToWrite = Encoding.ASCII.GetBytes($"System.Version is set to {version} \n Note to users reading this: DO NOT ALTER. IMPORTANT IF USER DATA NEEDS CONVERTING."); - setupstream.Write(textToWrite, 0, textToWrite.Length); - } - else - { - CP737Console.Write("╔═══════════════════════ Alert! ═══════════════════════╗", 24, 10); - CP737Console.Write("║ ║", 24, 11); - CP737Console.Write("║ An error has occoured, system can not continue ║", 24, 12); - CP737Console.Write("║ Open a ticket on the discord server! ║", 24, 13); - CP737Console.Write("║ ║", 24, 13); - CP737Console.Write("╚══════════════════════════════════════════════════════╝", 24, 14); - Console.ReadKey(); - bool pool = true; - while (pool) - { - - } - - } + OOBE.Open(); } try { textcolour(ThemeManager.Default); - if (!File.Exists(@"0:\content\sys\setup.gms")) - { - OOBE.Open(); - } var systemsetup = File.ReadAllLines(@"0:\content\sys\setup.gms"); foreach (string line in systemsetup) { diff --git a/GoOS/OOBE.cs b/GoOS/OOBE.cs index 6b883eb82b..56753208bf 100644 --- a/GoOS/OOBE.cs +++ b/GoOS/OOBE.cs @@ -1,7 +1,9 @@ using System; +using System.IO; using System.Collections.Generic; using System.Text; using Sys = Cosmos.System; +using Cosmos.System.FileSystem.VFS; using static System.ConsoleColor; using static GoOS.Themes.ThemeManager; @@ -118,21 +120,40 @@ public static void Write(string line, int x = -1, int y = -1) public static void Open() { + DrawFrame(); + DrawTitle(" GoOS Setup ", 0); + MessageBox(1); + VFSManager.CreateFile(@"0:\content\sys\version.gms"); + VFSManager.CreateFile(@"0:\content\sys\userinfo.gms"); + VFSManager.CreateFile(@"0:\content\sys\option-showprotectedfiles.gms"); + VFSManager.CreateFile(@"0:\content\sys\option-editprotectedfiles.gms"); + VFSManager.CreateFile(@"0:\content\sys\option-deleteprotectedfiles.gms"); + var setupcontent = VFSManager.GetFile(@"0:\content\sys\version.gms"); + var setupstream = setupcontent.GetFileStream(); + if (setupstream.CanWrite) + { + byte[] textToWrite = Encoding.ASCII.GetBytes($"System.Version is set to {Kernel.version} \n Note to users reading this: DO NOT ALTER. IMPORTANT IF USER DATA NEEDS CONVERTING."); + setupstream.Write(textToWrite, 0, textToWrite.Length); + } + else + { + MessageBox(2); + } DrawPage(0); DrawPage(1); DrawPage(2); MessageBox(0); - Sys.FileSystem.VFS.VFSManager.CreateFile(@"0:\content\sys\setup.gms"); - var setupcontent = Sys.FileSystem.VFS.VFSManager.GetFile(@"0:\content\sys\setup.gms"); - var setupstream = setupcontent.GetFileStream(); + VFSManager.CreateFile(@"0:\content\sys\setup.gms"); + var setupcontent1 = VFSManager.GetFile(@"0:\content\sys\setup.gms"); + var setupstream1 = setupcontent1.GetFileStream(); if (setupstream.CanWrite) { byte[] textToWrite = Encoding.ASCII.GetBytes($"username: {usrn}\ncomputername: {cprn}"); - setupstream.Write(textToWrite, 0, textToWrite.Length); + setupstream1.Write(textToWrite, 0, textToWrite.Length); } else { - MessageBox(1); + MessageBox(2); } } @@ -369,9 +390,21 @@ private static void MessageBox(int message) DrawTitle(" Info ", 10); Console.SetCursorPosition(31, 12); Console.Write("Saving settings..."); - Console.Clear(); } else if (message == 1) + { + CP737Console.Write("╔════════════════════╗", 29, 10); + CP737Console.Write("║ ║", 29, 11); + CP737Console.Write("║ ║", 29, 12); + CP737Console.Write("║ ║", 29, 13); + CP737Console.Write("╚════════════════════╝", 29, 14); + + Console.ForegroundColor = WindowText; + DrawTitle(" Info ", 10); + Console.SetCursorPosition(31, 12); + Console.Write("Preparing Setup..."); + } + else if (message == 2) { CP737Console.Write("╔══════════════════════════════════════════════════════╗", 12, 10); CP737Console.Write("║ ║", 12, 11); @@ -383,8 +416,7 @@ private static void MessageBox(int message) DrawTitle(" Info ", 10); Console.SetCursorPosition(14, 12); Console.Write("A serious error has occoured, setup cannot continue."); - Console.ReadKey(); - Console.Clear(); + while (true) { Console.ReadKey(true); } // Lock up } } }