public Decoder(string BinMsgContrBit, string ContrValues) { Console.WriteLine(); Console.WriteLine(BinMsgContrBit); Coder coder = new Coder(); coder.CreateMatrixOfX(BinMsgContrBit); string Values = coder.GetContrValues; Console.WriteLine(Values); if (Values == ContrValues) { Console.WriteLine("ошибок нет"); } else { BinMsgContrBit = FindFixError(BinMsgContrBit, ContrValues, Values); } BinToChar(BinMsgContrBit); }
static void Main() { Console.WriteLine("вуберите режим: code(кодировать), decode(декодировать), debug(отладка)"); string mode = Console.ReadLine(); if (mode == "code") { Console.WriteLine("Введите сообщение"); string Message = Console.ReadLine(); string BinaryMessage = StringToBinary(Message); Coder coder = new Coder(BinaryMessage); Console.WriteLine("закодированное сообщение: {0}", coder.GetMessage); Console.WriteLine("контрольные значения: {0}", coder.GetContrValues); } else if (mode == "decode") { Console.Write("Введите закодированное сообщение: "); string BinMsgContrBit = Console.ReadLine(); Console.Write("Введите контрольные значения: "); string ContrValues = Console.ReadLine(); Decoder decoder = new Decoder(BinMsgContrBit, ContrValues); } else if (mode == "debug") { Console.WriteLine("Введите сообщение"); string Message = Console.ReadLine(); string BinaryMessage = StringToBinary(Message); Coder coder = new Coder(BinaryMessage); SendErrorMessage(coder); } else { Console.WriteLine("Неверно введен режим работы"); } Console.ReadKey(); }