How do I change the license binding to a different identifier?
private bool MigrateLicenseBinding ()
{
bool ret = false;
if (String.IsNullOrEmpty (lv.ComputerKey))
{
return ret;
}
// try the old license binding.
string computerID = string.Empty;
bool needsActivation = false;
string errorMsg = string.Empty;
ELicenseBinding oldLicenseBinding = ELicenseBinding.ComputerName;
bool valid = lv.ValidateLicense(lv.ActivationKey, lv.ComputerKey, ref computerID, oldLicenseBinding, ref needsActivation, ref errorMsg);
if (valid)
{
string response;
lv.QlmLicenseObject.ReleaseLicense(string.Empty, lv.ActivationKey, computerID, lv.ComputerKey, out response);
ILicenseInfo licenseInfo = new LicenseInfo();
string message = string.Empty;
if (lv.QlmLicenseObject.ParseResults(response, ref licenseInfo, ref message))
{
// we were able to deactivate the license.
// activate the license now using the new binding.
QlmHardware hw = new QlmHardware();
string newComputerID = hw.GetUniqueSystemIdentifier2();
string qlmVersion = "5.0.00";
lv.QlmLicenseObject.ActivateLicense(string.Empty, lv.ActivationKey, newComputerID, Environment.MachineName, qlmVersion, string.Empty, out response);
if (lv.QlmLicenseObject.ParseResults(response, ref licenseInfo, ref message))
{
// we were able to activate the license
lv.QlmLicenseObject.StoreKeys(lv.ActivationKey, licenseInfo.ComputerKey);
ret = true;
}
}
}
return ret;
}
Last updated