Exemplo n.º 1
0
        protected CryptoLicenseGenerator InitializeGenerator(string filePath)
        {
            CryptoLicenseGenerator generator = new CryptoLicenseGenerator(filePath);

            generator.SetLicenseCode("");
            return(generator);
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //Uncomment if you want to check for security purposes whether request is valid
//             if (!IsIPValid(this.Request))
//                 throw new Exception("Invalid IP");

                // Load license project file
                gen = CryptoLicenseGenerator.FromSettingsFile(Path.Combine(HttpRuntime.AppDomainAppPath, LicenseService.MakePortablePath(@"App_Data\settings.xml")));

                // ***IMPORTANT***: Set your 'CryptoLicensing License Service' license code below.
                // It can be found in the email containing the license information that you received from LogicNP when you purchased the product.
                // LEAVE BLANK when using evaluation version of CryptoLicensing.
                gen.SetLicenseCode("");

                // If profile is specified above, select it so that generated license
                // has same settings as specified by profile
                if (profileName.Length > 0)
                {
                    gen.SetActiveProfile(profileName);
                }

                // OPTIONAL: Set 'Numer of Users' setting of license to the quantity purchased
                //gen.NumberOfUsers = (short)GetHttpParam("QUANTITY", 1);

                // OPTIONAL: Use purchase data if desired
                // ShareIt notifies the purchase date in format specified in following line
                //DateTime datePurchased = GetHttpParam("PURCHASE_DATE", "dd/MM/yyyy",DateTime.Now);

                // Extract info for setting userdata
                string userName = GetHttpParam("ccustfullname", string.Empty);
                string email    = GetHttpParam("ccustemail", string.Empty);

                // Set user data
                gen.UserData = userName + "#" + email;

                // To populate the License Management database with user data
                // fields when generating licenses using the API,
                // see http://www.ssware.com/support/viewtopic.php?t=750
                // In this case, make sure to remove the "gen.UserData = ..." line above

                // Generate license
                string license = gen.Generate();

                // Send email if desired
                if (send_email)
                {
                    SendEmail(email);
                }
            }
            catch (Exception ex)
            {
                if (log_exceptions && !(ex is System.Threading.ThreadAbortException))
                {
                    LicenseService.LogException(ex);
                }
            }
        }
Exemplo n.º 3
0
        // END SETTINGS

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // Load license project file
                CryptoLicenseGenerator gen = CryptoLicenseGenerator.FromSettingsFile(Path.Combine(HttpRuntime.AppDomainAppPath, LicenseService.MakePortablePath(@"App_Data\settings.xml")));

                // ***IMPORTANT***: Set your 'CryptoLicensing License Service' license code below.
                // It can be found in the email containing the license information that you received from LogicNP when you purchased the product.
                // LEAVE BLANK when using evaluation version of CryptoLicensing.
                gen.SetLicenseCode("");

                // If profile is specified above, select it so that generated license
                // has same settings as specified by profile
                if (profileName.Length > 0)
                {
                    gen.SetActiveProfile(profileName);
                }

                // OPTIONAL: Set 'Numer of Users' setting of license to the quantity purchased
                //gen.NumberOfUsers = (short)GetHttpParam("quantity", 1);

                // OPTIONAL: Use purchase data if desired
                // RegNow notifies the purchase date in format specified in following line
                //DateTime datePurchased = GetHttpParam("date", "MM/dd/yyyy",DateTime.Now);

                // Extract info for setting userdata
                string userName = GetHttpParam("name", string.Empty);
                string email    = GetHttpParam("email", string.Empty);
                string company  = GetHttpParam("company", string.Empty);

                // Set user data
                gen.UserData = userName + "#" + company + "#" + email;

                // To populate the License Management database with user data
                // fields when generating licenses using the API,
                // see http://www.ssware.com/support/viewtopic.php?t=750
                // In this case, make sure to remove the "gen.UserData = ..." line above

                // Generate license
                string license = gen.Generate();

                // Return generated license code directly inline
                Response.ContentType = "text/plain";
                Response.Write(license);
                Response.End();
            }
            catch (Exception ex)
            {
                if (log_exceptions && !(ex is System.Threading.ThreadAbortException))
                {
                    LicenseService.LogException(ex);
                }
            }
        }
Exemplo n.º 4
0
        // END SETTINGS

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // Uncomment if you want to check for security purposes whether remote IP address is a Plimus IP address
                //if(!IsIPValid(GetRemoteIPAddress()))
                //    throw new Exception("Remote IP Address Invalid");

                // Load license project file
                CryptoLicenseGenerator gen = CryptoLicenseGenerator.FromSettingsFile(Path.Combine(HttpRuntime.AppDomainAppPath, LicenseService.MakePortablePath(@"App_Data\settings.xml")));

                // ***IMPORTANT***: Set your 'CryptoLicensing License Service' license code below.
                // It can be found in the email containing the license information that you received from LogicNP when you purchased the product.
                // LEAVE BLANK when using evaluation version of CryptoLicensing.
                gen.SetLicenseCode("");

                // If profile is specified above, select it so that generated license
                // has same settings as specified by profile
                if (profileName.Length > 0)
                {
                    gen.SetActiveProfile(profileName);
                }

                // OPTIONAL: Set 'Numer of Users' setting of license to the quantity purchased
                //gen.NumberOfUsers = (short)GetHttpParam("QUANTITY", 1);

                // Extract info for setting userdata
                string userName = GetHttpParam("CUSTOMER_NAME", string.Empty);
                string email    = GetHttpParam("CUSTOMER_EMAIL", string.Empty);
                string company  = GetHttpParam("COMPANY_NAME", string.Empty);

                // Set user data
                gen.UserData = userName + "#" + company + "#" + email;

                // To populate the License Management database with user data
                // fields when generating licenses using the API,
                // see http://www.ssware.com/support/viewtopic.php?t=750
                // In this case, make sure to remove the "gen.UserData = ..." line above

                // Generate license
                string license = gen.Generate();

                Response.ContentType = "text/plain";
                Response.Write(license);
                Response.End();
            }
            catch (Exception ex)
            {
                if (log_exceptions && !(ex is System.Threading.ThreadAbortException))
                {
                    LicenseService.LogException(ex);
                }
            }
        }
