aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Server/Program.cs
diff options
context:
space:
mode:
authorMichael VanOverbeek <[email protected]>2017-02-23 22:05:09 +0000
committerMichael VanOverbeek <[email protected]>2017-02-23 22:05:15 +0000
commitdcc9d72046266d2bb398252d4265ee87bfb75277 (patch)
tree50e5b1996b25c36509b52ed01008aad0fd0392fc /ShiftOS.Server/Program.cs
parenteb4c65f1921f8f74e6a0ea086444f7c034f50f44 (diff)
downloadshiftos_thereturn-dcc9d72046266d2bb398252d4265ee87bfb75277.tar.gz
shiftos_thereturn-dcc9d72046266d2bb398252d4265ee87bfb75277.tar.bz2
shiftos_thereturn-dcc9d72046266d2bb398252d4265ee87bfb75277.zip
Save deletion (server)
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)
{