aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn/Commands.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-02-23 16:25:29 -0500
committerMichael <[email protected]>2017-02-23 16:25:29 -0500
commit2bd4a815d327c5035c13074e01ff23fde49e2a56 (patch)
treeed35e81c0f3d8d1a1b5c581118ce7110b5863200 /ShiftOS_TheReturn/Commands.cs
parentad76a525fe312d5db024f499f1aee2a7ac44e505 (diff)
downloadshiftos_thereturn-2bd4a815d327c5035c13074e01ff23fde49e2a56.tar.gz
shiftos_thereturn-2bd4a815d327c5035c13074e01ff23fde49e2a56.tar.bz2
shiftos_thereturn-2bd4a815d327c5035c13074e01ff23fde49e2a56.zip
Fix savesystem oddities.
Diffstat (limited to 'ShiftOS_TheReturn/Commands.cs')
-rw-r--r--ShiftOS_TheReturn/Commands.cs32
1 files changed, 29 insertions, 3 deletions
diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs
index f58ceff..488d843 100644
--- a/ShiftOS_TheReturn/Commands.cs
+++ b/ShiftOS_TheReturn/Commands.cs
@@ -591,11 +591,11 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}");
[Command("list")]
public static bool List()
{
- Console.WriteLine("{ID}\t{WINDOW}");
+ Console.WriteLine("Window ID\tName");
foreach (var app in AppearanceManager.OpenForms)
{
- //All .NET object instances have a unique hash code. Good for fake process management.
- Console.WriteLine($"{app.GetHashCode()}\t{app.Text}");
+ //Windows are displayed the order in which they were opened.
+ Console.WriteLine($"{AppearanceManager.OpenForms.IndexOf(app)}\t{app.Text}");
}
return true;
}
@@ -702,6 +702,32 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}");
}
}
+ [RemoteLock]
+ [Command("close", usage = "{win:integer32}", description ="Closes the specified window.")]
+ [RequiresArgument("win")]
+ [RequiresUpgrade("close_command")]
+ public static bool CloseWindow(Dictionary<string, object> args)
+ {
+ int winNum = -1;
+ if (args.ContainsKey("win"))
+ winNum = Convert.ToInt32(args["win"].ToString());
+ string err = null;
+
+ if (winNum < 0 || winNum >= AppearanceManager.OpenForms.Count)
+ err = "The window number must be between 0 and " + (AppearanceManager.OpenForms.Count - 1).ToString() + ".";
+
+ if (string.IsNullOrEmpty(err))
+ {
+ Console.WriteLine($"Closing {AppearanceManager.OpenForms[winNum].Text}...");
+ AppearanceManager.Close(AppearanceManager.OpenForms[winNum].ParentWindow);
+ }
+ else
+ {
+ Console.WriteLine(err);
+ }
+
+ return true;
+ }
}
}