public static int CountDuplicatePorts(this BombInfo bombInfo) { List <string> ports = new List <string>(); foreach (var port in GetPorts(bombInfo)) { if (!ports.Contains(port) && IsDuplicatePortPresent(bombInfo, port)) { ports.Add(port); } } return(ports.Count); }
public static int CountUniquePorts(this BombInfo bombInfo) { List <string> ports = new List <string>(); foreach (var port in GetPorts(bombInfo)) { if (!ports.Contains(port)) { ports.Add(port); } } return(ports.Count); }
public static bool IsDuplicatePortPresent(this BombInfo bombInfo) { List <string> ports = new List <string>(); foreach (var port in GetPorts(bombInfo)) { if (!ports.Contains(port)) { ports.Add(port); } else { return(true); } } return(false); }
public static IEnumerable <string> GetColoredIndicators(this BombInfo bombInfo, string color = null, string label = null) { var Colors = new List <string> { "Black", "White", "Blue", "Gray", "Green", "Magenta", "Orange", "Purple", "Red", "Yellow" }; if (color != null) { Colors.RemoveAt(0); Colors.RemoveAt(0); if (color.Equals("Black")) { return(GetOffIndicators(bombInfo)); } if (color.Equals("White")) { //Can't just return OnIndicators as is, due to the fact that would return ALL of them as White, even when some of them are not white. List <string> OnIndicators = new List <string>(GetOnIndicators(bombInfo)); foreach (string c in Colors) { foreach (string indicator in GetColoredIndicators(bombInfo, c)) { OnIndicators.Remove(indicator); } } return(OnIndicators); } return(GetColorIndicatorEntries(bombInfo) .Where((x) => x.color.Equals(color, StringComparison.InvariantCultureIgnoreCase)) .Select((x) => x.label)); } if (label != null) { var colorList = new List <string>(); foreach (var c in Colors) { colorList.AddRange(from i in bombInfo.GetColoredIndicators(c) where label.Equals(i, StringComparison.InvariantCultureIgnoreCase) select c); } return(colorList); } return(new List <string>()); }
public static bool IsPortPresent(this BombInfo bombInfo, Port portType) { return(bombInfo.IsPortPresent(portType.ToString())); }
public static IEnumerable <string[]> GetPortPlates(this BombInfo bombInfo) { return(GetPortEntries(bombInfo).Select((x) => x.presentPorts)); }
public static bool IsIndicatorOff(this BombInfo bombInfo, Indicator indicatorLabel) { return(bombInfo.IsIndicatorOff(indicatorLabel.ToString())); }
public static int GetTwoFactorCounts(this BombInfo bombInfo) { return(GetTwoFactorCodes(bombInfo).Count()); }
public static IEnumerable <int> GetSerialNumberNumbers(this BombInfo bombInfo) { return(GetSerialNumber(bombInfo).Where((x) => x >= '0' && x <= '9').Select((y) => int.Parse("" + y))); }
public static string GetSerialNumber(this BombInfo bombInfo) { var ret = GetSerialNumberEntries(bombInfo).FirstOrDefault(); return(ret == null ? null : ret.serial); }
public static IEnumerable <string> GetOffIndicators(this BombInfo bombInfo) { return(GetIndicatorEntries(bombInfo).Where((x) => !x.IsOn()).Select((x) => x.label)); }
public static int GetBatteryHolderCount(this BombInfo bombInfo) { return(GetBatteryEntries(bombInfo).Count()); }
public static int GetBatteryCount(this BombInfo bombInfo, int batteryType) { return(GetBatteryEntries(bombInfo).Where((x) => x.numbatteries == batteryType) .Sum((x) => x.numbatteries)); }
public static int GetBatteryCount(this BombInfo bombInfo) { return(GetBatteryEntries(bombInfo).Sum((x) => x.numbatteries)); }
public static IEnumerable <string> GetColoredIndicators(this BombInfo bombInfo, IndicatorColor color) { return(GetColoredIndicators(bombInfo, color.ToString())); }
public static IEnumerable <string> GetColoredIndicators(this BombInfo bombInfo, Indicator label) { return(GetColoredIndicators(bombInfo, null, label.ToString())); }
public static bool IsPortPresent(this BombInfo bombInfo, string portType) { return(GetPortEntries(bombInfo) .Any((x) => x.presentPorts != null && x.presentPorts.Any((y) => portType.Equals(y)))); }
public static bool IsDuplicatePortPresent(this BombInfo bombInfo, string port) { return(GetPortCount(bombInfo, port) > 1); }
public static int GetBatteryHolderCount(this BombInfo bombInfo, Battery batteryType) { return(GetBatteryHolderCount(bombInfo, (int)batteryType)); }
public static bool IsIndicatorOff(this BombInfo bombInfo, string indicatorLabel) { return(GetIndicatorEntries(bombInfo).Any((x) => !x.IsOn() && indicatorLabel.Equals(x.label))); }
public static bool IsDuplicatePortPresent(this BombInfo bombInfo, Port port) { return(IsDuplicatePortPresent(bombInfo, port.ToString())); }
public static int GetBatteryHolderCount(this BombInfo bombInfo, int batteryType) { return(GetBatteryEntries(bombInfo).Count(x => x.numbatteries == batteryType)); }
public static int GetPortCount(this BombInfo bombInfo) { return(GetPortEntries(bombInfo).Sum((x) => x.presentPorts.Length)); }
public static int GetPortCount(this BombInfo bombInfo, Port portType) { return(bombInfo.GetPortCount(portType.ToString())); }
public static IEnumerable <char> GetSerialNumberLetters(this BombInfo bombInfo) { return(GetSerialNumber(bombInfo).Where((x) => x < '0' || x > '9')); }
public static int GetPortCount(this BombInfo bombInfo, string portType) { return(GetPortEntries(bombInfo).Sum((x) => x.presentPorts.Count((y) => portType.Equals(y)))); }
public static bool IsTwoFactorPresent(this BombInfo bombInfo) { return(GetTwoFactorCodes(bombInfo).Any()); }
public static int GetPortPlateCount(this BombInfo bombInfo) { return(GetPortEntries(bombInfo).Count()); }
public static IEnumerable <int> GetTwoFactorCodes(this BombInfo bombInfo) { return(GetTwoFactorEntries(bombInfo).Select((x) => x.twofactor_key)); }
public static bool IsIndicatorColorPresent(this BombInfo bombInfo, string indicatorColor) { return(GetColoredIndicators(bombInfo, indicatorColor).Any()); }