aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Server/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ShiftOS.Server/Program.cs')
-rw-r--r--ShiftOS.Server/Program.cs44
1 files changed, 43 insertions, 1 deletions
diff --git a/ShiftOS.Server/Program.cs b/ShiftOS.Server/Program.cs
index 020fd13..016e1bf 100644
--- a/ShiftOS.Server/Program.cs
+++ b/ShiftOS.Server/Program.cs
@@ -166,7 +166,49 @@ namespace ShiftOS.Server
};
var task = ChatBackend.StartDiscordBots();
task.Wait();
- }
+
+ while (server.IsOnline)
+ {
+ Console.Write("> ");
+ string cmd = Console.ReadLine();
+ try
+ {
+ if (cmd.ToLower().StartsWith("decrypt "))
+ {
+ string username = cmd.Remove(0, 8);
+ if (File.Exists("saves/" + username + ".save"))
+ {
+ Console.WriteLine(ReadEncFile("saves/" + username + ".save"));
+ }
+ else
+ {
+ Console.WriteLine("Save not found.");
+ }
+ }
+ else if (cmd == "purge_all_bad_saves")
+ {
+ foreach(var f in Directory.GetFiles("saves"))
+ {
+ try
+ {
+ Console.WriteLine("Testing " + f + "...");
+ ReadEncFile(f);
+ Console.WriteLine("OK");
+ }
+ catch
+ {
+ Console.WriteLine("Not OK. Deleting.");
+ File.Delete(f);
+ }
+ }
+ }
+ }
+ catch(Exception ex)
+ {
+ Console.WriteLine(ex.Message);
+ }
+ }
+ }
public static string ReadEncFile(string fPath)
{