Exemple #1
0
        public static string GetProductKey(int id)
        {
            ProductKey productKey = new ProductKey();
            var        product    = productKey.Single(where : "Id = @0", args: id);

            return(Security.Decrypt(product.Key, User.GetPassword()));
        }
Exemple #2
0
        private void Import_Click(object sender, EventArgs e)
        {
            bool continueImport = true;

            if (!User.UserCheck())
            {
                Password password = new Password {
                    IsLogin = false
                };
                continueImport = (password.ShowDialog() == System.Windows.Forms.DialogResult.OK);
            }

            if (continueImport)
            {
                if (OpenFile.ShowDialog() != DialogResult.Cancel)
                {
                    ImportKeyFile.Import(OpenFile.FileName, User.GetPassword());
                    LoadProducts();
                }
            }
        }
Exemple #3
0
        private void Ok_Click(object sender, EventArgs e)
        {
            if (!IsLogin)
            {
                User.SetPassword(passwordText.Text);
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }

            if (IsLogin)
            {
                if (Security.VerifyHash(passwordText.Text, Security.HashAlgorithm.SHA384, User.GetPassword()))
                {
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                }
                else
                {
                    this.DialogResult = System.Windows.Forms.DialogResult.No;
                }
            }
        }