muffin v7.38.8
This commit is contained in:
parent
5e2d8f648b
commit
3e10cbbbf2
51 changed files with 2585 additions and 1972 deletions
|
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Questionable.Controller.DebugCommands;
|
||||
|
||||
internal sealed class DebugCommandExecutor
|
||||
{
|
||||
private readonly Dictionary<string, IDebugCommandHandler> _handlers;
|
||||
|
||||
public DebugCommandExecutor(IEnumerable<IDebugCommandHandler> handlers)
|
||||
{
|
||||
_handlers = handlers.ToDictionary<IDebugCommandHandler, string>((IDebugCommandHandler h) => h.CommandName, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public bool TryExecute(string command, string[] arguments)
|
||||
{
|
||||
if (_handlers.TryGetValue(command, out IDebugCommandHandler value))
|
||||
{
|
||||
value.Execute(arguments);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue