Exemplo n.º 1
0
        public ServiceCommandOutput <object> ExecuteCommand(ClientCommand command)
        {
            if (command == null)
            {
                throw new ArgumentNullException("command");
            }

            if (command.IsValid() == false)
            {
                throw new InvalidDataException("One or more mandatory values missing for command: " + command.Command);
            }

            var dictionary = command.GetAttributeDictionary <JsonPropertyAttribute>("PropertyName");
            var builder    = new StringBuilder();

            builder.Append(dictionary["command"]);
            foreach (var key in dictionary.Keys)
            {
                if (key == "command")
                {
                    continue;
                }
                if (dictionary[key] == null)
                {
                    continue;
                }

                builder.AppendFormat(@" /{0}:{1}", key, dictionary[key]);
            }

            return(ExecuteCommand(builder.ToString()));
        }