protected ReflectionConsoleCommandBase(string name, Console console, IConsoleCommandHost commandHost)
     : base(commandHost.Name + "." + name)
 {
     Console = console;
     CommandHost = commandHost;
     Execute = x => InvokeCommand(x.Skip(1).ToArray());
     CommandHostType = CommandHost.GetType();
 }
Esempio n. 2
0
            public SliderParams(IConsoleCommandHost commandHost, string[] arguments)
            {
                string propertyName = arguments[0];
                PropertyToControl = commandHost.GetType().GetProperty(propertyName);
                if (PropertyToControl == null)
                {
                    throw new ArgumentException("Property not found");
                }

                if (arguments.Length > 2)
                {
                    try
                    {
                        Minimum = float.Parse(arguments[1]);
                        Maximum = float.Parse(arguments[2]);
                    }
                    catch (Exception ex)
                    {
                        throw new ArgumentException("Minimum or Maximum not a valid float", ex);
                    }
                }

                if (arguments.Length > 3)
                {
                    AutoCall = commandHost.GetType().GetMethod(arguments[3]);

                    if (AutoCall == null)
                    {
                        throw new ArgumentException("AutoCall Method not found");
                    }
                }
            }