View previous topic :: View next topic |
Author |
Message |
wout
Joined: 27 Jul 2011 Posts: 16
|
Posted: Tue Jul 10, 2012 1:58 pm Post subject: License separate classes in an assembly. |
|
|
I want to license separate classes in an assembly. Is there a way to do this?
Is it possible to get the EncryptedLicense at runtime? I only see a way to check LicenseManager.IsLicensed(Type), or get the License, but not the EncryptedLicense, from which I could get additional product info.
At the moment I use separate LICENSE_PARAMETERS for each class, but this doesn't seem very convenient for the customer (or us). I'd prefer 1 LICENSE_PARAMETERS, and then put something in product info for each separately licensed class.
- Wout |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue Jul 10, 2012 11:41 pm Post subject: |
|
|
Yes you can get the encrypted license by calling the LicenseManager.IsValid method instead of the IsLicensed method. You then need to cast the license object returned in the out parameter to an EncryptedLicense is follows:
Code: | License license;
if (LicenseManager.IsValid(typeof(MyControl), this, out license))
{
EncryptedLicense encryptedLicense = license as EncryptedLicense;
string licensedProduct = encryptedLicense.ProductInfo;
} |
You can then use a single LICENSE_PARAMETERS and include a string that identifies the licensed components in the ProductInfo. _________________ Infralution Support |
|
Back to top |
|
|
wout
Joined: 27 Jul 2011 Posts: 16
|
Posted: Wed Jul 11, 2012 8:25 am Post subject: |
|
|
Ah, I didn't know it could be cast, thanks for the hint, I will try this!
- Wout |
|
Back to top |
|
|
|