/// <summary> /// Shows an open file dialog and installs the selected license file /// </summary> private void installbutton_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { // Embedded the selected license file within the corresponding main application. // EvaluationMonitor.StoreLicenseAsResource(openFileDialog1.FileName); // Load the license file to update the current license status. The next time you run the main application the stored // license file will be found and loaded automatically. // EvaluationMonitor.LoadLicense(openFileDialog1.FileName); } }
public bool IsActive() { EncryptedLicenseProvider provider = new EncryptedLicenseProvider(); EncryptedLicense license = provider.GetLicense(LicenseBO.ValidationParameters, GetLicenseFile()); if (license == null) { EvaluationMonitor monitor = new EvaluationMonitor("SpittingImage"); if (monitor.DaysInUse > 15 || monitor.Invalid) { QuestionForm frm = new QuestionForm(); frm.Msg = "Your trial license has expired. Would you like to enter a license key to activate the software?"; if (frm.ShowDialog() == DialogResult.OK) { LicenseForm licfrm = new LicenseForm(); license = licfrm.ShowDialog("Llama Carbon Copy", Properties.Settings.Default.Website, LicenseBO.GetLicenseFile()); if (license != null) { OnLicensed(EventArgs.Empty); } } } else { MessageForm frm = new MessageForm(); frm.Msg = string.Format("You are on day {0} of your 15 day evaluation.", monitor.DaysInUse); frm.ShowDialog(); return(true); } } if (license == null) { return(false); } else { return(true); } }
/// <summary> /// Perform licence checking actions. /// </summary> /// <param name="ribbon">Ribbon control reference.</param> protected void PerformLicenceChecking(KryptonRibbon ribbon) { // 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(KryptonRibbon), ribbon, 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... // '400' validated = (productInfo[1].Equals("400")) && (productInfo[0][0] == 'S'); } } } } // 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(KryptonRibbon)); } } } // No need to perform check check more than once _usageShown = true; }
internal static bool smethod_0() { return(EvaluationMonitor.smethod_0().method_0() != (LicenseStatus)0 && EvaluationMonitor.smethod_0().method_0() != (LicenseStatus)1); }