private void Act() { //try //{ if (InputString == null) { return; } switch (SelectedOption) { case CryptionOption.Encrypt: ExportString = EncryptionMachine.EncryptTrithemius(InputString); break; case CryptionOption.Decrypt: ExportString = EncryptionMachine.DecryptTrithemius(InputString); break; } //} //catch (Exception e) //{ // MessageBox.Show("Invalid input data,please try again"); //} }
private void Act() { try { if (InputString == null) { return; } if (EncryptType == EncryptType.Bytes) { if (SelectedOption == CryptionOption.Encrypt) { ExportString = EncryptionMachine.EncryptCesarBytes(InputString); } else if (SelectedOption == CryptionOption.Decrypt) { ExportString = EncryptionMachine.DecryptCesarBytes(InputString); } } else { if (SelectedOption == CryptionOption.Encrypt) { ExportString = EncryptionMachine.EncryptCesar(InputString); } else if (SelectedOption == CryptionOption.Decrypt) { ExportString = EncryptionMachine.DecryptCesar(InputString); } } } catch (Exception e) { MessageBox.Show("Invalid input data,please try again"); } }
//Create new encryption machine and return it. //This is the only way to create an intance of the machine //from outside of this library. public IEncryptionMachine CreateEncryptionMachine() { IEncryptionMachine machine = new EncryptionMachine(); return(machine); }
public string Attack() { return(EncryptionMachine.FindKey(InputString, ExportString)); }
public Lab2ViewModel() { EncryptionMachine = new EncryptionMachine(); }