Exemplo n.º 1
0
 void BtnImportPasswordClick(object sender, EventArgs e)
 {
     openFileDialog.Filter = "Security Config Files|*.cfg";
     if (openFileDialog.ShowDialog() == DialogResult.OK)
     {
         setUIState(DISABLED);
         string newSecurityFile = openFileDialog.FileName;
         try {
             IniFileManager test        = new IniFileManager(newSecurityFile, KEY, true);
             string         newPassword = test.getEncryptedString("SECURITY", "hcryptpass", "@@@***$$$%%%12345");
             if (newPassword == "@@@***$$$%%%12345")
             {
                 ShowError("The file '" + newSecurityFile + "' does not contain a valid encryption password.");
             }
             _securityConfig.writeEncryptedString("SECURITY", "hcryptpass", newPassword);
             tbPassword.Text = newPassword;
         } catch {
             ShowError("The file '" + newSecurityFile + "' does not appear to be a valid security config file");
         } finally {
             setUIState(ENABLED);
         }
     }
 }
Exemplo n.º 2
0
 void MainFormLoad(object sender, EventArgs e)
 {
     tbPassword.Text = _securityConfig.getEncryptedString("SECURITY", "hcryptpass", "");
 }