Esempio n. 1
0
        public void New()
        {
            MDIChildForm form = new MDIChildForm();

            form.Fsize     = this.FontSize;
            form.Ftype     = this.FontSelected;
            form.MdiParent = this;
            form.Show();
        }
Esempio n. 2
0
        private void EditDuplicateEntry_Click(object sender, EventArgs e)
        {
            MDIChildForm x = (MDIChildForm)ActiveMdiChild;

            x.KeyDuplicate();
        }
Esempio n. 3
0
        public void statusStripGroupTotal(Group g)
        {
            MDIChildForm x = (MDIChildForm)ActiveMdiChild;

            statusStripControl1.NumberOfGroups(x.kc.Groups.Count);
        }
Esempio n. 4
0
        private void EditDeleteEntry_Click(object sender, EventArgs e)
        {
            MDIChildForm x = (MDIChildForm)ActiveMdiChild;

            x.GroupDelete();
        }
Esempio n. 5
0
        private void EditAddEntry_Click(object sender, EventArgs e)
        {
            MDIChildForm x = (MDIChildForm)ActiveMdiChild;

            x.KeyAdd();
        }
Esempio n. 6
0
        private void EditEditGroup_Click(object sender, EventArgs e)
        {
            MDIChildForm x = (MDIChildForm)ActiveMdiChild;

            x.GroupEdit();
        }
Esempio n. 7
0
        public void Open()
        {
            OpenFileDialog d = new OpenFileDialog();

            if (d.FileName != null)
            {
                string exe = Assembly.GetExecutingAssembly().Location;
                d.InitialDirectory = Path.GetDirectoryName(exe);
                d.RestoreDirectory = true;
                d.Filter           = "KeyChain Files|*.kcf";
                if (d.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                else
                {
                    PasswordForm p = new PasswordForm();
                    p.local    = File.ReadAllBytes(d.FileName);
                    p.savethis = 2;
                    p.ShowDialog();
                    if (p.DialogResult != DialogResult.OK)
                    {
                        return;
                    }
                    string       pass = p.Password;
                    MDIChildForm form = new MDIChildForm();
                    form.Fsize     = this.FontSize;
                    form.Ftype     = this.FontSelected;
                    form.MdiParent = this;
                    form.Show();


                    DataContractSerializer dcs = new DataContractSerializer(typeof(KeyChain));
                    byte[] ToRead         = File.ReadAllBytes(d.FileName);
                    byte[] decryptedArray = CryptoHelper.Decrypt(ToRead, pass);
                    if (decryptedArray != null)
                    {
                        MemoryStream memoryreadStream = new MemoryStream(decryptedArray);
                        KeyChainManager.KeyChain = (KeyChain)dcs.ReadObject(memoryreadStream);
                        memoryreadStream.Close();
                        form.LoadFile();
                        //foreach (Group g in KeyChainManager.KeyChain.Groups)
                        //{
                        //form.groupTreeControl1.AddTreeNodefromFileLoad(g);
                        //statusStripGroupTotal(g);
                        //}

                        statusStripControl1.StatusBarComboboxClear();
                        KeyChainManager.KeyChain.IsModified = false;
                        Text = d.FileName;
                    }
                    else
                    {
                        form.Close();
                        MessageBox.Show("Wrong Password Entered.  Please try to load File again, select a different file, create a new file, or exit.");
                    }
                }
            }



            statusStripControl1.StatusBarComboboxClear();
            KeyChainManager.KeyChain.IsModified = false;
            Text = d.FileName;
        }