static void day6(int part = 1) { StreamReader file = new StreamReader(@"6.txt"); string line; Day6 day6 = new Day6(); while ((line = file.ReadLine()) != null) { var sarray = line.Split(" ".ToArray <char>()); string coord1 = sarray[sarray.Length - 3]; var c1 = coord1.Split(','); string coord2 = sarray[sarray.Length - 1]; var c2 = coord2.Split(','); if (part == 1) { if (sarray[0] == "toggle") { Console.WriteLine($"Toggle: {coord1},{coord2}"); day6.toggle(Int32.Parse(c1[0]), Int32.Parse(c1[1]), Int32.Parse(c2[0]), Int32.Parse(c2[1])); } else if (sarray[1] == "on") { Console.WriteLine($"Turn On: {coord1},{coord2}"); day6.turnon(Int32.Parse(c1[0]), Int32.Parse(c1[1]), Int32.Parse(c2[0]), Int32.Parse(c2[1])); } else if (sarray[1] == "off") { Console.WriteLine($"Turn Off: {coord1},{coord2}"); day6.turnoff(Int32.Parse(c1[0]), Int32.Parse(c1[1]), Int32.Parse(c2[0]), Int32.Parse(c2[1])); } System.Console.WriteLine(day6.counton()); } else { if (sarray[0] == "toggle") { Console.WriteLine($"Toggle: {coord1},{coord2}"); day6.increaseBrightness(Int32.Parse(c1[0]), Int32.Parse(c1[1]), Int32.Parse(c2[0]), Int32.Parse(c2[1])); day6.increaseBrightness(Int32.Parse(c1[0]), Int32.Parse(c1[1]), Int32.Parse(c2[0]), Int32.Parse(c2[1])); } else if (sarray[1] == "on") { Console.WriteLine($"Turn On: {coord1},{coord2}"); day6.increaseBrightness(Int32.Parse(c1[0]), Int32.Parse(c1[1]), Int32.Parse(c2[0]), Int32.Parse(c2[1])); } else if (sarray[1] == "off") { Console.WriteLine($"Turn Off: {coord1},{coord2}"); day6.decreaseBrightness(Int32.Parse(c1[0]), Int32.Parse(c1[1]), Int32.Parse(c2[0]), Int32.Parse(c2[1])); } System.Console.WriteLine(day6.countBrightness()); } } }