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; }
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; }