许可证.dll
使用 .NET 库“License.dll”,您可以在运行时确定锁定软件的当前许可证状态。你只需要在你的项目中引用这个库并访问相应的方法和属性即可。所有方法和属性都应该是不言自明的。您无需选择许可证文件。如果有可用的有效许可证文件,它将自动用于更新许可证状态。
请注意,“License.dll”的方法和属性只有在保护您的软件后才会返回正确的值。保护后,不再需要库“License.dll”。这意味着您可以在没有 License.dll 的情况下运送受保护的软件
如何示例:
- License.dll 的引用命名空间
- 检查是否有有效的许可证文件可用
- 从许可证中读取附加许可证信息
- 检查评估锁的许可状态
- 检查到期日期锁定的许可证状态
- 检查使用次数锁定的许可状态
- 检查 Number Of Instances Lock 的许可状态
- 检查硬件锁的许可证状态
- 获取当前机器的硬件ID
- 将当前硬件 ID 与许可证文件中存储的硬件 ID 进行比较
- 使许可证无效
- 检查确认码是否有效
- 重新激活许可证
- 使用文件名手动加载许可证
- 使用字节数组手动加载许可证
- 以字节数组的形式获取加载的许可证(如果可用)
如何示例代码:
License.dll 的参考命名空间:
// Reference Namespace of License.dll using License;
检查是否有有效的许可证文件可用:
// Check if a valid license file is available
public bool IsValidLicenseAvailable()
{
return License.Status.Licensed;
}
从许可证 license 中读取额外的许可证信息:
// Read additonal license information from a license license
public void ReadAdditonalLicenseInformation()
{
// Check first if a valid license file is found
if (License.Status.Licensed)
{
// Read additional license information
for (int i = 0; i < License.Status.KeyValueList.Count; i++)
{
string key = License.Status.KeyValueList.GetKey(i).ToString();
string value = License.Status.KeyValueList.GetByIndex(i).ToString();
}
}
}
查看 Evaluation Lock 的许可状态:
// Check the license status of Evaluation Lock
public void CheckEvaluationLock()
{
bool lock_enabled = License.Status.Evaluation_Lock_Enabled;
EvaluationType ev_type = License.Status.Evaluation_Type;
int time = License.Status.Evaluation_Time;
int time_current = License.Status.Evaluation_Time_Current;
}
检查到期日期锁定的许可证状态
// Check the license status of Expiration Date Lock
public void CheckExpirationDateLock()
{
bool lock_enabled = License.Status.Expiration_Date_Lock_Enable;
System.DateTime expiration_date = License.Status.Expiration_Date;
}
检查使用次数锁定的许可状态
// Check the license status of Number Of Uses Lock
public void CheckNumberOfUsesLock()
{
bool lock_enabled = License.Status.Number_Of_Uses_Lock_Enable;
int max_uses = License.Status.Number_Of_Uses;
int current_uses = License.Status.Number_Of_Uses_Current;
}
检查 Number Of Instances Lock 的许可状态
// Check the license status of Number Of Instances Lock
public void CheckNumberOfInstancesLock()
{
bool lock_enabled = License.Status.Number_Of_Instances_Lock_Enable;
int max_instances = License.Status.Number_Of_Instances;
}
检查硬件锁的许可证状态
// Check the license status of Hardware Lock
public void CheckHardwareLock()
{
bool lock_enabled = License.Status.Hardware_Lock_Enabled;
if (lock_enabled)
{
// Get Hardware ID which is stored inside the license file
string lic_hardware_id = License.Status.License_HardwareID;
}
}
获取当前机器的硬件ID
// Get Hardware ID of the current machine
public string GetHardwareID()
{
return License.Status.HardwareID;
}
将当前硬件 ID 与许可证文件中存储的硬件 ID 进行比较
// Compare current Hardware ID with Hardware ID stored in License File
public bool CompareHardwareID()
{
if (License.Status.HardwareID == License.Status.License_HardwareID)
return true;
else
return false;
}
使许可证无效
// Invalidate the license. Please note, your protected software does not accept a license file anymore!
public void InvalidateLicense()
{
string confirmation_code = License.Status.InvalidateLicense();
}
检查确认码是否有效
// Check if a confirmation code is valid
public bool CheckConfirmationCode(string confirmation_code)
{
return License.Status.CheckConfirmationCode(License.Status.HardwareID,
confirmation_code);
}
重新激活许可证
// Reactivate an invalidated license.
public bool ReactivateLicense(string reactivation_code)
{
return License.Status.ReactivateLicense(reactivation_code);
}
使用文件名手动加载许可证
// Load the license.
public void LoadLicense(string filename)
{
License.Status.LoadLicense(filename);
}
使用 byte[] 手动加载许可证
// Load the license.
public void LoadLicense(byte[] license)
{
License.Status.LoadLicense(license);
}
以 byte[] 的形式获取加载的许可证(如果可用)
// Get the license.
public byte[] GetLicense()
{
return License.Status.License;
}

QQ交谈
在线咨询

渝公网安备
50010702500608号

客服热线