Beispiel #1
0
 private void 打开钱包数据库OToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (OpenWalletDialog dialog = new OpenWalletDialog())
     {
         if (dialog.ShowDialog() != DialogResult.OK)
         {
             return;
         }
         if (UserWallet.GetVersion(dialog.WalletPath) < Version.Parse("1.3.5"))
         {
             if (MessageBox.Show(Strings.MigrateWalletMessage, Strings.MigrateWalletCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) != DialogResult.Yes)
             {
                 return;
             }
             string path_old = Path.ChangeExtension(dialog.WalletPath, ".old.db3");
             string path_new = Path.ChangeExtension(dialog.WalletPath, ".new.db3");
             UserWallet.Migrate(dialog.WalletPath, path_new);
             File.Move(dialog.WalletPath, path_old);
             File.Move(path_new, dialog.WalletPath);
             MessageBox.Show($"{Strings.MigrateWalletSucceedMessage}\n{path_old}");
         }
         UserWallet wallet;
         try
         {
             wallet = UserWallet.Open(dialog.WalletPath, dialog.Password);
         }
         catch (CryptographicException)
         {
             MessageBox.Show(Strings.PasswordIncorrect);
             return;
         }
         if (dialog.RepairMode)
         {
             wallet.Rebuild();
         }
         ChangeWallet(wallet);
         Settings.Default.LastWalletPath = dialog.WalletPath;
         Settings.Default.Save();
     }
 }
Beispiel #2
0
 private void openWalletToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (OpenWalletDialog dialog = new OpenWalletDialog())
     {
         if (dialog.ShowDialog() != DialogResult.OK)
         {
             return;
         }
         UserWallet wallet;
         try
         {
             wallet = UserWallet.Open(dialog.WalletPath, dialog.Password);
         }
         catch (CryptographicException)
         {
             MessageBox.Show(Strings.PasswordIncorrect);
             return;
         }
         //if (dialog.RepairMode) wallet.Rebuild();
         ChangeWallet(wallet);
         Settings.Default.LastWalletPath = dialog.WalletPath;
         Settings.Default.Save();
     }
 }