public static IEnumerable <Day16.Packet> Packets(this string data) { var bits = new Day16.BitReader(data); var packet = new Day16.Packet(bits); return(packet.Packets()); }
public static IEnumerable <Day16.Packet> Packets(this Day16.Packet packet) { foreach (var p in packet.SubPackets) { foreach (var sp in p.Packets()) { yield return(sp); } } yield return(packet); }