private void DecryptText(object sender, RoutedEventArgs e) { try { if (encryptedText.Text.Trim().Length == 0) { MessageBox.Show("Please, fill in the (encrypted 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 decryptText = cipher.Decrypt(encryptedText.Text, codePhrase.Text); decryptedText.Text = decryptText; } } catch (Exception exception) { Console.WriteLine(exception); MessageBox.Show("Something went wrong. Don't worry, you can try touch me again :-)"); } }
// 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)); }); }