Exemplo n.º 1
0
 private void btn_enter_Click(object sender, EventArgs e)
 {
     try
     {
         using (StreamReader sr = new StreamReader(Application.StartupPath + @"\Config.opm"))
         {
             var key             = "4622c3067f0d4b8c903717443ca0b4ee";
             var decryptedString = AesOperation.DecryptString(key, sr.ReadLine());
             if (txt_pwd.Text == decryptedString)
             {
                 Frm_Main main = new Frm_Main();
                 main.master_pass = decryptedString;
                 main.Show();
                 this.Hide();
             }
             else
             {
                 MessageBox.Show("Login Failed!");
             }
             sr.Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 2
0
 private void btn_create_Click(object sender, EventArgs e)
 {
     try
     {
         using (StreamWriter sw = File.AppendText(Application.StartupPath + @"\Config.opm"))
         {
             var key             = "4622c3067f0d4b8c903717443ca0b4ee";
             var encryptedString = AesOperation.EncryptString(key, txt_createpwd.Text);
             sw.WriteLine(encryptedString);
             sw.Flush();
             sw.Close();
         }
     }
     catch
     {
     }
     finally
     {
         Frm_Main main = new Frm_Main();
         main.Show();
         this.Hide();
     }
 }