コード例 #1
0
        public ILicenseActivation Activate(string regCode, string productCode, string version, string host, string productKey, string actCode)
        {
            RegCode r = new RegCode(regCode);

            host = SanitizeHost(host, "", r.VariantCode);

            LicenseActivation act = new LicenseActivation();
            act.RegistrationCode = regCode;
            act.Host = host;
            act.ActivationCode = actCode;
            act.ProductKey = productKey;
            act.BaseProductCode = r.ProductCode;
            act.BaseProductVersion = version;

            if (!act.IsValid(productCode, version)) {
                throw new Exception("Invalid activation");
            }

            // add activation
            _src.AddActivation(act);
            _initActivations[act.Host] = act;
            _validActivations[act.Host] = act;

            return act;
        }
コード例 #2
0
        public ILicenseActivation Activate(string regCode, string productCode, string version, string host, string productKey)
        {
            RegCode r = new RegCode(regCode);

            // remove www, dev, staging, etc
            host = SanitizeHost(host, "", r.VariantCode);

            Dictionary<string, string> data = new Dictionary<string, string>();
            Dictionary<string, string> prvData = new Dictionary<string, string>();
            data["product"] = productCode; // this is not encrypted because we need to extract the private key on the server side
            prvData["regcode"] = regCode;
            prvData["version"] = version;
            prvData["minorversion"] = version;
            prvData["hostname"] = host;

            XmlDocument xmlAct = new XmlDocument();
            try {
                xmlAct.LoadXml(SendData(_regCoreSrv.Address + "?cmd=activate", productKey, data, prvData));
            } catch (Exception e) {
                throw new Exception("An error occured (" + e.Message + ")");
            }

            if (xmlAct["error"] != null) {
                throw new Exception(xmlAct["error"].InnerText);
            }

            LicenseActivation act = new LicenseActivation();
            act.RegistrationCode = regCode;
            act.Host = xmlAct.FirstChild["host"].InnerText;
            act.ActivationCode = xmlAct.FirstChild["activation_code"].InnerText;
            act.ProductKey = xmlAct.FirstChild["product_key"].InnerText;
            act.BaseProductCode = r.ProductCode;
            act.BaseProductVersion = xmlAct.FirstChild["version"].InnerText;

            if (!act.IsValid(productCode, version)) {
                throw new Exception("Invalid activation");
            }

            // add activation
            _src.AddActivation(act);
            _initActivations[act.Host] = act;
            _validActivations[act.Host] = act;

            return act;
        }
コード例 #3
0
        protected void OnNext(Object Sender, EventArgs args)
        {
            txtRegistrationCode.Text = txtRegistrationCode.Text.Trim();

            RegCode regCode;
            try {
                regCode = new RegCode(txtRegistrationCode.Text);
                //if (!regCode.IsValid(RedirectController.Version)) {
                //    throw new Exception();
                //}
            } catch {
                validateActivation.Text = "The registration code you supplied is invalid.";
                validateActivation.IsValid = false;
                return;
            }

            pnlHosts.Visible = true;
            pnlActivateManuallyBtn.Visible = true;

            switch (regCode.VariantCode) {
                case "DOM":
                    FillDomains();
                    break;
                case "3DOM":
                    FillDomains();
                    break;
                case "10DOM":
                    FillDomains();
                    break;
                case "XDOM":
                    FillDomains();
                    break;
                case "SRV":
                    FillDomainsForServers();
                    break;
                case "30DAY":
                    FillAll();
                    break;
                default:
                    FillAll();
                    break;
            }

            btnNext.Visible = false;
        }