feat: Adds console commands (#1714)

### Summary
* Adds console command support.
* Adds `save`, `restart`, and `shutdown` commands.
This commit is contained in:
Kamron Batman 2024-03-30 09:40:43 -07:00 • committed by GitHub
parent 855f8c67ae
commit e638fb7893
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 233 additions and 13 deletions

View file

@ -249,18 +249,16 @@ public static class EntityPersistence
Console.WriteLine($"***** Bad deserialize of {t.GetType()} ({t.Serial}) *****");
Console.WriteLine(error);
ConsoleKey pressedKey;
if (!deleteAllFailures)
{
Console.WriteLine("Delete the object and continue? (y/n/a)");
pressedKey = Console.ReadKey(true).Key;
Console.Write("Delete the object and continue? (y/n/a): ");
var pressedKey = Console.ReadLine();
if (pressedKey == ConsoleKey.A)
if (pressedKey.InsensitiveEquals("a"))
{
deleteAllFailures = true;
}
else if (pressedKey != ConsoleKey.Y)
else if (pressedKey.InsensitiveEquals("y"))
{
throw new Exception("Deserialization failed.");
}
@ -279,9 +277,9 @@ public static class EntityPersistence
var issue = t?.IsAbstract == true ? "marked abstract" : "not found";
Console.WriteLine($"Error: Type '{typeName}' was {issue}. Delete all of those types? (y/n)");
Console.Write($"Error: Type '{typeName}' was {issue}. Delete all of those types? (y/n): ");
if (Console.ReadKey(true).Key == ConsoleKey.Y)
if (Console.ReadLine().InsensitiveEquals("y"))
{
Console.WriteLine("Loading...");
return null;