Esempio n. 1
0
 static void Init()
 {
     // LexActivator.SetProductFile ("ABSOLUTE_PATH_OF_PRODUCT.DAT_FILE");
     LexActivator.SetProductData("PASTE_CONTENT_OF_PRODUCT.DAT_FILE");
     LexActivator.SetProductId("PASTE_PRODUCT_ID", LexActivator.PermissionFlags.LA_USER);
     LexActivator.SetAppVersion("PASTE_YOUR_APP_VERION");
 }
Esempio n. 2
0
        public ActivationForm()
        {
            InitializeComponent();
            int status;

            // status = LexActivator.SetProductFile ("ABSOLUTE_PATH_OF_PRODUCT.DAT_FILE");
            status = LexActivator.SetProductData("PASTE_CONTENT_OF_PRODUCT.DAT_FILE");
            if (status != LexActivator.StatusCodes.LA_OK)
            {
                this.statusLabel.Text = "Error setting product file: " + status.ToString();
                return;
            }
            status = LexActivator.SetProductId("PASTE_PRODUCT_ID", LexActivator.PermissionFlags.LA_USER);
            if (status != LexActivator.StatusCodes.LA_OK)
            {
                this.statusLabel.Text = "Error setting product id: " + status.ToString();
                return;
            }
            // Setting license callback is recommended for floating licenses
            // status = LexActivator.SetLicenseCallback(LicenseCallback);
            // if (status != LexActivator.StatusCodes.LA_OK)
            // {
            // this.statusLabel.Text = "Error setting callback function: " + status.ToString();
            // return;
            // }
            status = LexActivator.IsLicenseGenuine();
            if (status == LexActivator.StatusCodes.LA_OK || status == LexActivator.StatusCodes.LA_EXPIRED || status == LexActivator.StatusCodes.LA_SUSPENDED || status == LexActivator.StatusCodes.LA_GRACE_PERIOD_OVER)
            {
                // uint expiryDate = 0;
                // LexActivator.GetLicenseExpiryDate(ref expiryDate);
                // int daysLeft = (int)(expiryDate - unixTimestamp()) / 86500;
                this.statusLabel.Text         = "License genuinely activated! Activation Status: " + status.ToString();
                this.activateBtn.Text         = "Deactivate";
                this.activateTrialBtn.Enabled = false;
                return;
            }
            status = LexActivator.IsTrialGenuine();
            if (status == LexActivator.StatusCodes.LA_OK)
            {
                uint trialExpiryDate = 0;
                LexActivator.GetTrialExpiryDate(ref trialExpiryDate);
                int daysLeft = (int)(trialExpiryDate - unixTimestamp()) / 86500;
                this.statusLabel.Text         = "Trial period! Days left:" + daysLeft.ToString();
                this.activateTrialBtn.Enabled = false;
            }
            else if (status == LexActivator.StatusCodes.LA_TRIAL_EXPIRED)
            {
                this.statusLabel.Text = "Trial has expired!";
            }
            else
            {
                this.statusLabel.Text = "Trial has not started or has been tampered: " + status.ToString();
            }
        }
Esempio n. 3
0
        public ActivationForm()
        {
            InitializeComponent();
            try
            {
                // LexActivator.SetProductFile ("ABSOLUTE_PATH_OF_PRODUCT.DAT_FILE");
                LexActivator.SetProductData("PASTE_CONTENT_OF_PRODUCT.DAT_FILE");
                LexActivator.SetProductId("PASTE_PRODUCT_ID", LexActivator.PermissionFlags.LA_USER);
                // LexActivator.SetLicenseCallback(LicenseCallback);

                int status = LexActivator.IsLicenseGenuine();
                if (status == LexStatusCodes.LA_OK || status == LexStatusCodes.LA_EXPIRED || status == LexStatusCodes.LA_SUSPENDED || status == LexStatusCodes.LA_GRACE_PERIOD_OVER)
                {
                    uint expiryDate = LexActivator.GetLicenseExpiryDate();
                    int  daysLeft   = (int)(expiryDate - unixTimestamp()) / 86400;
                    this.statusLabel.Text         = "License genuinely activated! Activation Status: " + status.ToString();
                    this.activateBtn.Text         = "Deactivate";
                    this.activateTrialBtn.Enabled = false;

                    // Checking for software release update
                    // LexActivator.CheckForReleaseUpdate("windows", "1.0.0", "stable", SoftwareReleaseUpdateCallback);
                    return;
                }
                status = LexActivator.IsTrialGenuine();
                if (status == LexStatusCodes.LA_OK)
                {
                    uint trialExpiryDate = LexActivator.GetTrialExpiryDate();
                    int  daysLeft        = (int)(trialExpiryDate - unixTimestamp()) / 86400;
                    this.statusLabel.Text         = "Trial period! Days left:" + daysLeft.ToString();
                    this.activateTrialBtn.Enabled = false;
                }
                else if (status == LexStatusCodes.LA_TRIAL_EXPIRED)
                {
                    this.statusLabel.Text = "Trial has expired!";
                }
                else
                {
                    this.statusLabel.Text = "Trial has not started or has been tampered: " + status.ToString();
                }
            }
            catch (LexActivatorException ex)
            {
                this.statusLabel.Text = "Error code: " + ex.Code.ToString() + " Error message: " + ex.Message;
            }
        }