/// <summary>
 /// Try to get the setting for given name / key.
 /// </summary>
 /// <param name="settings">The settings.</param>
 /// <param name="key">The key.</param>
 /// <param name="value">The value.</param>
 /// <returns></returns>
 public static bool TryGetValue(CommandSettingCollection settings, string key, out string value)
 {
     value = null;
     if (settings == null) return false;
     if (!string.IsNullOrWhiteSpace(key))
     {
         key = key.Trim().ToUpper();
     }
     return settings._dictionary.TryGetValue(key, out value);
 }
Пример #2
0
 internal string Execute(ICommand command, CommandParameterCollection args, CommandSettingCollection settings, ICommandContext context)
 {
     if (!ParseArgs(args))
         throw new CommandParameterException("Failed to parse the arguments.", command, args);
     try
     {
         return ExecuteCommand(settings, context);
     }
     catch (Exception e)
     {
         throw new CommandException(command, e);
     }
 }
Пример #3
0
            private string ExecuteCommand(CommandSettingCollection settings, ICommandContext context)
            {
                //Get value from settings collection as needed
                //string connectionString = null;
                //if (!CommandSettingCollection.TryGetValue(settings, "DbConn", out connectionString))
                //    throw new Exception("Unable to get the connection string to the database.");

                StringBuilder sb = new StringBuilder("Hello World!!!");

                if (string.IsNullOrEmpty(_message))
                    _repeatCount = 0;

                while (_repeatCount > 0)
                {
                    sb.AppendLine().Append(_message);
                    _repeatCount--;
                }

                return sb.ToString();
            }
Пример #4
0
 /// <summary>
 /// Method execution logic.
 /// </summary>
 /// <param name="args">The arguments.</param>
 /// <param name="context">The context.</param>
 /// <param name="settings">The settings.</param>
 /// <returns></returns>
 public object Execute(CommandParameterCollection args, CommandSettingCollection settings, ICommandContext context)
 {
     return new CommandProcessor().Execute(this, args, settings, context);
 }