Defines an encrypted license for a component or control generated using the Infralution Licensing System.
The Infralution Licensing System provides a secure way of licensing .NET controls, components and applications. Licenses are protected using public key encryption to minimize possibility of cracking.
Inheritance: License
Example #1
0
 /// <summary>
 /// Install the license key entered by the user
 /// </summary>
 /// <param name="key">The key to install</param>
 /// <returns>True if the license was installed successfully</returns>
 protected virtual bool InstallLicenseKey(string key)
 {
     try
     {
         _license = GetLicenseProvider().InstallLicense(_licenseType, key);
         return (_license != null);
     }
     catch
     {
     }
     return false;
 }
Example #2
0
        /// <summary>
        /// Initialize a new instance of the DockingManagerStringsBase class.
        /// </summary>
        /// <param name="docking">Reference to owning docking manager.</param>
        public DockingManagerStringsBase(KryptonDockingManager docking)
        {
            // Define the encryted licence information
            EncryptedLicenseProvider.SetParameters(_licenseParameters);

            // If an error has already been shown, then no need to test license again
            bool validated = _usageShown;

            if (!validated)
            {
                // Is there a valid license registered?
                License license = null;
                validated = LicenseManager.IsValid(typeof(KryptonDockingManager), this, out license);

                // Valid license is not enough!
                if (validated)
                {
                    validated = false;
                    EncryptedLicense encryptedLicense = license as EncryptedLicense;
                    string[]         productInfo      = encryptedLicense.ProductInfo.Split(',');

                    // Must contain two fields separated by a comma
                    if (productInfo.Length == 2)
                    {
                        // Both fields must not be empty
                        if (!string.IsNullOrEmpty(productInfo[0]) &&
                            !string.IsNullOrEmpty(productInfo[1]))
                        {
                            // Product code must be ...
                            //    'S' = Krypton Suite
                            // And version number...
                            //    '440'
                            validated = (productInfo[1].Equals("440")) && (productInfo[0][0] == 'S');
                        }
                    }
                }

                // Remember to release resources no longer needed
                if (license != null)
                {
                    license.Dispose();
                }
            }

            // If we need to indicate the invalid licensing state...
            if (!validated)
            {
                // Get hold of the assembly version number
                Version thisVersion = Assembly.GetExecutingAssembly().GetName().Version;

                // We want a unique 30 day evaluation period for each major/minor version
                EvaluationMonitor monitor = new EvaluationMonitor(_monitorId + thisVersion.Major.ToString() + thisVersion.Minor.ToString());

                // If the first time we have failed to get the licence or
                // the 30 days evaluation period has expired or the component
                // has been created over a 3000 times then...
                if ((monitor.UsageCount == 0) ||
                    (monitor.UsageCount > 3000) ||
                    (monitor.DaysInUse > 30))
                {
                    // At runtime show a NAG screen to prevent unauthorized use of the control
                    if (LicenseManager.CurrentContext.UsageMode == LicenseUsageMode.Runtime)
                    {
                        MessageBox.Show("This application was created using an unlicensed version of\n" +
                                        "the Krypton Suite control from Component Factory Pty Ltd.\n\n" +
                                        "You must contact your software supplier in order to resolve\n" +
                                        "the licencing issue.",
                                        "Unlicensed Application",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Error);
                    }
                    else
                    {
                        LicenseInstallForm form = new LicenseInstallForm();
                        form.ShowDialog(typeof(KryptonDockingManager));
                    }
                }
            }

            // No need to perform check check more than once
            _usageShown = true;
        }