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); }
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); }
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); }
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); }
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(); }