private void LicensingITXAP_Load(object sender, EventArgs e) { if (!MyConfiguration.SkipLicensing) { this.Text = MyConfiguration.Application_Title; LblStatus.Text = "Enter Licensing Key to Activate " + MyConfiguration.Application_Title; EncryptedLicenseProvider provider = new EncryptedLicenseProvider(); EncryptedLicense license = provider.GetLicense(MyConfiguration.LICENSE_PARAMETERS,MyConfiguration.licenseFile); if (license == null) { PnlToActivate.Visible = true; PnlActivated.Visible = false; this.Height = 104; } else { PnlToActivate.Visible = false; PnlActivated.Visible = true; this.Height = 104; } } else { PnlToActivate.Visible = false; PnlActivated.Visible = true; this.Height = 104; } }
private void BtnActivate_Click(object sender, EventArgs e) { if (TxtKey.Text.Trim() == string.Empty) { ShowDialog("Input Licensing Key", Telerik.WinControls.RadMessageIcon.Info); return; } string key = TxtKey.Text.Trim(); if (!string.IsNullOrEmpty(key)) { EncryptedLicenseProvider provider = new EncryptedLicenseProvider(); EncryptedLicenseProvider.SetParameters(MyConfiguration.LICENSE_PARAMETERS); EncryptedLicense license = provider.InstallLicense(MyConfiguration.licenseFile, key); if (license == null) { ShowDialog("Invalid License Key Entered", Telerik.WinControls.RadMessageIcon.Info); return; } else { ShowDialog("Activated Successfully", Telerik.WinControls.RadMessageIcon.Info); this.Hide(); Application.DoEvents(); Installer Frm = new Installer(); Frm.ShowDialog(); Application.Exit(); } } }
protected virtual bool InstallLicenseKey(string key) { EncryptedLicenseProvider LicenseProvider = new EncryptedLicenseProvider(); EncryptedLicense license = LicenseProvider.ValidateLicenseKey(key); if (license == null) return false; else LicenseProvider.InstallLicense(MyConfiguration.licenseFile, license); return (license != null); }
public DynamicDataWebMethodReturnType GenerateKey() { ushort ushortserial = ushort.Parse("1"); //i.ToString()//key.Id.ToString()); //changed sept 7 string checksum = EncryptedLicense.Checksum(FullName + "|" + Organization); //DateTime future = DateTime.UtcNow.Add(TimeSpan.FromDays(365)); DateTime future = DateTime.UtcNow.Add(TimeSpan.FromDays(545)); EncryptedLicenseProvider licenseProvider = new EncryptedLicenseProvider(); string licensekey = licenseProvider.GenerateKey(ConfigurationManager.AppSettings["snap_productkey"], "C" + checksum + "$D" + future.Month.ToString() + "/" + future.Day.ToString() + "/" + future.Year.ToString(), ushortserial); //Key = licensekey; DynamicDataWebMethodReturnType ret = new DynamicDataWebMethodReturnType(); ret.Status = "License Key"; ret.Message = "Your license key is:\r\n\r\n";// +licensekey; ret.Exception = false; return ret; }