예제 #1
0
        internal NewForm(NewType type, string info = null)
        {
            InitializeComponent();
            Options.ApplyTheme(this);
            _type = type;
            _name = info;

            switch (_type)
            {
            case NewType.Modify:
                btnOk.Text = "Save";
                if (!string.IsNullOrEmpty(info))
                {
                    this.Text = string.Format("Edit account - {0}", info);
                }
                else
                {
                    this.Text = "Add new account...";
                }

                int i = MainForm.Accounts.FindIndex(x => x.Name() == _cryLain.Encrypt(CryLain.ToInsecureString(MainForm.Key), _name));

                if (i > -1)
                {
                    txtName.Text     = _cryLain.Decrypt(CryLain.ToInsecureString(MainForm.Key), MainForm.Accounts[i].Name());
                    txtMail.Text     = _cryLain.Decrypt(CryLain.ToInsecureString(MainForm.Key), MainForm.Accounts[i].Email());
                    txtPassword.Text = _cryLain.Decrypt(CryLain.ToInsecureString(MainForm.Key), MainForm.Accounts[i].Password());
                    txtNote.Text     = _cryLain.Decrypt(CryLain.ToInsecureString(MainForm.Key), MainForm.Accounts[i].Note());
                }

                break;
            }
        }
예제 #2
0
        private void Search()
        {
            if (string.IsNullOrEmpty(txtSearch.Text))
            {
                clearPic.Visible = false;
                LoadAccounts();
            }
            else
            {
                clearPic.Visible = true;
                _term            = txtSearch.Text.Trim().ToLowerInvariant();
                AccountView.Rows.Clear();

                foreach (LainAccount la in Accounts)
                {
                    _temp  = _cryLain.Decrypt(CryLain.ToInsecureString(Key), la.Name());
                    _temp2 = _cryLain.Decrypt(CryLain.ToInsecureString(Key), la.Email());

                    if (_temp.ToLowerInvariant().Contains(_term) || _temp2.ToLowerInvariant().Contains(_term))
                    {
                        AccountView.Rows.Add(new string[] { _cryLain.Decrypt(CryLain.ToInsecureString(Key), la.Name()),
                                                            _cryLain.Decrypt(CryLain.ToInsecureString(Key), la.Email()),
                                                            _cryLain.Decrypt(CryLain.ToInsecureString(Key), la.Password()) });
                    }
                }
            }

            _temp  = string.Empty;
            _temp2 = string.Empty;
        }