Inheritance: System.Windows.Forms.Form
Beispiel #1
0
        private void OnClickKeyFileCreate(object sender, EventArgs e)
        {
            SaveFileDialogEx sfd = UIUtil.CreateSaveFileDialog(KPRes.KeyFileCreate,
                                                               UrlUtil.StripExtension(UrlUtil.GetFileName(m_ioInfo.Path)) + "." +
                                                               AppDefs.FileExtension.KeyFile, UIUtil.CreateFileTypeFilter("key",
                                                                                                                          KPRes.KeyFiles, true), 1, "key", AppDefs.FileDialogContext.KeyFile);

            if (sfd.ShowDialog() == DialogResult.OK)
            {
                EntropyForm dlg = new EntropyForm();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    byte[] pbAdditionalEntropy = dlg.GeneratedEntropy;

                    try
                    {
                        KcpKeyFile.Create(sfd.FileName, pbAdditionalEntropy);

                        string str = sfd.FileName;
                        m_cmbKeyFile.Items.Add(str);
                        m_cmbKeyFile.SelectedIndex = m_cmbKeyFile.Items.Count - 1;
                    }
                    catch (Exception exKC)
                    {
                        MessageService.ShowWarning(exKC);
                    }
                }
                UIUtil.DestroyForm(dlg);
            }

            EnableUserControls();
        }
        private string CreateKeyFile()
        {
            byte[] pbEntropy = null;
            if (m_cbNewEntropy.Checked)
            {
                EntropyForm dlg = new EntropyForm();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    pbEntropy = dlg.GeneratedEntropy;
                }
                UIUtil.DestroyForm(dlg);

                if (pbEntropy == null)
                {
                    return(null);
                }
            }

            string strFilePath = GetKeyFilePath();

            if (string.IsNullOrEmpty(strFilePath))
            {
                return(null);
            }

            KcpKeyFile.Create(strFilePath, pbEntropy, m_vNewFormat[
                                  m_cmbNewFormat.SelectedIndex].Version);
            return(strFilePath);
        }
Beispiel #3
0
		public static byte[] CollectEntropyIfEnabled(PwProfile pp)
		{
			if(pp.CollectUserEntropy == false) return null;

			EntropyForm ef = new EntropyForm();
			if(ef.ShowDialog() == DialogResult.OK)
				return ef.GeneratedEntropy;

			return null;
		}
Beispiel #4
0
        public static byte[] CollectEntropyIfEnabled(PwProfile pp)
        {
            if(!pp.CollectUserEntropy) return null;

            EntropyForm ef = new EntropyForm();
            if(UIUtil.ShowDialogNotValue(ef, DialogResult.OK)) return null;

            byte[] pbGen = ef.GeneratedEntropy;
            UIUtil.DestroyForm(ef);
            return pbGen;
        }
Beispiel #5
0
        public static byte[] CollectEntropyIfEnabled(PwProfile pp)
        {
            if (pp.CollectUserEntropy == false)
            {
                return(null);
            }

            EntropyForm ef = new EntropyForm();

            if (ef.ShowDialog() == DialogResult.OK)
            {
                return(ef.GeneratedEntropy);
            }

            return(null);
        }
        public static byte[] CollectEntropyIfEnabled(PwProfile pp)
        {
            if (!pp.CollectUserEntropy)
            {
                return(null);
            }

            EntropyForm ef = new EntropyForm();

            if (UIUtil.ShowDialogNotValue(ef, DialogResult.OK))
            {
                return(null);
            }

            byte[] pbGen = ef.GeneratedEntropy;
            UIUtil.DestroyForm(ef);
            return(pbGen);
        }
Beispiel #7
0
        private void OnClickKeyFileCreate(object sender, EventArgs e)
        {
            SaveFileDialogEx sfd = UIUtil.CreateSaveFileDialog(KPRes.KeyFileCreate,
                UrlUtil.StripExtension(UrlUtil.GetFileName(m_ioInfo.Path)) + "." +
                AppDefs.FileExtension.KeyFile, UIUtil.CreateFileTypeFilter("key",
                KPRes.KeyFiles, true), 1, "key", AppDefs.FileDialogContext.KeyFile);

            if(sfd.ShowDialog() == DialogResult.OK)
            {
                EntropyForm dlg = new EntropyForm();
                if(dlg.ShowDialog() == DialogResult.OK)
                {
                    byte[] pbAdditionalEntropy = dlg.GeneratedEntropy;

                    try
                    {
                        KcpKeyFile.Create(sfd.FileName, pbAdditionalEntropy);

                        string str = sfd.FileName;
                        m_cmbKeyFile.Items.Add(str);
                        m_cmbKeyFile.SelectedIndex = m_cmbKeyFile.Items.Count - 1;
                    }
                    catch(Exception exKC)
                    {
                        MessageService.ShowWarning(exKC);
                    }
                }
                UIUtil.DestroyForm(dlg);
            }

            EnableUserControls();
        }