Esempio n. 1
0
 private string DecodeS(string code, string encodedMessage)
 {
     if (code == "B")
     {
         Base64 B = new Base64();
         return(B.Decode(encodedMessage));
     }
     else if (code == "R")
     {
         ROT13 ROT = new ROT13();
         return(ROT.Decode(encodedMessage));
     }
     else if (code == "T")
     {
         ROT18 ROT = new ROT18();
         return(ROT.Decode(encodedMessage));
     }
     else if (code == "C")
     {
         Caesar c = new Caesar();
         return(c.Decode(encodedMessage));
     }
     else
     {
         return("Error");
     }
 }
Esempio n. 2
0
        private CipherStrModel FindCipherStr(int s)
        {
            CipherStrModel cipherStrModel = new CipherStrModel();

            switch (s)
            {
            case 1:
                Base64 base64 = new Base64();
                cipherStrModel.Decode  = base64.Decode;
                cipherStrModel.Encode  = base64.Encode;
                cipherStrModel.GetCode = base64.GetCode;
                return(cipherStrModel);

            case 2:
                Caesar caesar = new Caesar();
                cipherStrModel.Decode  = caesar.Decode;
                cipherStrModel.Encode  = caesar.Encode;
                cipherStrModel.GetCode = caesar.GetCode;
                return(cipherStrModel);

            case 3:
                ROT13 ROT13 = new ROT13();
                cipherStrModel.Decode  = ROT13.Decode;
                cipherStrModel.Encode  = ROT13.Encode;
                cipherStrModel.GetCode = ROT13.GetCode;
                return(cipherStrModel);

            case 4:
                ROT18 ROT18 = new ROT18();
                cipherStrModel.Decode  = ROT18.Decode;
                cipherStrModel.Encode  = ROT18.Encode;
                cipherStrModel.GetCode = ROT18.GetCode;
                return(cipherStrModel);

            default:
                Base64 base6 = new Base64();
                cipherStrModel.Decode  = base6.Decode;
                cipherStrModel.Encode  = base6.Encode;
                cipherStrModel.GetCode = base6.GetCode;
                return(cipherStrModel);
            }
        }