public void D() { byte[] certPrivateKeyData = null; var assembly = Assembly.GetExecutingAssembly(); using (MemoryStream memoryStream = new MemoryStream()) { assembly.GetManifestResourceStream("Celsus.Client.Admin.Resources.EbdysCert.pfx").CopyTo(memoryStream); certPrivateKeyData = memoryStream.ToArray(); } Celsus.Types.NonDatabase.LicenseData license = new Celsus.Types.NonDatabase.LicenseData(); license.CreatedBy = CreatedBy.Text; license.CreatedDate = CreatedDate.SelectedDate.Value; license.Customer = Customer.Text; license.Description = Description.Text; license.ExpireDate = ExpireDate.SelectedDate.Value; license.Id = new Guid(Id.Text); license.IsTrial = IsTrial.IsChecked.GetValueOrDefault(); license.ServerId = ServerId.Text; license.LicenseProperties = new List <Celsus.Types.NonDatabase.LicenseProperty>(); AddProperty(license, LicencePropertiesKey1, LicencePropertiesValue1); AddProperty(license, LicencePropertiesKey2, LicencePropertiesValue2); AddProperty(license, LicencePropertiesKey3, LicencePropertiesValue3); AddProperty(license, LicencePropertiesKey4, LicencePropertiesValue4); AddProperty(license, LicencePropertiesKey5, LicencePropertiesValue5); var serial = SignHandler.GenerateSignedSerial(license, certPrivateKeyData); Clipboard.SetText(serial); MessageBox.Show(serial); }
private void AddProperty(Celsus.Types.NonDatabase.LicenseData license, TextBox t1, TextBox t2) { if (string.IsNullOrWhiteSpace(t1.Text) == false && string.IsNullOrWhiteSpace(t2.Text) == false) { license.LicenseProperties.Add(new Celsus.Types.NonDatabase.LicenseProperty() { Name = t1.Text, Value = t2.Text }); } }