예제 #1
0
 public bool ParseArgument(string value, out object result)
 {
     return(ConsoleCommandsParametersHelper.ParseArgument(
                value,
                this.parameterInfo.ParameterInfo.ParameterType,
                out result));
 }
예제 #2
0
        public IEnumerable <string> GetSuggestions(string startsWith)
        {
            if (this.customSuggestionsAttribute is not null)
            {
                return(this.customSuggestionsAttribute
                       .GetSuggestions(this.parameterInfo.ParameterInfo.Member.DeclaringType,
                                       startsWith));
            }

            return(ConsoleCommandsParametersHelper.GetSuggestions(
                       startsWith,
                       this.parameterInfo.ParameterInfo.ParameterType));
        }
예제 #3
0
        private string CreateName()
        {
            var info          = this.parameterInfo.ParameterInfo;
            var isOptional    = this.hasCurrentCharacterAttribute || info.HasDefaultValue;
            var stringBuilder = new StringBuilder(255);

            stringBuilder.Append(isOptional ? '[' : '<');
            stringBuilder.Append(
                ConsoleCommandsParametersHelper.GetParameterDescription(
                    info.ParameterType,
                    info.Name));
            stringBuilder.Append(isOptional ? ']' : '>');
            return(stringBuilder.ToString());
        }
 protected override void PrepareProto()
 {
     base.PrepareProto();
     ConsoleCommandsParametersHelper.Register(this);
 }