Exemplo n.º 1
0
        /// <summary>
        /// Remove the specified switch from the actuator. Also
        /// remove it from the settings file and save the file
        /// </summary>
        /// <param name="actuator">Actuator</param>
        /// <param name="switchName">switch to remove</param>
        /// <returns>true on success</returns>
        public bool RemoveSwitch(IActuator actuator, String switchName)
        {
            var actuatorSetting = Config.Find(actuator.Descriptor.Id);

            if (actuatorSetting == null)
            {
                return(false);
            }

            var sw = actuatorSetting.Find(switchName);

            if (sw == null)
            {
                return(false);
            }

            bool retVal = actuator.RemoveSwitch(switchName);

            actuatorSetting.SwitchSettings.Remove(sw);
            Config.Save();

            return(retVal);
        }