public String GetStatus() { StringBuilder stringBuilder = new(); stringBuilder.AppendLine(StatusLine + "Commands" + StatusLine); foreach (var regularCommand in RegularCommands.OrderBy(x => x.Key.Value).Select(x => x.Value)) { stringBuilder.AppendLine(regularCommand.Name.Value); } stringBuilder.AppendLine(StatusLine + "User Commands" + StatusLine); foreach (var userCommand in UserCommands.OrderBy(x => x.Key.Value).Select(x => x.Value)) { stringBuilder.AppendLine(userCommand.Name.Value); } stringBuilder.AppendLine(StatusLine + "Disabled Settings" + StatusLine); // Disabled settings are first. foreach (var setting in Settings.Disabled.OrderBy(x => x.Name.Value)) { stringBuilder.AppendLine(setting.Name + ": " + setting.Status); } stringBuilder.AppendLine(StatusLine + "Enabled Settings" + StatusLine); foreach (var setting in Settings.Enabled.OrderBy(x => x.Name.Value)) { stringBuilder.AppendLine(setting.Name + ": " + setting.Status); } return(stringBuilder.ToString()); }
public ICommandRepository AddCommand(ICommand command) { Commands.TryAdd(command.Name, command); if (command is ISetting setting) { AddCommand(setting, false); } else { RegularCommands.TryAdd(command.Name, command); } return(this); }