public void RegisterLicenseKey(string key) { if (!LicenseKeyValidator.IsValid(key)) { throw new SoftwareException("The provided license key is invalid"); } LicenseKeyProvider.SetLicenseKey(key); Apply(); }
protected virtual LicenseInformation DetermineLicenseInformation() { var hasDefaultLicenseKey = LicenseKeyProvider.HasDefaultLicenseKey(); var hasRegisteredLicenseKey = LicenseKeyProvider.HasRegisteredLicenseKey(); var hasLicenseOverride = LicenseKeyProvider.HasLicenseOverrideCommand(); var defaultLicenseKey = hasDefaultLicenseKey ? LicenseKeyProvider.GetDefaultLicenseKey() : null; var registeredLicenseKey = hasRegisteredLicenseKey ? LicenseKeyProvider.GetRegisteredLicenseKey() : null; return(new LicenseInformation { HasDefaultLicenseKey = hasDefaultLicenseKey, DefaultLicenseKey = defaultLicenseKey, DefaultLicense = hasDefaultLicenseKey ? LicenseKeyDecoder.Decode(defaultLicenseKey) : null, HasLicenseOverrideCommand = hasLicenseOverride, LicenseOverrideCommand = hasLicenseOverride ? LicenseKeyProvider.GetLicenseOverrideCommand() : null, HasRegisteredLicenseKey = hasRegisteredLicenseKey, RegisteredLicenseKey = registeredLicenseKey, RegisteredLicense = hasRegisteredLicenseKey ? LicenseKeyDecoder.Decode(registeredLicenseKey) : null }); }
public void RemoveLicenseOverrideCommand() { LicenseKeyProvider.RemoveLicenseOverrideCommand(); Apply(); }
public void RegisterLicenseOverrideCommand(ProductLicenseCommand command) { LicenseKeyProvider.SetLicenseOverrideCommand(command); Apply(); }