Beispiel #1
0
            public IEnumerable <string> Validate()
            {
                if (!File.Exists(Path))
                {
                    yield return("Path does not exist.");
                }

                var image = Image.Load(Path);

                if (image.Height < Lights.Count())
                {
                    yield return($"Sequence can't handle more than {image.Height} light(s).");
                }

                if (RepeatCount.HasValue && RepeatSeconds.HasValue)
                {
                    yield return("Repeat count and repeat seconds can't both be specified.");
                }

                if (FramesPerSecond <= 0m || FramesPerSecond > 100m)
                {
                    yield return("FPS must be greater than 0 and less than or equal to 100.");
                }

                foreach (string light in Lights)
                {
                    if (!IPAddress.TryParse(light, out _))
                    {
                        yield return($"{light} is not a valid IP address.");
                    }
                }
            }
Beispiel #2
0
        private IEnumerable <int> Day1(string inData, bool part2 = false)
        {
            // string TestData = ".#.#.#\r\n...##.\r\n#....#\r\n..#...\r\n#.#..#\r\n####..";

            Lights lights = new Lights(inData);

            lights.Update(100, part2);

            yield return(lights.Count());
        }