public MainForm() { bool create = false; if (!File.Exists("password.db")) { create = true; var f = new NewMasterKeyDialog(); f.ShowDialog(this); f.newKey.Focus(); if (f.newKey.Text.Length == 0) { MessageBox.Show("Empty Master Key"); Environment.Exit(1); } else { Data.SetKey(Encoding.UTF8.GetBytes(f.key)); f.Dispose(); } } InitializeComponent(); Data.InitDatabase(create); }
void ChangeMasterKey(object sender, EventArgs e) { var f = new NewMasterKeyDialog(); f.ShowDialog(this); if (f.key.Length > 0) { Data.ReKey(Encoding.UTF8.GetBytes(f.key)); f.Dispose(); LoadData(); } }