示例#1
0
文件: dS.cs 项目: blerandrudhani/Gr8
        static void Main(string[] args)
        {
            count numero = new count();
            morse morseC = new morse();
            caesar caesarC = new caesar();
             rsa rsa = new rsa();
            faza3 f3= new faza3();

                if (args[0] == "1")
                {
                     Environment.Exit(-1);
                }
                else if (args[1] == "2")
                {
                    if (args[2] == "1") { Console.WriteLine("numri i charactereve : " + numero.countCh(args[0])); }
                    else if (args[2] == "2") { Console.WriteLine("numri i rreshtave : " + numero.countLi(args[0])); }
                    else if (args[2] == "3") { Console.WriteLine("numri i fjaleve : " + numero.countW(args[0])); }
                    else if (args[2] == "4") { Console.WriteLine("numri i fjalive : " + numero.countWo(args[0])); }
                    else if (args[2] == "5") { Console.WriteLine("numri i zanoreve : " + numero.countZan(args[0])); }
                    else if (args[2] == "6") { Console.WriteLine("numri i bashtingelloreve : " + numero.countBash(args[0])); }
                    else if(args[2]=="7") {Console.WriteLine("numri i simboleve : " + numero.countSymb(args[0]));}
                    else { Console.WriteLine("Wrong input !!!"); }
                }
                else if (args[1] == "3")
                {
                    char[] ar = args[0].ToCharArray();
                    string emri = "", VP = "";
                    if (args[2] == "1")
                    {
                        for (int i = 0; i < ar.Length; i++)
                        {
                            emri = emri + morseC.morseEnco(ar[i]);//encode
                            if (ar[i] == ' ')
                            {

                            }
                            else { Console.Beep(); }

                            Console.Write(morseC.morseEnco(ar[i]));


                        }
                        Console.WriteLine("\n");
                    }
                    

                    else if (args[2] == "2")
                    {

                        for (int i = 0; i < ar.Length; i++)//decode
                        {
                            VP = VP + ar[i];

                            if (ar[i] == ' ')
                            {
                                emri = emri + morseC.morseDeco(VP);
                                VP = "";
                            }
                        }
                        Console.WriteLine(emri);
                    }
                    else { Console.WriteLine("Wrong input !!!"); }

                }
                else if (args[1] == "4")
                {
                    
                   
                    if (args[2] == "1") {
                        int k = Convert.ToInt32(args[3]);
                        Console.WriteLine("ciphertext : " + caesarC.caesarCipherEnco(args[0], k)); }
                    else if (args[2] == "2") {
                        int k = Convert.ToInt32(args[3]);
                        Console.WriteLine("plaintext : " + caesarC.caesarCipherDeco(args[0], k)); }
                    else if(args[2]=="3") {caesarC.bruteForce(args[0]);}
                    else { Console.WriteLine("Wrong input !!!"); }

                }
                 else if (args[0] == "create-user")
            {
                rsa.createUser(args[1]);
            }
            else if (args[0] == "delete-user")
            {
                rsa.deleteUser(args[1]);
            }
            else if (args[0] == "import-key")
            {
                rsa.importKey(args[1], args[2]);
            }
            else if (args[0] == "export-key")
            {
                rsa.exportKey(args[1], args[2]);
            }
            else if (args[0] == "write-text")
            {
                rsa.writeText(args[1], args[2],args[3],args[4]);
            }
             else if (args[0] == "read-text")
            {
                rsa.readText(args[1],args[2]);
            }
            else if (args[0] == "login")
            {
                f3.Login(args[1]);
            }
            else if (args[0] == "status")
            {
                Console.WriteLine(f3.status(args[1]));
            }
                else
                {
                    Console.WriteLine("Wrong input !!!");
                }
            
            Console.ReadKey();
        }
示例#2
0
        private void phamacaesarbtn_Click(object sender, EventArgs e)
        {
            caesar c = new caesar();

            richTextBox2.Text = c.giaima(richTextBox1.Text, khoatxt.Text);
        }