-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommandManager.cs
67 lines (53 loc) · 1.59 KB
/
CommandManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* Copyright © Kahath 2015
* Licensed under MIT license.
*/
using KNetFramework.Commands.Base;
using KNetFramework.Enums;
using KNetFramework.Managers.Base;
using KNetFramework.Managers.Interface;
using KNetFramework.Network.Session;
using System.Collections.Concurrent;
using System.Collections.Generic;
namespace KNetFramework.Managers.Core
{
public class CommandManager : ManagerBase<CommandManager, ICommandManager>
{
#region Properties
internal BlockingCollection<Command> CommandTable
{
get { return Instance.CommandTable; }
set { Instance.CommandTable = value; }
}
#endregion
#region Events
public event CommandEventHandler BeforeCommandInvoke
{
add { Instance.BeforeCommandInvoke += value; }
remove { Instance.BeforeCommandInvoke -= value; }
}
#endregion
#region Methods
public bool InvokeCommand(Client user, string command)
{
return Instance.InvokeCommand(user, command);
}
internal Command GetCommand(Client user, IList<string> path, Command baseCommand = null, IEnumerable<Command> commandTable = null)
{
return Instance.GetCommand(user, path, baseCommand, commandTable);
}
public CommandValidation ValidateCommand(Command command)
{
return Instance.ValidateCommand(command);
}
public string AvailableSubCommands(Command command, CommandLevel userLevel = CommandLevel.Zero)
{
return Instance.AvailableSubCommands(command, userLevel);
}
public IEnumerable<Command> GetSubCommands(Command command, CommandLevel userLevel = CommandLevel.Zero)
{
return Instance.GetSubCommands(command, userLevel);
}
#endregion
}
}