miuu-diamond-time-viewer/ConsoleCommands.cs

75 lines
2.3 KiB
C#

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");
MIU.Console.Instance.Write("");
MIU.Console.Instance.Write(" hideSilver Hide silver when showing diamond");
MIU.Console.Instance.Write(" showSilver Show silver always");
MIU.Console.Instance.Write("");
MIU.Console.Instance.Write(" enable Enable the mod");
MIU.Console.Instance.Write(" disable Disable the mod (should be the same as \"never\" unless I messed up)");
MIU.Console.Instance.Write("");
MIU.Console.Instance.Write(" save Saves the current config");
MIU.Console.Instance.Write(" load Loads the config file");
}
[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];
switch (value)
{
case "never":
Config.Mode = DisplayMode.Never;
return "mode set to: never";
case "diamond":
Config.Mode = DisplayMode.Diamond;
return "mode set to: diamond";
case "gold":
Config.Mode = DisplayMode.Gold;
return "mode set to: gold";
case "always":
Config.Mode = DisplayMode.Always;
return "mode set to: always";
case "hideSilver":
Config.HideSilver = true;
return "Hiding silver time";
case "showSilver":
Config.HideSilver = false;
return "Showing silver time";
case "enable":
Config.Enabled = true;
return "Mod enabled";
case "disable":
Config.Enabled = false;
return "Mod disabled";
case "save":
Config.SaveConfig();
return "Config file saved";
case "load":
Config.ReadConfig();
return "Config file loaded";
default:
printUsage();
return "";
}
}
}
}