Beispiel #1
0
        /// <summary>
        /// AddCommand
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public bool AddCommand(DeviceCommand command)
        {
            bool result = false;

            if (!CommandExists(command))
            {
                Commands.Add(command);
                result = true;
            }

            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// FindCommandByName
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public DeviceCommand FindCommandByName(string name)
        {
            DeviceCommand result = null;

            if (!string.IsNullOrEmpty(name))
            {
                foreach (var command in Commands)
                {
                    if (command.Name.ToLower() == name.ToLower())
                    {
                        result = command;
                        break;
                    }
                }
            }
            else
            {
                MsgLogger.WriteError($"{GetType().Name} - FindCommandByName", $"name not specified!");
            }

            return(result);
        }
Beispiel #3
0
 /// <summary>
 /// CommandExists
 /// </summary>
 /// <param name="command"></param>
 /// <returns></returns>
 public bool CommandExists(DeviceCommand command)
 {
     return(FindCommandByName(command.Name) != null);
 }