Skip to content

Commit ae14565

Browse files
committed
chore: updated sample
1 parent 8facfe1 commit ae14565

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

examples/sample.js

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
const { LexActivator, LexStatusCodes, LexActivatorException, PermissionFlags } = require('@cryptlex/lexactivator');
1+
const { LexActivator, LexStatusCodes, LexActivatorException, PermissionFlags, ReleaseFlags } = require('@cryptlex/lexactivator');
22

33
function init() {
4-
// LexActivator.SetProductFile("ABSOLUTE_PATH_OF_PRODUCT.DAT_FILE");
54
LexActivator.SetProductData('PASTE_CONTENT_OF_PRODUCT.DAT_FILE');
65
LexActivator.SetProductId('PASTE_PRODUCT_ID', PermissionFlags.LA_USER);
6+
LexActivator.SetReleasePlatform('RELEASE_PLATFORM'); // set the actual platform of the release e.g windows
7+
LexActivator.SetReleaseChannel('RELEASE_CHANNEL'); // set the actual channel of the release e.g stable
78
LexActivator.SetReleaseVersion('1.0.0'); // Set this to the release version of your app
89
}
910

@@ -46,6 +47,28 @@ function licenseCallback(status) {
4647
}
4748
}
4849

50+
function softwareReleaseUpdateCallback(status, release, userData) {
51+
try {
52+
switch (status) {
53+
case LexStatusCodes.LA_RELEASE_UPDATE_AVAILABLE:
54+
console.log('Release update available!');
55+
console.log("Release:", release.notes);
56+
break;
57+
case LexStatusCodes.LA_RELEASE_UPDATE_AVAILABLE_NOT_ALLOWED:
58+
console.log('Release update available but not allowed!');
59+
console.log("Release:", release.notes);
60+
break;
61+
case LexStatusCodes.LA_RELEASE_UPDATE_NOT_AVAILABLE:
62+
console.log('Release update not available!');
63+
break;
64+
default:
65+
throw new LexActivatorException(status);
66+
}
67+
} catch (error) {
68+
console.log(error.code, error.message);
69+
}
70+
}
71+
4972
function main() {
5073
try {
5174
init();
@@ -63,9 +86,7 @@ function main() {
6386
console.log('License user name: %s\n', userName);
6487

6588
// console.log('Checking for software release update...');
66-
// LexActivator.CheckForReleaseUpdate('windows', '1.0.0', 'stable', function (status) {
67-
// console.log('Release status:', status);
68-
// });
89+
// LexActivator.CheckReleaseUpdate(softwareReleaseUpdateCallback, ReleaseFlags.LA_RELEASES_ALL, null);
6990
} else if (LexStatusCodes.LA_EXPIRED == status) {
7091
console.log('License is genuinely activated but has expired!');
7192
} else if (LexStatusCodes.LA_SUSPENDED == status) {

0 commit comments

Comments
 (0)