Closed makcakaya closed 9 years ago
Portable.Licensing has only default english locale strings. It has only two pre defined validation failures:
Both provide default english texts; but you can easily match their type and display your own localized text in your UI. I don't know why we need an extra enum here.
Maybe you can elaborate a bit more, please.
Hmm, so we should utilize the type like this:
var failures = _license.Validate().ExpirationDate().And().Signature(publicKey).AssertValidLicense();
foreach(var failure in failures)
{
if(failure is LicenseExpiredValidationFailure){ .... }
else if (failure is InvalidSignatureValidationFailure) {.....}
else if (failure is GeneralValidationFailure) {..... } // general validation failure
else { throw InvalidOperationException("Should not happen"); }
}
This solves my problem.
For example, the message "Licensing for this product has expired!" is not appropriate if the application targets a different language.
Maybe validation should return an enumeration and we should use some kind of dictionary to get the message, and how to resolve information.