void Generate() { foreach (var property in GetType().GetProperties()) { if (property.GetSetMethod() == null) { continue; } var data = property.GetValue(this, null); if (data == null || string.IsNullOrEmpty(data.ToString())) { MessageBox.Show(string.Format("Please enter value for {0}.", property.Name.SplitCamelCase()), "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } } var licenseFile = Path.Combine(Application.Current.GetStartupDirectory(), string.Format("{0}_license.aes", Email)); var license = StrongLicense.Generate(DateTime.Now, DateTime.Now.AddDays(Days), Email, BusinessName, ContactPerson, ContactNumber, licenseFile); SerialKey = license.SerialKey; ActivationKey = license.ActivationKey; Clipboard.SetText(license.ToString()); if (license == null) { MessageBox.Show("Failed to generate license.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } else { MessageBox.Show("License generated successfully and copied to clipboard."); } }
void FillMachineInfo() { MachineName = Environment.MachineName; BiosSerial = StrongLicense.GetMachineKey(); }