private void CacheLicense(License license) { this.cachedLicense = license; try { this.cachedIsRegistered = LicenseVerificator.IsValid(license, DateTime.UtcNow); } catch (Exception ex) { Log.ReportException(ex); this.cachedIsRegistered = false; } this.licenseIsCached = true; }
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); }