コード例 #1
0
        static void Str_matr_comp()
        {
            Console.WriteLine("Compare codes");

            Console.WriteLine("Please, write key from 1 to 35 :");
            int         b         = int.Parse(Console.ReadLine());
            MorseMatrix code_tbl1 = new MorseMatrix(b);

            Console.WriteLine("Please, write key from 1 to 35 :");
            int         d         = int.Parse(Console.ReadLine());
            MorseMatrix code_tbl2 = new MorseMatrix(Alphabet.Dictionary_arr, d);

            Console.WriteLine("Code 1 ");
            code_tbl1.WriteMatrix();
            Console.WriteLine("Code 2 ");
            code_tbl2.WriteMatrix();

            if (code_tbl1.Equals(code_tbl2))
            {
                Console.WriteLine("True");
            }
            else
            {
                Console.WriteLine("False");
            }
        }
コード例 #2
0
        static void Str_matr_decrypt()
        {
            string      word;
            MorseMatrix code_tbl = new MorseMatrix();

            code_tbl.WriteMatrix();
            Console.WriteLine("From beep to sos");
            string[] sos = { "...  ", "---  ", "...  " };
            word = code_tbl.decrypt(sos);
            Console.WriteLine("sos decrypt   :" + word);
        }
コード例 #3
0
        static void Str_matr_crypt()
        {
            Console.WriteLine("Beep sos");
            string      word     = "sos";
            MorseMatrix code_tbl = new MorseMatrix();

            code_tbl.WriteMatrix();
            string rslt = code_tbl.crypt(word);

            Console.WriteLine("sos : " + rslt);
            code_tbl.ResBeep(rslt);
        }
コード例 #4
0
        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());
            MorseMatrix code_tbl = new MorseMatrix(Alphabet.Dictionary_arr, b);

            code_tbl.WriteMatrix();
            string rslt = code_tbl.crypt(word);

            Console.WriteLine("sos : " + rslt);
            code_tbl.ResBeep(rslt);

            Console.WriteLine("From beep to sos");
            string[] sos = { rslt.Substring(0, 5), rslt.Substring(5, 5), rslt.Substring(10, 5) };
            word = code_tbl.decrypt(sos);
            Console.WriteLine("sos decrypt   :" + word);
        }