fix issue with registering multiple script commands in command configuration
This commit is contained in:
21
Application/Extensions/CommandExtensions.cs
Normal file
21
Application/Extensions/CommandExtensions.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user