1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

fix issue with registering multiple script commands in command configuration

This commit is contained in:
RaidMax
2020-05-30 14:06:04 -05:00
parent 30a1225f1b
commit 1c515a3759
2 changed files with 24 additions and 2 deletions

View File

@ -0,0 +1,21 @@
using IW4MAdmin.Application.Misc;
using SharedLibraryCore.Interfaces;
using System.Linq;
namespace IW4MAdmin.Application.Extensions
{
public static class CommandExtensions
{
/// <summary>
/// determines the command configuration name for given manager command
/// </summary>
/// <param name="command">command to determine config name for</param>
/// <returns></returns>
public static string CommandConfigNameForType(this IManagerCommand command)
{
return command.GetType() == typeof(ScriptCommand) ?
$"{char.ToUpper(command.Name[0])}{command.Name.Substring(1)}Command" :
command.GetType().Name;
}
}
}