Esempio n. 1
0
        private string keygen(KeygenBase platform, KeygenProduct product, int type, string name)
        {
            if (name.Length <= 1)
            {
                MessageBox.Show(companyUserName[type] + " must be longer than one character", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return("");
            }

            if (name.Length > 80)
            {
                MessageBox.Show(companyUserName[type] + " must not be greater than eighty characters", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return("");
            }

            string genlicense = platform.Generate(type, name, product.Licence);

            if (!platform.Check(genlicense, name, product.Licence))
            {
                MessageBox.Show("Generated license did not pass self check, please try again", "Warning",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
            }

            return(genlicense);
        }
Esempio n. 2
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            KeygenBase    platform = (KeygenBase)cbxPlatform.SelectedItem;
            KeygenProduct product  = (KeygenProduct)cbxProduct.SelectedItem;
            int           type     = cbxLicenseType.SelectedIndex;
            string        name     = tbxCompanyUserName.Text;

            tbxLicenseKey.Text = keygen(platform, product, type, name);
        }
Esempio n. 3
0
        public override List <string> GenerateLicencetypes(KeygenProduct p)
        {
            List <string> types = new List <string>();

            for (int i = 0; i < 5; i++)
            {
                types.Add(((char)(i + 'A')).ToString());
            }
            return(types);
        }
Esempio n. 4
0
        public override List <string> GenerateLicencetypes(KeygenProduct p)
        {
            if (p.Licence != LicenseTypes.Mac3812 &&
                p.Licence != LicenseTypes.MacTelnet &&
                p.Licence != LicenseTypes.MacKeyboard)
            {
                return(base.GenerateLicencetypes(p));
            }
            List <string> types = new List <string>();

            types.Add("0");
            return(types);
        }
Esempio n. 5
0
        private void cbxProduct_SelectedIndexChanged(object sender, EventArgs e)
        {
            KeygenBase    platform = (KeygenBase)cbxPlatform.SelectedItem;
            KeygenProduct product  = (KeygenProduct)cbxProduct.SelectedItem;

            cbxLicenseType.Enabled = false;
            cbxLicenseType.Items.Clear();
            var LicenceTypes = platform.GenerateLicencetypes(product);

            foreach (string type in LicenceTypes)
            {
                cbxLicenseType.Items.Add(type);
            }
            cbxLicenseType.Enabled       = true;
            cbxLicenseType.SelectedIndex = 0;
            AcceptButton.PerformClick();
        }