private void btnGenerateLicense_Click(object sender, EventArgs e) { var newLicense = License.FromTemplate(_templateJson); newLicense.Specification.IssueDate = DateTimeOffset.Now; newLicense.Specification.Customer = tbCustomer.Text; newLicense.Specification.SKUCode = tbSKU.Text; _gen.Authorize(newLicense); var fd = new SaveFileDialog { AddExtension = true, DefaultExt = "license", Filter = "License Files (*.license)|*.license", FilterIndex = 1 }; if (fd.ShowDialog() == DialogResult.OK) { newLicense.Save(fd.FileName); } }
private void btnValidateLicense_Click(object sender, EventArgs e) { var fd = new OpenFileDialog { AddExtension = true, DefaultExt = "license", Filter = "License Files (*.license)|*.license", FilterIndex = 1 }; if (fd.ShowDialog() == DialogResult.OK) { var valLicense = License.Load(fd.FileName); using (var validator = new LicenseAcceptor(_gen.PublicKeyInfoXML)) { var validated = validator.Validate(valLicense); MessageBox.Show(string.Format("License Valid: {0}", validated), "License Validation Result", MessageBoxButtons.OK); } } }