public void Start() { xClient = new TCPClient(port); xClient.Connect(ip, port); enabled = true; Send("--- Aura Debugger v0.2 ---"); Send("Connected!"); debugger.Send("Debugger started!"); }
//private static StreamWriter writer = new StreamWriter("log.txt"); #endif public static void Output(string s) { if (Enable) { #if COSMOSDEBUG Debugger.Send(s); #else //writer.WriteLine(s); //Debug.WriteLine(s); #endif } }
public static void Debug(string aMessage, params object[] aParams) { string xMessage = aMessage; if (aParams != null) { aMessage = aMessage + " : "; for (int i = 0; i < aParams.Length; i++) { if (aParams[i] != null) { string xParam = aParams[i].ToString(); if (!string.IsNullOrWhiteSpace(xParam)) { xMessage = xMessage + " " + xParam; } } } } mDebugger.Send("TextScreen Debug: " + xMessage); }
/// <summary> /// Main installer method, choose colour of installer, choose desired username and reports if a FAT error occurs /// </summary> public static void Run() { InitScreen(defaultcol); InstallerWriteLine("Welcome to the Medli installer."); PAKTC(); InitScreen(defaultcol); Console.CursorTop = 24; Console.CursorLeft = 0; color = ConsoleColor.Blue; Console.BackgroundColor = ConsoleColor.Blue; InitScreen(color); InstallerWriteLine("Enter a username for Medli:"); Console.CursorTop = 24; Console.CursorLeft = 0; username = Console.ReadLine(); InitScreen(color); Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.White; Console.Clear(); Console.CursorLeft = 0; Console.CursorTop = 0; KernelVariables.Mksysdir(); Console.WriteLine("Press any key to return..."); Console.ReadKey(true); Console.Clear(); InitScreen(color); try { Console.CursorTop = 7; Console.ForegroundColor = ConsoleColor.White; InstallerWrite("Creating user directory... "); Directory.CreateDirectory(KernelVariables.homedir + @"\" + username); Console.ForegroundColor = ConsoleColor.Green; Console.Write("\t\tDone!"); Console.CursorTop = 8; mDebugger = new Cosmos.Debug.Kernel.Debugger("User", "Kernel"); mDebugger.Send(KernelVariables.sysdir + @"\" + "usrinfo.sys"); Console.ForegroundColor = ConsoleColor.White; InstallerWrite("Creating users file... "); File.Create(KernelVariables.sysdir + @"\" + "usrinfo.sys").Dispose(); Console.ForegroundColor = ConsoleColor.Green; Console.Write("\t\tDone!"); Console.CursorTop = 9; Console.ForegroundColor = ConsoleColor.White; InstallerWrite("Writing username to file..."); File.WriteAllText(KernelVariables.sysdir + @"\" + "usrinfo.sys", username); Console.ForegroundColor = ConsoleColor.Green; Console.Write("\t\tDone!"); Console.ForegroundColor = ConsoleColor.White; } catch { Console.ReadKey(true); ErrorHandler.BlueScreen.Init(5, @"The Installer was unable to create the user directory and other files. This may be due to an unformatted hard drive or some other error", "FAT Error"); } Console.CursorTop = 10; Console.ForegroundColor = ConsoleColor.White; InstallerWriteLine("All set! Press any key to continue..."); Console.CursorLeft = 0; Console.CursorTop = 24; Console.ReadKey(); OSVars.username = username; Console.BackgroundColor = color; Console.Clear(); InstallerWriteLine("Please enter a machine name:"); Console.CursorTop = 24; OSVars.pcname = Console.ReadLine(); InitScreen(color); try { Console.ForegroundColor = ConsoleColor.White; Console.Write("Creating machineinfo file... "); File.Create(KernelVariables.sysdir + @"\" + "pcinfo.sys").Dispose(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\t\tDone!"); Console.ForegroundColor = ConsoleColor.White; Console.Write("Writing machineinfo to file..."); File.WriteAllText(KernelVariables.sysdir + @"\" + "pcinfo.sys", OSVars.pcname); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\t\tDone!"); Console.ForegroundColor = ConsoleColor.White; } catch { Console.ReadKey(true); ErrorHandler.BlueScreen.Init(5, @"The Installer was unable to create the user directory and other files. This may be due to an unformatted hard drive or some other error", "FAT Error"); } //Console.WriteLine("Excellent! Please enter who this copy of Medli is registered to:"); //OSVars.regname = Console.ReadLine(); //File.Create(Kernel.current_dir + "reginfo.sys"); //File.WriteAllText(Kernel.current_dir + "reginfo.sys", OSVars.regname); Console.Clear(); InitScreen(defaultcol); InstallerWriteLine("Awesome - you're all set!"); InstallerWriteLine("Press any key to start Medli!"); Console.CursorTop = 24; Console.ReadKey(true); Console.CursorTop = 0; Console.CursorLeft = 0; Console.Clear(); }
/// <summary> /// Initializes the installer service and allows the user to choose a machine name /// Sets the machine name as a variable and writes it to the disk /// </summary> /// <returns></returns> public static bool Init() { if (FSService.Active == false) { Kernel.username = "******"; Kernel.pcname = "testing"; mDebugger.Send("Installer - Skipping Installer due to live filesystem."); return(false); } else if (Kernel.IsLive == true) { Kernel.username = "******"; Kernel.pcname = "testing"; mDebugger.Send("Installer - Skipping Installer due to live filesystem."); return(false); } else if (FSService.Active == true && Kernel.IsLive == false) { if (File.Exists(Kernel.pcinfo)) { try { string[] pcnames = File.ReadAllLines(Kernel.pcinfo); Kernel.pcname = pcnames[0]; } catch (Exception ex) { Console.WriteLine(ex.Message); } } Console.WriteLine("Does usrinfo exist?"); Console.WriteLine(File.Exists(Kernel.usrinfo)); KernelExtensions.PressAnyKey(); if (File.Exists(Kernel.usrinfo)) { Console.Clear(); try { Accounts.UserLogin(); AConsole.Fill(ConsoleColor.Blue); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Welcome back, " + Kernel.username + @"!"); KernelExtensions.PressAnyKey(); } catch (Exception ex) { AConsole.Error.WriteLine("Medli encountered an exception during the pre-initialization stage.\nError: " + ex.Message); KernelExtensions.PressAnyKey(); } } else { Console.Clear(); Installer.ScreenSetup(); Installer.WriteLine("Medli was unable to find any info regarding your PC."); Installer.WriteLine("The Medli installer will now run."); ServiceLogger = new LoggingService(Paths.SystemLogs + @"\ins.log"); ServiceLogger.Record("Installer Service logger initialized."); ServiceLogger.Record("Installer Service running on " + Paths.Root); mDebugger.Send("Running setup..."); Installer.PressAnyKey(); Console.Clear(); Active = true; Installer.Main(); } Active = false; return(true); } else { return(false); } }
//[Conditional("EXCLUDE")] public static void Debug(string message) { mDebugger.Send("FAT Debug: " + message); }