aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Frontend/Commands.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ShiftOS.Frontend/Commands.cs')
-rw-r--r--ShiftOS.Frontend/Commands.cs61
1 files changed, 31 insertions, 30 deletions
diff --git a/ShiftOS.Frontend/Commands.cs b/ShiftOS.Frontend/Commands.cs
index 012d0b0..da1d1c1 100644
--- a/ShiftOS.Frontend/Commands.cs
+++ b/ShiftOS.Frontend/Commands.cs
@@ -47,6 +47,7 @@ namespace ShiftOS.Frontend
[TutorialLock]
public static class TerminalCommands
{
+ [MetaCommand]
[Command("clear", description = "{DESC_CLEAR}")]
public static bool Clear()
{
@@ -60,14 +61,21 @@ namespace ShiftOS.Frontend
public static class ShiftOSCommands
{
+#if DEBUG
+ [Command("debug")]
+ public static void EnterDebug()
+ {
+ TerminalBackend.SetShellOverride("shiftos_debug> ");
+ }
+#endif
- [Command("setsfxenabled", description = "{DESC_SETSFXENABLED}")]
- [RequiresArgument("value")]
+ [Command("setsfxenabled", description = "{DESC_SETSFXENABLED}")]
+ [RequiresArgument("id")]
public static bool SetSfxEnabled(Dictionary<string, object> args)
{
try
{
- bool value = Convert.ToBoolean(args["value"].ToString());
+ bool value = Convert.ToBoolean(args["id"].ToString());
SaveSystem.CurrentSave.SoundEnabled = value;
SaveSystem.SaveGame();
}
@@ -81,12 +89,12 @@ namespace ShiftOS.Frontend
[Command("setmusicenabled", description = "{DESC_SETMUSICENABLED}")]
- [RequiresArgument("value")]
+ [RequiresArgument("id")]
public static bool SetMusicEnabled(Dictionary<string, object> args)
{
try
{
- bool value = Convert.ToBoolean(args["value"].ToString());
+ bool value = Convert.ToBoolean(args["id"].ToString());
SaveSystem.CurrentSave.MusicEnabled = value;
SaveSystem.SaveGame();
}
@@ -100,10 +108,10 @@ namespace ShiftOS.Frontend
[Command("setvolume", description ="{DESC_SETVOLUME}")]
- [RequiresArgument("value")]
+ [RequiresArgument("id")]
public static bool SetSfxVolume(Dictionary<string, object> args)
{
- int value = int.Parse(args["value"].ToString());
+ int value = int.Parse(args["id"].ToString());
if(value >= 0 && value <= 100)
{
SaveSystem.CurrentSave.MusicVolume = value;
@@ -127,14 +135,14 @@ namespace ShiftOS.Frontend
}
[Command("lang", description = "{DESC_LANG}")]
- [RequiresArgument("language")]
+ [RequiresArgument("id")]
public static bool SetLanguage(Dictionary<string, object> userArgs)
{
try
{
string lang = "";
- lang = (string)userArgs["language"];
+ lang = (string)userArgs["id"];
if (Localization.GetAllLanguages().Contains(lang))
{
@@ -152,7 +160,8 @@ namespace ShiftOS.Frontend
}
}
- [Command("commands", "", "{DESC_COMMANDS}")]
+ [MetaCommand]
+ [Command("help", "", "{DESC_COMMANDS}")]
public static bool Commands()
{
var sb = new StringBuilder();
@@ -160,7 +169,7 @@ namespace ShiftOS.Frontend
sb.AppendLine("=================");
sb.AppendLine();
//print all unique namespaces.
- foreach (var n in TerminalBackend.Commands.Where(x => !(x is TerminalBackend.WinOpenCommand) && Shiftorium.UpgradeInstalled(x.Dependencies) && x.CommandInfo.hide == false).OrderBy(x => x.CommandInfo.name))
+ foreach (var n in TerminalBackend.Commands.Where(x => !(x is TerminalBackend.WinOpenCommand) && Shiftorium.UpgradeInstalled(x.Dependencies) && x.CommandInfo.hide == false && x.MatchShell() == true).OrderBy(x => x.CommandInfo.name))
{
sb.Append(" - " + n.CommandInfo.name);
if (!string.IsNullOrWhiteSpace(n.CommandInfo.description))
@@ -174,13 +183,6 @@ namespace ShiftOS.Frontend
return true;
}
- [Command("help", description = "{DESC_HELP}")]
- public static bool Help()
- {
- Commands();
- WindowCommands.Programs();
- return true;
- }
[MultiplayerOnly]
@@ -237,14 +239,14 @@ namespace ShiftOS.Frontend
public static class ShiftoriumCommands
{
[Command("buy", description = "{DESC_BUY}")]
- [RequiresArgument("upgrade")]
+ [RequiresArgument("id")]
public static bool BuyUpgrade(Dictionary<string, object> userArgs)
{
try
{
string upgrade = "";
- upgrade = (string)userArgs["upgrade"];
+ upgrade = (string)userArgs["id"];
var upg = Shiftorium.GetAvailable().FirstOrDefault(x => x.ID == upgrade);
if(upg != null)
@@ -267,12 +269,12 @@ namespace ShiftOS.Frontend
[RequiresUpgrade("shiftorium_bulk_buy")]
[Command("bulkbuy", description = "{DESC_BULKBUY}")]
- [RequiresArgument("upgrades")]
+ [RequiresArgument("id")]
public static bool BuyBulk(Dictionary<string, object> args)
{
- if (args.ContainsKey("upgrades"))
+ if (args.ContainsKey("id"))
{
- string[] upgrade_list = (args["upgrades"] as string).Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
+ string[] upgrade_list = (args["id"] as string).Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
foreach (var upg in upgrade_list)
{
var dict = new Dictionary<string, object>();
@@ -285,14 +287,14 @@ namespace ShiftOS.Frontend
[Command("upgradeinfo", description ="{DESC_UPGRADEINFO}")]
- [RequiresArgument("upgrade")]
+ [RequiresArgument("id")]
public static bool ViewInfo(Dictionary<string, object> userArgs)
{
try
{
string upgrade = "";
- upgrade = (string)userArgs["upgrade"];
+ upgrade = (string)userArgs["id"];
foreach (var upg in Shiftorium.GetDefaults())
{
@@ -447,14 +449,13 @@ namespace ShiftOS.Frontend
}
[RemoteLock]
- [Command("close", usage = "{win:integer32}", description ="{DESC_CLOSE}")]
- [RequiresArgument("win")]
- [RequiresUpgrade("close_command")]
+ [Command("close", description ="{DESC_CLOSE}")]
+ [RequiresArgument("id")]
public static bool CloseWindow(Dictionary<string, object> args)
{
int winNum = -1;
- if (args.ContainsKey("win"))
- winNum = Convert.ToInt32(args["win"].ToString());
+ if (args.ContainsKey("id"))
+ winNum = Convert.ToInt32(args["id"].ToString());
string err = null;
if (winNum < 0 || winNum >= AppearanceManager.OpenForms.Count)