diff --git a/ConsoleCommands.cs b/ConsoleCommands.cs new file mode 100644 index 0000000..3a61c8b --- /dev/null +++ b/ConsoleCommands.cs @@ -0,0 +1,67 @@ +using MIU; +using System; + +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(" enabled Enable the mod"); + MIU.Console.Instance.Write(" disabled Disable the mod entirely"); + 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 "enabled": + Config.Enabled = true; + return "Mod enabled"; + case "disabled": + 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 ""; + } + } + } +}