miuu-diamond-time-viewer/ConsoleCommands.cs

70 lines
1.8 KiB
C#
Raw Permalink Normal View History

2023-09-11 01:01:45 -04:00
using MIU;
namespace DiamondTimeViewer
{
internal class ConsoleCommands
{
private static void printUsage()
{
MIU.Console.Instance.Write("Usage: dtv [value]");
MIU.Console.Instance.Write("Possible values:");
MIU.Console.Instance.Write(" never Never show diamond times");
MIU.Console.Instance.Write(" diamond Show once you've achieved diamond time");
MIU.Console.Instance.Write(" gold Show once you've achieved gold time");
MIU.Console.Instance.Write(" always Always show diamond time");
2023-09-11 01:01:45 -04:00
MIU.Console.Instance.Write("");
MIU.Console.Instance.Write(" hideSilver Hide silver when showing diamond");
MIU.Console.Instance.Write(" showSilver Show silver always");
2023-09-11 01:01:45 -04:00
}
[ConsoleCommand(description = "Configures the Diamond Time Viewer", paramsDescription = "[value]")]
public static string dtv(params string[] args)
{
if (args.Length != 1)
{
printUsage();
return "";
}
string value = args[0];
string message;
2023-09-11 01:01:45 -04:00
switch (value)
{
case "never":
Config.Mode = DisplayMode.Never;
message = "mode set to: never";
break;
2023-09-11 01:01:45 -04:00
case "diamond":
Config.Mode = DisplayMode.Diamond;
message = "mode set to: diamond";
break;
2023-09-11 01:01:45 -04:00
case "gold":
Config.Mode = DisplayMode.Gold;
message = "mode set to: gold";
break;
2023-09-11 01:01:45 -04:00
case "always":
Config.Mode = DisplayMode.Always;
message = "mode set to: always";
break;
case "hideSilver":
Config.HideSilver = true;
message = "Hiding silver time";
break;
case "showSilver":
Config.HideSilver = false;
message = "Showing silver time";
break;
2023-09-11 01:01:45 -04:00
default:
printUsage();
// Return early (no auto save)
2023-09-11 01:01:45 -04:00
return "";
}
Config.SaveConfig();
return message;
2023-09-11 01:01:45 -04:00
}
}
}