using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Cabrito { [AttributeUsage(AttributeTargets.All)] public abstract class ConsoleBaseAttribute : Attribute { internal string name; // Additional aliases for this command, these should only be used with user interaction. // Commands such as 'cvarlist' should not list these in order to avoid clutter. internal string[] aliases = new string[0]; public ConsoleFlags flags { get; private set; } public ConsoleBaseAttribute(string name) { this.name = name.ToLowerInvariant(); } public ConsoleBaseAttribute(params string[] names) { this.name = names[0].ToLowerInvariant(); aliases = new List(names).Skip(1).Select(x => x.ToLowerInvariant()).ToArray(); } } [AttributeUsage(AttributeTargets.All)] public class ConsoleVariableAttribute : ConsoleBaseAttribute { public ConsoleVariableAttribute(string name) : base(name) { } } [AttributeUsage(AttributeTargets.All)] public class ConsoleCommandAttribute : ConsoleBaseAttribute { /// /// Registers a command to Console system. /// /// Name used for calling this command. public ConsoleCommandAttribute(string name) : base(name) { } /// /// Registers a command to Console system. /// /// Names used for calling this command. First name is the main name for this command, rest of the names are aliases. public ConsoleCommandAttribute(params string[] names) : base(names) { } } /// /// Constructor for the subsystem, must be called first before registering console commands. /// [AttributeUsage(AttributeTargets.All)] public class ConsoleSubsystemInitializer : Attribute { } }