許可證.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交談
QQ交談 在線咨詢
在線咨詢 
                 
                
 渝公網安備
            50010702500608號
渝公網安備
            50010702500608號
             
            
 客服熱線
客服熱線