public static Morse_matrix operator +(Morse_matrix tbl1, Morse_matrix tbl2) { Morse_matrix res_str_matrix = new Morse_matrix(); for (int i = 0; i < Size1; i++) for (int j = 0; j < Size_2; j++) res_str_matrix[i, j] = tbl1[i, j] + tbl2[i, j]; return res_str_matrix; }
static void Str_matr_crypt() { Console.WriteLine("Beep sos"); string word = "sos"; Morse_matrix code_tbl = new Morse_matrix(); code_tbl.Write_matrix(); string rslt = code_tbl.crypt(word); Console.WriteLine("sos : " + rslt); code_tbl.Res_beep(rslt); }
static void Str_matr_crypt_key() { Console.WriteLine("Beep sos"); string word = "sos"; Console.WriteLine("Please, write key from 1 to 35 :"); int b = int.Parse(Console.ReadLine()); Morse_matrix code_tbl = new Morse_matrix(Alphabet.Dictionary_arr, b); code_tbl.Write_matrix(); string rslt = code_tbl.crypt(word); Console.WriteLine("sos : " + rslt); code_tbl.Res_beep(rslt); Console.WriteLine("From beep to sos"); //Console.WriteLine(rslt.Length); string[] sos = { rslt.Substring(0, 5), rslt.Substring(5, 5), rslt.Substring(10, 5) }; word = code_tbl.decrypt(sos); Console.WriteLine("sos decrypt :" + word); }
static void Str_matr_decrypt() { string word; Morse_matrix code_tbl = new Morse_matrix(); code_tbl.Write_matrix(); Console.WriteLine("From beep to sos"); string[] sos = { "... ", "--- ", "... " }; word = code_tbl.decrypt(sos); Console.WriteLine("sos decrypt :" + word); }
static void Str_matr_comp() { Console.WriteLine("Compare codes"); Console.WriteLine("Please, write key from 1 to 35 :"); int b = int.Parse(Console.ReadLine()); Morse_matrix code_tbl1 = new Morse_matrix(b); Console.WriteLine("Please, write key from 1 to 35 :"); int d = int.Parse(Console.ReadLine()); Morse_matrix code_tbl2 = new Morse_matrix(Alphabet.Dictionary_arr, d); Console.WriteLine("Code 1 "); code_tbl1.Write_matrix(); Console.WriteLine("Code 2 "); code_tbl2.Write_matrix(); if (code_tbl1.Equals(code_tbl2)) Console.WriteLine("True"); else Console.WriteLine("False"); }