private void EncryptText(object sender, RoutedEventArgs e)
 {
     try
     {
         if (decryptedText.Text.Trim().Length == 0)
         {
             MessageBox.Show("Please, fill in the (decrypted text) field. It is empty(");
         }
         else if (codePhrase.Text.Trim().Length == 0)
         {
             MessageBox.Show("Please, fill in the (code phrase) field. It is empty(");
         }
         else
         {
             VigenereCipher cipher      = new VigenereCipher();
             var            encryptText = cipher.Encrypt(decryptedText.Text, codePhrase.Text);
             encryptedText.Text = encryptText;
         }
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
         MessageBox.Show("Something went wrong. Don't worry, you can try touch me again :-)");
     }
 }
示例#2
0
文件: Startup.cs 项目: KakEnot/CP
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            var cipher = new VigenereCipher(DocumentService.PArseWordX().ToLower(), "скорпион"); //.Replace("!","").Replace("#", "").Replace(".", "").Replace(",", "")
            var s      = cipher.Decrypt();


            app.Run(async(context) =>
            {
                await context.Response.WriteAsync(DocumentService.DefaultToUTF(s));
            });
        }