Пример #1
0
        static void Main(string[] args)
        {
            Dictionary <string, string> patterns = new Dictionary <string, string>()
            {
                { "A", ".*.*.*****.**.*" },
                { "B", "**.*.***.*.***." },
                { "C", ".*.*.**..*.*.*." },
                { "D", "**.*.**.**.***." },
                { "E", "****..**.*..***" },
                { "F", "****..**.*..*.." }
            };

            var codec = new Codec(patterns);

            StreamReader input = new StreamReader("in.txt");
            var          line  = "";
            var          lines = new List <String>();

            while ((line = input.ReadLine()) != null)
            {
                lines.Add(line);
            }

            var msg = lines;
            int i   = 1;

            while (codec.Decodable(msg))
            {
                Console.WriteLine(String.Format("Decoding, it. {0}, len = {1} lines", i, msg.Count));
                msg = codec.DecodeMessage(msg);
                i++;
            }
            foreach (var item in msg)
            {
                Console.WriteLine(item);
            }

            Console.ReadKey();
        }