aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-05-06 12:45:47 -0400
committerMichael <[email protected]>2017-05-06 12:45:47 -0400
commita4a39d9895f9748f86e3c472880e2d8cdbe92c24 (patch)
treeada40cc3240332462816ad4bbea1f73fb9808fb5
parent2d8831c29ca4d05d66ad4b90db66250094e734c9 (diff)
downloadshiftos_thereturn-a4a39d9895f9748f86e3c472880e2d8cdbe92c24.tar.gz
shiftos_thereturn-a4a39d9895f9748f86e3c472880e2d8cdbe92c24.tar.bz2
shiftos_thereturn-a4a39d9895f9748f86e3c472880e2d8cdbe92c24.zip
user list
-rw-r--r--ShiftOS_TheReturn/UserManagementCommands.cs25
1 files changed, 25 insertions, 0 deletions
diff --git a/ShiftOS_TheReturn/UserManagementCommands.cs b/ShiftOS_TheReturn/UserManagementCommands.cs
index 21c984b..5702e08 100644
--- a/ShiftOS_TheReturn/UserManagementCommands.cs
+++ b/ShiftOS_TheReturn/UserManagementCommands.cs
@@ -47,6 +47,11 @@ namespace ShiftOS.Engine
}
var user = SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == name);
+ if(user.Username != SaveSystem.CurrentUser.Username)
+ {
+ Console.WriteLine("Error: Cannot remove yourself.");
+ return true;
+ }
SaveSystem.CurrentSave.Users.Remove(user);
Console.WriteLine($"Removing user \"{name}\" from system...");
SaveSystem.SaveGame();
@@ -119,6 +124,26 @@ namespace ShiftOS.Engine
return true;
}
+
+ [Command("users", description = "Get a list of all users on the system.")]
+ public static bool GetUsers()
+ {
+ foreach (var u in SaveSystem.CurrentSave.Users)
+ {
+ if (u.Username == SaveSystem.CurrentUser.Username)
+ {
+ ConsoleEx.ForegroundColor = ConsoleColor.Magenta;
+ ConsoleEx.Bold = true;
+ }
+ else
+ {
+ ConsoleEx.ForegroundColor = ConsoleColor.Gray;
+ ConsoleEx.Bold = false;
+ }
+ Console.WriteLine(u.Username);
+ }
+ return true;
+ }
}
[Namespace("user")]