/
NLObP
/
AAEmu
Обзор
Документация
Войти
/
NLObP
/
AAEmu
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
AAEmu.Game/Utils/Scripts/SubCommands/SubCommandParameterBase.cs
37 строк
1 KB
Roger Barreto
Performance + Refactoring + Code Style (#709)
16 сен 2023, 10:50
Не верифицирован
16 сен 2023, 10:50
0d89a74
Код
Авторство
О чём код?
namespace AAEmu.Game.Utils.Scripts.SubCommands; public abstract class SubCommandParameterBase { public SubCommandParameterBase(string name, string displayName, bool required) { Name = name; IsRequired = required; DisplayName = displayName ?? name; } public string Name { get; protected set; } public string DisplayName { get; protected set; } public bool IsRequired { get; protected set; } public string Prefix { get; protected set; } public abstract string CallExample { get; } /// <summary> /// This value will be used if the parameter is optional and no value was provided. /// </summary> public object DefaultValue { get; set; } protected string GetValueWithoutPrefix(string argumentValue) { if (Prefix is null) { return argumentValue; } return argumentValue.Substring(Prefix.Length + 1); } public bool MatchPrefix(string argument) { if (Prefix is null) return false; return argument.StartsWith(Prefix + "="); } public abstract ParameterResult Load(string argument); }