Exemplo n.º 5
0
        public override RawEsnecil GenerateLicense(Dictionary <string, string> customerInfo)
        {
            try
            {
                string filePath = _esnecilGeneratorFile.GetResource();
                ValidateGenerator(filePath);

                CryptoLicenseGenerator generator = base.InitializeGenerator(filePath); // Load license project file
                RawEsnecil             esnecil   = GenerateLicenseHelper(customerInfo, generator);

                return(esnecil);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // Currently only "web_accept" (used with 'Donate','Buy Now' buttons) is supported,
                // but can be easily extended to support others such as 'cart'
                string ipn_txn_type = GetHttpParam("txn_type", string.Empty);
                if (ipn_txn_type != "web_accept")
                {
                    throw new Exception("ipn_txn_type is not 'web_accept'");
                }

                // Product bought does not match ours
                string ipn_item_number = GetHttpParam("item_number", string.Empty);
                if (ipn_item_number != item_number)
                {
                    throw new Exception("ipn_item_number not equal to defined item number");
                }

                // Verify that costs match
                int     ipn_quantity = GetHttpParam("quantity", 1);
                Decimal ipn_mc_gross = GetHttpParam("mc_gross", Decimal.Zero);
                Decimal ipn_tax      = GetHttpParam("tax", Decimal.Zero);
                if (ipn_quantity * item_cost + ipn_tax != ipn_mc_gross)
                {
                    throw new Exception("Cost does not match");
                }

                // Verify IPN notification
                VerifyNotification();

                // Load license project file
                gen = CryptoLicenseGenerator.FromSettingsFile(Path.Combine(HttpRuntime.AppDomainAppPath, LicenseService.MakePortablePath(@"App_Data\settings.xml")));

                // ***IMPORTANT***: Set your 'CryptoLicensing License Service' license code below.
                // It can be found in the email containing the license information that you received from LogicNP when you purchased the product.
                // LEAVE BLANK when using evaluation version of CryptoLicensing.
                gen.SetLicenseCode("");

                // If profile is specified above, select it so that generated license
                // has same settings as specified by profile
                if (profileName.Length > 0)
                {
                    gen.SetActiveProfile(profileName);
                }

                // OPTIONAL: Set 'Numer of Users' setting of license to the quantity purchased
                // gen.NumberOfUsers = (short)ipn_quantity;

                // Extract info for setting userdata
                string userName = GetHttpParam("first_name", string.Empty) + " " + GetHttpParam("last_name", string.Empty);
                string email    = GetHttpParam("payer_email", string.Empty);
                string company  = GetHttpParam("payer_business_name", string.Empty);

                // Set user data
                gen.UserData = userName + "#" + company + "#" + email;

                // To populate the License Management database with user data
                // fields when generating licenses using the API,
                // see http://www.ssware.com/support/viewtopic.php?t=750
                // In this case, make sure to remove the "gen.UserData = ..." line above

                // Generate license (will be used in email template below)
                gen.Generate();

                // Send email if desired
                if (send_email)
                {
                    SendEmail(email);
                }
            }
            catch (Exception ex)
            {
                if (log_exceptions && !(ex is System.Threading.ThreadAbortException))
                {
                    LicenseService.LogException(ex);
                }
            }
        }
Exemplo n.º 7
0
        protected override RawEsnecil GenerateLicenseHelper(Dictionary <string, string> customerInfo, CryptoLicenseGenerator generator)
        {
            string id       = customerInfo["CodeID"];
            string userData = SetCustomerInfo(customerInfo);

            //generator.UserData = customerInfo;
            generator.NumberOfUsers = 1;
            generator.SetCustomInfo(id, userData); // not working yet
            generator.MachineCodeAsString  = MachineCode;
            generator.DetectDateRollback   = true;
            generator.EnableTamperChecking = true;

            string licCode    = generator.Generate();
            string serialCode = generator.SerialCodes[0];

            RawEsnecil esnecil = new RawEsnecil();

            esnecil.NoOfUsers            = generator.NumberOfUsers;
            esnecil.DetectDateRollback   = generator.DetectDateRollback;
            esnecil.EnableTamperChecking = generator.EnableTamperChecking;
            esnecil.RawUserData          = userData;
            esnecil.SerialCode           = serialCode;
            esnecil.MachineKey           = MachineCode;
            esnecil.EsnecilCode          = licCode;
            esnecil.GeneratedOn          = DateTime.UtcNow;

            return(esnecil);
        }
Exemplo n.º 8
0
 protected abstract RawEsnecil GenerateLicenseHelper(Dictionary <string, string> customerInfo, CryptoLicenseGenerator generator);