private License LoadLicense() { License license = null; try { string text = this.privateStorer.LoadKey(); if (text != null && text.Length > 0) { license = LicenseConverter.KeyToLicense(this.decoder, text); } else { text = this.publicStorer.LoadKey(); license = LicenseConverter.KeyToLicense(this.decoder, text); } } catch (Exception ex) { Log.ReportException(ex); } if (license != null && LicenseVerificator.IsCorrect(license) && LicenseVerificator.IsPregenerated(license)) { License license2 = this.LoadOldLicense(); if (license2 != null && LicenseVerificator.IsCorrect(license2) && !LicenseVerificator.IsPregenerated(license2)) { if (LicenseVerificator.IsOutdatedForVersion2x(license2)) { license2.UpgradeEvaluation = true; license2.StartTime = license.StartTime; license2.EndTime = license.EndTime; license = license2; } else { license = license2; } } } else { if (license == null) { License license3 = this.LoadOldLicense(); if (license3 != null && LicenseVerificator.IsCorrect(license3)) { license = license3; } } } return(license); }
public bool IsValidKey(string key) { bool result; try { key = KeyStringFormatter.ParseKey(key); License license = LicenseConverter.KeyToLicense(this.decoder, key); result = LicenseVerificator.IsValid(license, DateTime.UtcNow); } catch (LicensingException) { result = false; } return(result); }
public bool RegisterKey(string key) { key = KeyStringFormatter.ParseKey(key); License license = LicenseConverter.KeyToLicense(this.decoder, key); if (!LicenseVerificator.IsValid(license, DateTime.UtcNow)) { return(false); } this.privateStorer.SaveKey(key); this.CacheLicense(license); if (this.RegistrationChanged != null) { this.RegistrationChanged(this); } return(true); }
private License LoadOldLicense() { License result = null; try { string text = this.privateStorer.LoadOldKey(); if (text != null && text.Length > 0) { result = LicenseConverter.KeyToLicense(this.decoder, text); } else { text = this.publicStorer.LoadOldKey(); result = LicenseConverter.KeyToLicense(this.decoder, text); } } catch (Exception ex) { Log.ReportException(ex); } return(result); }
public License ParseKey(string key) { key = KeyStringFormatter.ParseKey(key); return(LicenseConverter.KeyToLicense(this.decoder, key)); }