qstbak/Questionable/Questionable.Controller.DebugCommands/DebugCommandExecutor.cs
2026-08-17 20:27:25 +10:00

45 lines
1.4 KiB
C#

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, _202E_200E_202A_202D_206B_202D_206D_202B_206F_200E_202E_200F_200E_200E_202D_200C_200B_202C_202A_202B_200C_202C_206F_200C_200E_206B_202D_200F_200D_206E_202D_200F_200D_202E_200F_202D_202A_202C_206B_206C_202E());
}
public bool TryExecute(string command, string[] arguments)
{
IDebugCommandHandler value;
int num = ((!_handlers.TryGetValue(command, out value)) ? (-573165882) : (-573165881));
while (true)
{
int num2 = num;
int num3 = -573165882;
int num4 = num2;
switch ((num4 | num3) - (num4 & num3))
{
case 0:
return false;
case 1:
value.Execute(arguments);
return true;
case 2:
goto IL_0059;
}
continue;
IL_0059:
num = -573165881;
}
}
static StringComparer _202E_200E_202A_202D_206B_202D_206D_202B_206F_200E_202E_200F_200E_200E_202D_200C_200B_202C_202A_202B_200C_202C_206F_200C_200E_206B_202D_200F_200D_206E_202D_200F_200D_202E_200F_202D_202A_202C_206B_206C_202E()
{
return StringComparer.OrdinalIgnoreCase;
}
}