0
Well the goal is simple: assign the value of textBoxKey of password class in String keySimetric of class Acecrypt. But I don’t know how to receive and cast :(
Class of password entry form.
public partial class Senha : Form
{
string key;
public Senha()
{
InitializeComponent();
}
private void btn_enviarKey_Click(object sender, EventArgs e)
{
key = textBoxKey.Text;
this.Close();
}
}
Class of the Main form.
public partial class ACEcrypt : Form
{
string chaveSimetrica;
public ACEcrypt()
{
InitializeComponent();
}
private void btn_criptografar_Click(object sender, EventArgs e)
{
if (openFileCrypt.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
exibirCaminho.Text = openFileCrypt.FileName;
//Input do Arquivo ou Pasta
string streamPath = exibirCaminho.Text;
FileStream inStream = File.OpenRead(openFileCrypt.FileName);
//FileStream outStream = File.OpenWrite(openFileCrypt.FileName + ".ace");
// int b;
//while ((b = inStream.ReadByte()) > -1)
// outStream.WriteByte((byte)b);
//outStream.Flush();
//outStream.Close();
inStream.Close();
Senha ISCrypt = new Senha();
ISCrypt.ShowDialog();
ISCrypt.FormClosing += new FormClosingEventHandler(ISCrypt_FormClosing);
//Para teste
//MessageBox.Show(chaveSimetrica);
}
}
void ISCrypt_FormClosing(object sender, FormClosingEventArgs e)
{
if ((sender as Senha).textData != null)
chaveSimetrica = (string)(sender as Senha).textData;
}
private void btn_descriptografar_Click(object sender, EventArgs e)
{
if (openFileDecrypt.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
exibirCaminho.Text = openFileDecrypt.FileName;
}
}
}
Thank you very much! It worked perfectly!
– paccamicio