2019-04-12 18:07:45 -04:00
|
|
|
using System;
|
2017-02-16 19:54:23 -06:00
|
|
|
using ACE.Entity.Enum;
|
2017-01-21 17:45:55 +13:00
|
|
|
|
2018-02-08 17:05:02 -06:00
|
|
|
namespace ACE.Server.Command
|
2017-01-21 17:45:55 +13:00
|
|
|
{
|
|
|
|
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
|
|
|
|
|
public class CommandHandlerAttribute : Attribute
|
|
|
|
|
{
|
|
|
|
|
public string Command { get; }
|
2017-04-04 12:44:57 -04:00
|
|
|
|
2017-02-03 05:10:13 +13:00
|
|
|
public AccessLevel Access { get; }
|
2017-04-04 12:44:57 -04:00
|
|
|
|
2017-02-03 05:10:13 +13:00
|
|
|
public CommandHandlerFlag Flags { get; }
|
2017-04-04 12:44:57 -04:00
|
|
|
|
2017-01-21 17:45:55 +13:00
|
|
|
public int ParameterCount { get; }
|
|
|
|
|
|
2017-04-17 21:32:37 -04:00
|
|
|
public string Description { get; }
|
|
|
|
|
|
|
|
|
|
public string Usage { get; }
|
|
|
|
|
|
2019-04-12 18:07:45 -04:00
|
|
|
/// <summary>
|
|
|
|
|
/// include the raw, unparsed command minus the command name as the first parameter
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IncludeRaw { get; }
|
|
|
|
|
|
|
|
|
|
public CommandHandlerAttribute(string command, AccessLevel access, CommandHandlerFlag flags = CommandHandlerFlag.None, bool includeRaw = false, int parameterCount = -1, string description = "", string usage = "")
|
|
|
|
|
{
|
|
|
|
|
Command = command;
|
|
|
|
|
Access = access;
|
|
|
|
|
Flags = flags;
|
|
|
|
|
ParameterCount = parameterCount;
|
|
|
|
|
Description = description;
|
|
|
|
|
Usage = usage;
|
|
|
|
|
IncludeRaw = includeRaw;
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-17 21:32:37 -04:00
|
|
|
public CommandHandlerAttribute(string command, AccessLevel access, CommandHandlerFlag flags = CommandHandlerFlag.None, int parameterCount = -1, string description = "", string usage = "")
|
2017-01-21 17:45:55 +13:00
|
|
|
{
|
|
|
|
|
Command = command;
|
2017-02-03 05:10:13 +13:00
|
|
|
Access = access;
|
|
|
|
|
Flags = flags;
|
2017-01-21 17:45:55 +13:00
|
|
|
ParameterCount = parameterCount;
|
2017-04-17 21:32:37 -04:00
|
|
|
Description = description;
|
|
|
|
|
Usage = usage;
|
2019-04-12 18:07:45 -04:00
|
|
|
IncludeRaw = false;
|
2017-04-17 21:32:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public CommandHandlerAttribute(string command, AccessLevel access, CommandHandlerFlag flags = CommandHandlerFlag.None, string description = "", string usage = "")
|
|
|
|
|
{
|
|
|
|
|
Command = command;
|
|
|
|
|
Access = access;
|
|
|
|
|
Flags = flags;
|
|
|
|
|
ParameterCount = -1;
|
|
|
|
|
Description = description;
|
|
|
|
|
Usage = usage;
|
2019-04-12 18:07:45 -04:00
|
|
|
IncludeRaw = false;
|
2017-04-17 21:32:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public CommandHandlerAttribute(string command, AccessLevel access, CommandHandlerFlag flags = CommandHandlerFlag.None)
|
|
|
|
|
{
|
|
|
|
|
Command = command;
|
|
|
|
|
Access = access;
|
|
|
|
|
Flags = flags;
|
|
|
|
|
ParameterCount = -1;
|
|
|
|
|
Description = "";
|
|
|
|
|
Usage = "";
|
2019-04-12 18:07:45 -04:00
|
|
|
IncludeRaw = false;
|
2017-01-21 17:45:55 +13:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|