示例#1
0
        public void InsertPlugCable(PlugCable plugCable)
        {
            if (KeyAlreadyUsedByPlugCable(plugCable))
            {
                throw new PlugboardConfigurationException("Key already specified in existing configuration.");
            }

            PlugCableConfiguration.Add(plugCable);
        }
示例#2
0
        private bool KeyAlreadyUsedByPlugCable(PlugCable plugCable)
        {
            var newPlugCable = new Key[] { plugCable.PlugA, plugCable.PlugB };

            return(PlugCableConfiguration.Any(x => newPlugCable.Contains(x.PlugA) || newPlugCable.Contains(x.PlugB)));
        }
示例#3
0
 public void RemovePlugCable(PlugCable plugCable)
 {
     PlugCableConfiguration.Remove(plugCable);
 }