Support
Joined: 18 Jul 2005 Posts: 731
|
Posted: Fri Jun 26, 2009 11:13 am Post subject: INFO: Licensing Plugins & Addins |
|
|
The general scheme for licensing of plugins or addins is as follows:
In the constructor/initialization routine of your plugin/addin, use a trial license code generated using CryptoLicensing Generator - this trial code can specify any constraints you wish such as 'Max usage days', 'Max executions', 'Max unique usage days' etc. Further you can also limit the functionality of your plugin if its an evaluation license.
When the user enters a full license, you will pass it on to CryptoLicensing using the CryptoLicense.LicenseCode property and then save it using CryptoLicense.Save so that it will be used the next time your plugin is loaded.
Thus, if a full license is loaded (saved above), it will be get validated, otherwise the trial license will get validated by default.
[C#]
Code: | CryptoLicense cryptoLicense = new CryptoLicense(LicenseStorageMode.ToRegistry, "<<validation key for your project>>");
// Load license from registry
if (cryptoLicense.Load() == false)
{
// license not found in registry which means that the user has not yet entered a full license
// Use a trial license
cryptoLicense.LicenseCode = "<<trial license code>>";
}
// check that the full license is valid or that the eval license is valid and not expired
if (cryptoLicense.Status != LicenseStatus.Valid)
{
MessageBox.Show("license not valid/evalution expired");
}
// license is valid
// we can check if its trial license and reduce functionality if so desired
if (cryptoLicense.IsEvaluationLicense())
{
// reduce functionality is so desired
}
...
...
...
// user enters a full license
cryptoLicense.LicenseCode = "<<license code entered by user>>";
if (cryptoLicense.Status != LicenseStatus.Valid)
{
MessageBox.Show("invalid license entered");
}
else
{
// save license so that it will get loaded next time the plugin starts
cryptoLicense.Save();
} |
[VB.Net]
Code: | Dim cryptoLicense As CryptoLicense = New CryptoLicense(LicenseStorageMode.ToRegistry, "<<validation key for your project>>")
' Load license from registry
If (cryptoLicense.Load() = False) Then
' license not found in registry which means that the user has not yet entered a full license
' Use a trial license
cryptoLicense.LicenseCode = "<<trial license code>>"
End If
' check that the full license is valid or that the eval license is valid and not expired
If (cryptoLicense.Status <> LicenseStatus.Valid) Then
MessageBox.Show("license not valid/evalution expired")
End If
' license is valid
' we can check if its trial license and reduce functionality if so desired
If (cryptoLicense.IsEvaluationLicense()) Then
' reduce functionality is so desired
End If
...
...
...
' user enters a full license
cryptoLicense.LicenseCode = "<<license code entered by user>>"
If (cryptoLicense.Status <> LicenseStatus.Valid) Then
MessageBox.Show("invalid license entered")
Else
' save license so that it will get loaded next time the plugin starts
cryptoLicense.Save()
End If
End Sub |
|
|