Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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();
            }
        }