mirror of
https://git.lewd.wtf/PGR/ascnet
synced 2025-12-12 22:24:35 +01:00
Merge branch 'master' of https://gitnext.lewd.wtf/PGR/ascnet
This commit is contained in:
@@ -58,14 +58,19 @@ namespace AscNet.GameServer.Commands
|
||||
public class ArgumentAttribute : Attribute
|
||||
{
|
||||
public int Position { get; }
|
||||
public Regex Pattern { get; }
|
||||
public Regex Pattern { get; set; }
|
||||
public string? Description { get; }
|
||||
public ArgumentFlags Flags { get; }
|
||||
|
||||
public ArgumentAttribute(int position, string pattern, string? description = null, ArgumentFlags flags = ArgumentFlags.None)
|
||||
{
|
||||
Position = position;
|
||||
Pattern = new(pattern);
|
||||
|
||||
if ((flags & ArgumentFlags.IgnoreCase) != ArgumentFlags.IgnoreCase)
|
||||
Pattern = new(pattern);
|
||||
else
|
||||
Pattern = new(pattern, RegexOptions.IgnoreCase);
|
||||
|
||||
Description = description;
|
||||
Flags = flags;
|
||||
}
|
||||
@@ -74,7 +79,8 @@ namespace AscNet.GameServer.Commands
|
||||
public enum ArgumentFlags
|
||||
{
|
||||
None = 0,
|
||||
Optional = 1
|
||||
Optional = 1,
|
||||
IgnoreCase = 2
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace AscNet.GameServer.Commands
|
||||
|
||||
public override string Help => "Command to interact with user's items";
|
||||
|
||||
[Argument(0, @"^add$|^clear$|^reset$", "The operation selected (add, clear, reset)")]
|
||||
[Argument(0, @"^add$|^clear$|^reset$", "The operation selected (add, clear, reset)", ArgumentFlags.IgnoreCase)]
|
||||
string Op { get; set; } = string.Empty;
|
||||
|
||||
[Argument(1, @"^[0-9]+$|^all$", "The target item, value is item id or 'all'", ArgumentFlags.Optional)]
|
||||
@@ -22,7 +22,7 @@ namespace AscNet.GameServer.Commands
|
||||
|
||||
public override void Execute()
|
||||
{
|
||||
switch (Op)
|
||||
switch (Op.ToLower())
|
||||
{
|
||||
case "add":
|
||||
if (Target == "all")
|
||||
|
||||
Reference in New Issue
Block a user