Ejemplo n.º 1
0
 private void Licensing_Load(object sender, EventArgs e)
 {
     if (!MyConfiguration.SkipLicensing)
     {
         EvaluationDialog evaluationDialog = new EvaluationDialog(MyConfiguration.Application_Title,MyConfiguration.Application_Title);
         LblDuration.Text = "You are on the day " + evaluationDialog.EvaluationMonitor.DaysInUse +" out of 30 day evaluation";
         this.Height = PnlDisplay.Height + 25;
         Application.DoEvents();
     }
     else
     {
         this.Hide();
         Application.DoEvents();
         Installer Frm = new Installer();
         Frm.ShowDialog();
         Application.Exit();
     }
 }
Ejemplo n.º 2
0
        //Comment Add for other path.
        //static string _licenseFile =Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\LicensedApp\LicensedApp.lic";
        //static string _licenseFile = AppDomain.CurrentDomain.BaseDirectory + @"\LicensedApp\LicensedApp.lic";
        //static string _licenseFile = Application.ExecutablePath + @"\LicensedApp\LicensedApp.lic";


        /// <summary>
        /// Function used for Check the License
        /// </summary>
        /// <returns>bool</returns>
        public static bool CheckLicense()
        {
            if (LicenseManager.CurrentContext.UsageMode == LicenseUsageMode.Runtime)
            {
                return(true);
            }
            Application.EnableVisualStyles();

            // check if there is a valid license for the application

            EncryptedLicenseProvider provider = new EncryptedLicenseProvider();

            _license = provider.GetLicense(LICENSE_PARAMETERS, _licenseFile);
            // if there is no installed license then display the evaluation dialog until
            // the user installs a license or selects Exit or Continue

            while (_license == null)
            {
                EvaluationMonitor evaluationMonitor = new RegistryEvaluationMonitor("MyEvaluationPassword");
                EvaluationDialog  evaluationDialog  = new EvaluationDialog(evaluationMonitor, "Guru Components");
                evaluationDialog.EvaluationMessage = " Thank for you evaluating Guru Components Netrix Professional v2.0. To continue your evaluation please click the Continue Evaluation button";
                evaluationDialog.ExtendedTrialDays = 60;
                evaluationDialog.TrialDays         = 60;
                EvaluationDialogResult dialogResult = evaluationDialog.ShowDialog();
                if (dialogResult == EvaluationDialogResult.Exit)
                {
                    return(false);                                                //exit the app
                }
                if (dialogResult == EvaluationDialogResult.Continue)
                {
                    break;                                                       //exit the loop
                }
                if (dialogResult == EvaluationDialogResult.InstallLicense)
                {
                    EncryptedLicenseInstallForm licenseForm = new EncryptedLicenseInstallForm();
                    _license = licenseForm.ShowDialog("HTML EDITOR", _licenseFile, null);
                }
            }

            return(true);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Checks the application license.
        /// </summary>
        private void CheckLicense()
        {
            /// <summary>
            /// Number of days trial license is valid for
            /// </summary>
            const int TRIAL_DAYS = 30;

            /// <summary>
            /// License Validation Parameters copied from the License Key Generator 
            /// </summary>
            const string LICENSE_PARAMETERS =
                @"<AuthenticatedLicenseParameters>
	              <EncryptedLicenseParameters>
	                <ProductName>LaJust Power Meter</ProductName>
	                <RSAKeyValue>
	                  <Modulus>n66mRwUlIE5rGPYLtrCrdDR1yGuOZbyALMEKvO6X2fIqWkTgVtaCKHVnjzxVG1JSOlngHuCtoOypeuL0pNKyxj4/0TGny7mYS5Eas2J0NnDEH2P75FsVzGQ7ESNyns/uXEmtCgzVCtfktW3X7bNQgi3ycb1ZCwJVjVaoQGiuUyM=</Modulus>
	                  <Exponent>AQAB</Exponent>
	                </RSAKeyValue>
	                <DesignSignature>X0XJLQFa08k1f6BD9Zte2OyJyW/mk0dro0EYPN9nDM5egOzn1ljCBBGWdPEZmPHz++G7w1uNvTMI/KcIlgUTa/oTJAbd/kOXbDIDliZX1NAPkxtgAdhxiZL/TL3rx9faMdWg78C4jucprOmTCHHAjz1xHtBRoOWbQhV3jT9LhX0=</DesignSignature>
	                <RuntimeSignature>L5hUaIqMKt3xY0jOl8oKcoPnDzLfuZIV5/gHKJt/cqrm6ufnfmynGjNiL24nt2Lqczt+P3HeUSIxnikJJtJ+bRI5d6ljiRuP2vB1yu73gEAU1cF24HKz3v+xMsYmRBdVvuShKCvpLB2JFAjZE9HejFr73p+pCIlsZyZjAn2H930=</RuntimeSignature>
	                <KeyStrength>7</KeyStrength>
	                <ChecksumProductInfo>True</ChecksumProductInfo>
	                <TextEncoding>Base32</TextEncoding>
	                <ShortSerialNo>False</ShortSerialNo>
	              </EncryptedLicenseParameters>
	              <AuthenticationServerURL>http://authsvc.lajust.net/LicenseService/AuthenticationService.asmx</AuthenticationServerURL>
	              <ServerRSAKeyValue>
	                <Modulus>zpt4gdTSKUZTSpbfEL02AJKqNbfeJZ79Xe6Z76dCzX+ntPQL+lusGJ1TUbGpY6SPdLHc++8Dvnl5F+8mT2nBhBNUYtVCohE3GrQin1B/zi42PUvgy/lx4jbW1GfG2blYYqwgp/TOXciQo+aHcuhgpX8w+1azd6zD/gb/yo8asPc=</Modulus>
	                <Exponent>AQAB</Exponent>
	              </ServerRSAKeyValue>
	            </AuthenticatedLicenseParameters>";

            // Check for machine names checksums that do not require license files
            // We don't put the actual machine name in the code for security reasons
            switch (LicenseUtilities.Checksum(Environment.MachineName.ToUpper()))
            {
                case "766": // "LAJUST-MSI" MSI 2200AE All In One Machine
                case "754": // "LAJUST-PC" Dell Studio One All In One Machine
                    return;
            }

            // The license file, the directory will automatically get created if required
            string licenseFile = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\LaJust\LaJustPowerMeter.lic";

            // Check if there is a valid license for the application
            MyAuthenticatedLicenseProvider licenseProvider = new MyAuthenticatedLicenseProvider();
            _license = licenseProvider.GetLicense(LICENSE_PARAMETERS, licenseFile, true);

            // Allow forcing of the license dialog using command line option
            if (Environment.CommandLine.ToUpper().Contains("/LICENSE"))
            {
                MyAuthenticatedLicenseInstallForm licenseForm = new MyAuthenticatedLicenseInstallForm();
                _license = licenseForm.ShowDialog(Solution.Product, licenseFile, _license);
            }

            // If there is no installed license then display the evaluation dialog until
            // the user installs a license or selects Exit or Continue
            while (_license == null || _license.Status != AuthenticatedLicenseStatus.Valid)
            {
                EvaluationMonitor evaluationMonitor = new IsolatedStorageEvaluationMonitor(LicenseUtilities.Checksum(Solution.Version), true, false);
                EvaluationDialog evaluationDialog = new EvaluationDialog(evaluationMonitor, Solution.Product) { TrialDays = TRIAL_DAYS, ExtendedTrialDays = TRIAL_DAYS };
                EvaluationDialogResult dialogResult = evaluationDialog.ShowDialog();
                if (dialogResult == EvaluationDialogResult.Exit) Environment.Exit(0);
                else if (dialogResult == EvaluationDialogResult.Continue) break; // exit the loop 
                else if (dialogResult == EvaluationDialogResult.InstallLicense)
                {
                    MyAuthenticatedLicenseInstallForm licenseForm = new MyAuthenticatedLicenseInstallForm();
                    _license = licenseForm.ShowDialog(Solution.Product, licenseFile, _license);
                }
            }
        }
Ejemplo n.º 4
0
        private void CheckLicense()
        {
            const int TRIAL_DAYS = 30;

            const string LICENSE_PARAMETERS =
                @"<AuthenticatedLicenseParameters>
	              <EncryptedLicenseParameters>
	                <ProductName>LaJust Power Meter</ProductName>
	                <RSAKeyValue>
	                  <Modulus>n66mRwUlIE5rGPYLtrCrdDR1yGuOZbyALMEKvO6X2fIqWkTgVtaCKHVnjzxVG1JSOlngHuCtoOypeuL0pNKyxj4/0TGny7mYS5Eas2J0NnDEH2P75FsVzGQ7ESNyns/uXEmtCgzVCtfktW3X7bNQgi3ycb1ZCwJVjVaoQGiuUyM=</Modulus>
	                  <Exponent>AQAB</Exponent>
	                </RSAKeyValue>
	                <DesignSignature>X0XJLQFa08k1f6BD9Zte2OyJyW/mk0dro0EYPN9nDM5egOzn1ljCBBGWdPEZmPHz++G7w1uNvTMI/KcIlgUTa/oTJAbd/kOXbDIDliZX1NAPkxtgAdhxiZL/TL3rx9faMdWg78C4jucprOmTCHHAjz1xHtBRoOWbQhV3jT9LhX0=</DesignSignature>
	                <RuntimeSignature>L5hUaIqMKt3xY0jOl8oKcoPnDzLfuZIV5/gHKJt/cqrm6ufnfmynGjNiL24nt2Lqczt+P3HeUSIxnikJJtJ+bRI5d6ljiRuP2vB1yu73gEAU1cF24HKz3v+xMsYmRBdVvuShKCvpLB2JFAjZE9HejFr73p+pCIlsZyZjAn2H930=</RuntimeSignature>
	                <KeyStrength>7</KeyStrength>
	                <ChecksumProductInfo>True</ChecksumProductInfo>
	                <TextEncoding>Base32</TextEncoding>
	                <ShortSerialNo>False</ShortSerialNo>
	              </EncryptedLicenseParameters>
	              <AuthenticationServerURL>http://authsvc.lajust.net/LicenseService/AuthenticationService.asmx</AuthenticationServerURL>
	              <ServerRSAKeyValue>
	                <Modulus>zpt4gdTSKUZTSpbfEL02AJKqNbfeJZ79Xe6Z76dCzX+ntPQL+lusGJ1TUbGpY6SPdLHc++8Dvnl5F+8mT2nBhBNUYtVCohE3GrQin1B/zi42PUvgy/lx4jbW1GfG2blYYqwgp/TOXciQo+aHcuhgpX8w+1azd6zD/gb/yo8asPc=</Modulus>
	                <Exponent>AQAB</Exponent>
	              </ServerRSAKeyValue>
	            </AuthenticatedLicenseParameters>"    ;

            // Check for machine names checksums that do not require license files
            // We don't put the actual machine name in the code for security reasons
            switch (LicenseUtilities.Checksum(Environment.MachineName.ToUpper()))
            {
            case "766":     // "LAJUST-MSI" MSI 2200AE All In One Machine
            case "754":     // "LAJUST-PC"  Dell Studio One All In One Machine
                return;
            }

            // The license file, the directory will automatically get created if required
            string licenseFile = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\LaJust\LaJustPowerMeter.lic";

            // Check if there is a valid license for the application
            MyAuthenticatedLicenseProvider licenseProvider = new MyAuthenticatedLicenseProvider();
            AuthenticatedLicense           license         = licenseProvider.GetLicense(LICENSE_PARAMETERS, licenseFile, true);

            // Allow forcing of the license dialog using command line option
            if (Environment.CommandLine.ToUpper().Contains("/LICENSE"))
            {
                MyAuthenticatedLicenseInstallForm licenseForm = new MyAuthenticatedLicenseInstallForm();
                license = licenseForm.ShowDialog(Solution.Product, licenseFile, license);
            }

            // If there is no installed license then display the evaluation dialog until
            // the user installs a license or selects Exit or Continue
            EvaluationMonitor evaluationMonitor = new IsolatedStorageEvaluationMonitor(LicenseUtilities.Checksum(Solution.Version), false, false);
            EvaluationDialog  evaluationDialog  = new EvaluationDialog(evaluationMonitor, Solution.Product)
            {
                TrialDays = TRIAL_DAYS, ExtendedTrialDays = TRIAL_DAYS
            };

            while (license == null || license.Status != AuthenticatedLicenseStatus.Valid)
            {
                EvaluationDialogResult dialogResult = evaluationDialog.ShowDialog();
                if (dialogResult == EvaluationDialogResult.Exit)
                {
                    Environment.Exit(0);
                }
                else if (dialogResult == EvaluationDialogResult.Continue)
                {
                    break; // exit the loop
                }
                else if (dialogResult == EvaluationDialogResult.InstallLicense)
                {
                    MyAuthenticatedLicenseInstallForm licenseForm = new MyAuthenticatedLicenseInstallForm();
                    license = licenseForm.ShowDialog(Solution.Product, licenseFile, license);
                }
            }

            // Reset the evaluation monitor if there is a currently valid license, this allows
            // for another 30 days trial if something should happen to the license
            if (license != null && license.Status == AuthenticatedLicenseStatus.Valid)
            {
                evaluationMonitor.Reset(true);
            }
        }