public SwitchBase FindSwitch(String key) { if (AvailableSwitchesDict.ContainsKey(key)) { return(AvailableSwitchesDict[key]); } return(null); }
public void AddAvailableSwitch(SwitchBase sw) { if (!AvailableSwitchesDict.ContainsKey(sw.UniqueName)) { AvailableSwitchesDict.Add(sw.UniqueName, sw); } else { var collidingSwitch = AvailableSwitchesDict[sw.UniqueName]; ProcessorCompiler.AddError( new ExceptionEntry { Exception = new ArgumentException( $"Switch Name {sw.UniqueName} is not unique ({sw.FullTypeName}) it collides with {collidingSwitch.DisplayName} ({collidingSwitch.FullTypeName}).\r\n" + $"Make sure the UniqueName is unique or search, help and other features wont work correctly!"), Name = $"Switch {sw.UniqueName} is not unique." }); } }