예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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>());
        }
예제 #5
0
 public static bool IsPortPresent(this BombInfo bombInfo, Port portType)
 {
     return(bombInfo.IsPortPresent(portType.ToString()));
 }
예제 #6
0
 public static IEnumerable <string[]> GetPortPlates(this BombInfo bombInfo)
 {
     return(GetPortEntries(bombInfo).Select((x) => x.presentPorts));
 }
예제 #7
0
 public static bool IsIndicatorOff(this BombInfo bombInfo, Indicator indicatorLabel)
 {
     return(bombInfo.IsIndicatorOff(indicatorLabel.ToString()));
 }
예제 #8
0
 public static int GetTwoFactorCounts(this BombInfo bombInfo)
 {
     return(GetTwoFactorCodes(bombInfo).Count());
 }
예제 #9
0
 public static IEnumerable <int> GetSerialNumberNumbers(this BombInfo bombInfo)
 {
     return(GetSerialNumber(bombInfo).Where((x) => x >= '0' && x <= '9').Select((y) => int.Parse("" + y)));
 }
예제 #10
0
        public static string GetSerialNumber(this BombInfo bombInfo)
        {
            var ret = GetSerialNumberEntries(bombInfo).FirstOrDefault();

            return(ret == null ? null : ret.serial);
        }
예제 #11
0
 public static IEnumerable <string> GetOffIndicators(this BombInfo bombInfo)
 {
     return(GetIndicatorEntries(bombInfo).Where((x) => !x.IsOn()).Select((x) => x.label));
 }
예제 #12
0
 public static int GetBatteryHolderCount(this BombInfo bombInfo)
 {
     return(GetBatteryEntries(bombInfo).Count());
 }
예제 #13
0
 public static int GetBatteryCount(this BombInfo bombInfo, int batteryType)
 {
     return(GetBatteryEntries(bombInfo).Where((x) => x.numbatteries == batteryType)
            .Sum((x) => x.numbatteries));
 }
예제 #14
0
 public static int GetBatteryCount(this BombInfo bombInfo)
 {
     return(GetBatteryEntries(bombInfo).Sum((x) => x.numbatteries));
 }
예제 #15
0
 public static IEnumerable <string> GetColoredIndicators(this BombInfo bombInfo, IndicatorColor color)
 {
     return(GetColoredIndicators(bombInfo, color.ToString()));
 }
예제 #16
0
 public static IEnumerable <string> GetColoredIndicators(this BombInfo bombInfo, Indicator label)
 {
     return(GetColoredIndicators(bombInfo, null, label.ToString()));
 }
예제 #17
0
 public static bool IsPortPresent(this BombInfo bombInfo, string portType)
 {
     return(GetPortEntries(bombInfo)
            .Any((x) => x.presentPorts != null && x.presentPorts.Any((y) => portType.Equals(y))));
 }
예제 #18
0
 public static bool IsDuplicatePortPresent(this BombInfo bombInfo, string port)
 {
     return(GetPortCount(bombInfo, port) > 1);
 }
예제 #19
0
 public static int GetBatteryHolderCount(this BombInfo bombInfo, Battery batteryType)
 {
     return(GetBatteryHolderCount(bombInfo, (int)batteryType));
 }
예제 #20
0
 public static bool IsIndicatorOff(this BombInfo bombInfo, string indicatorLabel)
 {
     return(GetIndicatorEntries(bombInfo).Any((x) => !x.IsOn() && indicatorLabel.Equals(x.label)));
 }
예제 #21
0
 public static bool IsDuplicatePortPresent(this BombInfo bombInfo, Port port)
 {
     return(IsDuplicatePortPresent(bombInfo, port.ToString()));
 }
예제 #22
0
 public static int GetBatteryHolderCount(this BombInfo bombInfo, int batteryType)
 {
     return(GetBatteryEntries(bombInfo).Count(x => x.numbatteries == batteryType));
 }
예제 #23
0
 public static int GetPortCount(this BombInfo bombInfo)
 {
     return(GetPortEntries(bombInfo).Sum((x) => x.presentPorts.Length));
 }
예제 #24
0
 public static int GetPortCount(this BombInfo bombInfo, Port portType)
 {
     return(bombInfo.GetPortCount(portType.ToString()));
 }
예제 #25
0
 public static IEnumerable <char> GetSerialNumberLetters(this BombInfo bombInfo)
 {
     return(GetSerialNumber(bombInfo).Where((x) => x < '0' || x > '9'));
 }
예제 #26
0
 public static int GetPortCount(this BombInfo bombInfo, string portType)
 {
     return(GetPortEntries(bombInfo).Sum((x) => x.presentPorts.Count((y) => portType.Equals(y))));
 }
예제 #27
0
 public static bool IsTwoFactorPresent(this BombInfo bombInfo)
 {
     return(GetTwoFactorCodes(bombInfo).Any());
 }
예제 #28
0
 public static int GetPortPlateCount(this BombInfo bombInfo)
 {
     return(GetPortEntries(bombInfo).Count());
 }
예제 #29
0
 public static IEnumerable <int> GetTwoFactorCodes(this BombInfo bombInfo)
 {
     return(GetTwoFactorEntries(bombInfo).Select((x) => x.twofactor_key));
 }
예제 #30
0
 public static bool IsIndicatorColorPresent(this BombInfo bombInfo, string indicatorColor)
 {
     return(GetColoredIndicators(bombInfo, indicatorColor).Any());
 }